mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-05 14:06:27 -05:00
refactor: minor styling, prefer snake case and same line if
This commit is contained in:
parent
d64deac7b8
commit
2b1fdc2c6c
3 changed files with 7 additions and 8 deletions
|
@ -44,7 +44,7 @@ UniValue ValueFromAmount(const CAmount amount);
|
||||||
std::string FormatScript(const CScript& script);
|
std::string FormatScript(const CScript& script);
|
||||||
std::string EncodeHexTx(const CTransaction& tx, const int serializeFlags = 0);
|
std::string EncodeHexTx(const CTransaction& tx, const int serializeFlags = 0);
|
||||||
std::string SighashToStr(unsigned char sighash_type);
|
std::string SighashToStr(unsigned char sighash_type);
|
||||||
void ScriptPubKeyToUniv(const CScript& scriptPubKey, UniValue& out, bool fIncludeHex, bool include_address = true);
|
void ScriptPubKeyToUniv(const CScript& scriptPubKey, UniValue& out, bool include_hex, bool include_address = true);
|
||||||
void ScriptToUniv(const CScript& script, UniValue& out);
|
void ScriptToUniv(const CScript& script, UniValue& out);
|
||||||
void TxToUniv(const CTransaction& tx, const uint256& hashBlock, UniValue& entry, bool include_hex = true, int serialize_flags = 0, const CTxUndo* txundo = nullptr);
|
void TxToUniv(const CTransaction& tx, const uint256& hashBlock, UniValue& entry, bool include_hex = true, int serialize_flags = 0, const CTxUndo* txundo = nullptr);
|
||||||
|
|
||||||
|
|
|
@ -143,16 +143,15 @@ std::string EncodeHexTx(const CTransaction& tx, const int serializeFlags)
|
||||||
|
|
||||||
void ScriptToUniv(const CScript& script, UniValue& out)
|
void ScriptToUniv(const CScript& script, UniValue& out)
|
||||||
{
|
{
|
||||||
ScriptPubKeyToUniv(script, out, /* fIncludeHex */ true, /* include_address */ false);
|
ScriptPubKeyToUniv(script, out, /* include_hex */ true, /* include_address */ false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptPubKeyToUniv(const CScript& scriptPubKey, UniValue& out, bool fIncludeHex, bool include_address)
|
void ScriptPubKeyToUniv(const CScript& scriptPubKey, UniValue& out, bool include_hex, bool include_address)
|
||||||
{
|
{
|
||||||
CTxDestination address;
|
CTxDestination address;
|
||||||
|
|
||||||
out.pushKV("asm", ScriptToAsmStr(scriptPubKey));
|
out.pushKV("asm", ScriptToAsmStr(scriptPubKey));
|
||||||
if (fIncludeHex)
|
if (include_hex) out.pushKV("hex", HexStr(scriptPubKey));
|
||||||
out.pushKV("hex", HexStr(scriptPubKey));
|
|
||||||
|
|
||||||
std::vector<std::vector<unsigned char>> solns;
|
std::vector<std::vector<unsigned char>> solns;
|
||||||
const TxoutType type{Solver(scriptPubKey, solns)};
|
const TxoutType type{Solver(scriptPubKey, solns)};
|
||||||
|
|
|
@ -572,7 +572,7 @@ static RPCHelpMan decodescript()
|
||||||
} else {
|
} else {
|
||||||
// Empty scripts are valid
|
// Empty scripts are valid
|
||||||
}
|
}
|
||||||
ScriptPubKeyToUniv(script, r, /* fIncludeHex */ false);
|
ScriptPubKeyToUniv(script, r, /* include_hex */ false);
|
||||||
|
|
||||||
UniValue type;
|
UniValue type;
|
||||||
type = find_value(r, "type");
|
type = find_value(r, "type");
|
||||||
|
@ -606,7 +606,7 @@ static RPCHelpMan decodescript()
|
||||||
// Newer segwit program versions should be considered when then become available.
|
// Newer segwit program versions should be considered when then become available.
|
||||||
segwitScr = GetScriptForDestination(WitnessV0ScriptHash(script));
|
segwitScr = GetScriptForDestination(WitnessV0ScriptHash(script));
|
||||||
}
|
}
|
||||||
ScriptPubKeyToUniv(segwitScr, sr, /* fIncludeHex */ true);
|
ScriptPubKeyToUniv(segwitScr, sr, /* include_hex */ true);
|
||||||
sr.pushKV("p2sh-segwit", EncodeDestination(ScriptHash(segwitScr)));
|
sr.pushKV("p2sh-segwit", EncodeDestination(ScriptHash(segwitScr)));
|
||||||
r.pushKV("segwit", sr);
|
r.pushKV("segwit", sr);
|
||||||
}
|
}
|
||||||
|
@ -1161,7 +1161,7 @@ static RPCHelpMan decodepsbt()
|
||||||
txout = input.witness_utxo;
|
txout = input.witness_utxo;
|
||||||
|
|
||||||
UniValue o(UniValue::VOBJ);
|
UniValue o(UniValue::VOBJ);
|
||||||
ScriptPubKeyToUniv(txout.scriptPubKey, o, /* fIncludeHex */ true);
|
ScriptPubKeyToUniv(txout.scriptPubKey, o, /* include_hex */ true);
|
||||||
|
|
||||||
UniValue out(UniValue::VOBJ);
|
UniValue out(UniValue::VOBJ);
|
||||||
out.pushKV("amount", ValueFromAmount(txout.nValue));
|
out.pushKV("amount", ValueFromAmount(txout.nValue));
|
||||||
|
|
Loading…
Add table
Reference in a new issue