mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-20 23:29:12 +01:00
refactor: Replace HexStr(o.begin(), o.end()) with HexStr(o)
HexStr can be called with anything that bas `begin()` and `end()` functions, so clean up the redundant calls.
This commit is contained in:
@@ -964,7 +964,7 @@ static UniValue addmultisigaddress(const JSONRPCRequest& request)
|
||||
|
||||
UniValue result(UniValue::VOBJ);
|
||||
result.pushKV("address", EncodeDestination(dest));
|
||||
result.pushKV("redeemScript", HexStr(inner.begin(), inner.end()));
|
||||
result.pushKV("redeemScript", HexStr(inner));
|
||||
result.pushKV("descriptor", descriptor->ToString());
|
||||
return result;
|
||||
}
|
||||
@@ -2870,7 +2870,7 @@ static UniValue listunspent(const JSONRPCRequest& request)
|
||||
const CScriptID& hash = CScriptID(boost::get<ScriptHash>(address));
|
||||
CScript redeemScript;
|
||||
if (provider->GetCScript(hash, redeemScript)) {
|
||||
entry.pushKV("redeemScript", HexStr(redeemScript.begin(), redeemScript.end()));
|
||||
entry.pushKV("redeemScript", HexStr(redeemScript));
|
||||
// Now check if the redeemScript is actually a P2WSH script
|
||||
CTxDestination witness_destination;
|
||||
if (redeemScript.IsPayToWitnessScriptHash()) {
|
||||
@@ -2882,7 +2882,7 @@ static UniValue listunspent(const JSONRPCRequest& request)
|
||||
CRIPEMD160().Write(whash.begin(), whash.size()).Finalize(id.begin());
|
||||
CScript witnessScript;
|
||||
if (provider->GetCScript(id, witnessScript)) {
|
||||
entry.pushKV("witnessScript", HexStr(witnessScript.begin(), witnessScript.end()));
|
||||
entry.pushKV("witnessScript", HexStr(witnessScript));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2892,13 +2892,13 @@ static UniValue listunspent(const JSONRPCRequest& request)
|
||||
CRIPEMD160().Write(whash.begin(), whash.size()).Finalize(id.begin());
|
||||
CScript witnessScript;
|
||||
if (provider->GetCScript(id, witnessScript)) {
|
||||
entry.pushKV("witnessScript", HexStr(witnessScript.begin(), witnessScript.end()));
|
||||
entry.pushKV("witnessScript", HexStr(witnessScript));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
entry.pushKV("scriptPubKey", HexStr(scriptPubKey.begin(), scriptPubKey.end()));
|
||||
entry.pushKV("scriptPubKey", HexStr(scriptPubKey));
|
||||
entry.pushKV("amount", ValueFromAmount(out.tx->tx->vout[out.i].nValue));
|
||||
entry.pushKV("confirmations", out.nDepth);
|
||||
entry.pushKV("spendable", out.fSpendable);
|
||||
@@ -3491,7 +3491,7 @@ public:
|
||||
std::vector<std::vector<unsigned char>> solutions_data;
|
||||
txnouttype which_type = Solver(subscript, solutions_data);
|
||||
obj.pushKV("script", GetTxnOutputType(which_type));
|
||||
obj.pushKV("hex", HexStr(subscript.begin(), subscript.end()));
|
||||
obj.pushKV("hex", HexStr(subscript));
|
||||
|
||||
CTxDestination embedded;
|
||||
if (ExtractDestination(subscript, embedded)) {
|
||||
@@ -3502,7 +3502,7 @@ public:
|
||||
UniValue wallet_detail = boost::apply_visitor(*this, embedded);
|
||||
subobj.pushKVs(wallet_detail);
|
||||
subobj.pushKV("address", EncodeDestination(embedded));
|
||||
subobj.pushKV("scriptPubKey", HexStr(subscript.begin(), subscript.end()));
|
||||
subobj.pushKV("scriptPubKey", HexStr(subscript));
|
||||
// Always report the pubkey at the top level, so that `getnewaddress()['pubkey']` always works.
|
||||
if (subobj.exists("pubkey")) obj.pushKV("pubkey", subobj["pubkey"]);
|
||||
obj.pushKV("embedded", std::move(subobj));
|
||||
@@ -3513,7 +3513,7 @@ public:
|
||||
UniValue pubkeys(UniValue::VARR);
|
||||
for (size_t i = 1; i < solutions_data.size() - 1; ++i) {
|
||||
CPubKey key(solutions_data[i].begin(), solutions_data[i].end());
|
||||
pubkeys.push_back(HexStr(key.begin(), key.end()));
|
||||
pubkeys.push_back(HexStr(key));
|
||||
}
|
||||
obj.pushKV("pubkeys", std::move(pubkeys));
|
||||
}
|
||||
@@ -3669,7 +3669,7 @@ UniValue getaddressinfo(const JSONRPCRequest& request)
|
||||
ret.pushKV("address", currentAddress);
|
||||
|
||||
CScript scriptPubKey = GetScriptForDestination(dest);
|
||||
ret.pushKV("scriptPubKey", HexStr(scriptPubKey.begin(), scriptPubKey.end()));
|
||||
ret.pushKV("scriptPubKey", HexStr(scriptPubKey));
|
||||
|
||||
std::unique_ptr<SigningProvider> provider = pwallet->GetSolvingProvider(scriptPubKey);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user