mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-04 12:55:02 +02: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:
@@ -779,7 +779,7 @@ static UniValue getblockheader(const JSONRPCRequest& request)
|
||||
{
|
||||
CDataStream ssBlock(SER_NETWORK, PROTOCOL_VERSION);
|
||||
ssBlock << pblockindex->GetBlockHeader();
|
||||
std::string strHex = HexStr(ssBlock.begin(), ssBlock.end());
|
||||
std::string strHex = HexStr(ssBlock);
|
||||
return strHex;
|
||||
}
|
||||
|
||||
@@ -905,7 +905,7 @@ static UniValue getblock(const JSONRPCRequest& request)
|
||||
{
|
||||
CDataStream ssBlock(SER_NETWORK, PROTOCOL_VERSION | RPCSerializationFlags());
|
||||
ssBlock << block;
|
||||
std::string strHex = HexStr(ssBlock.begin(), ssBlock.end());
|
||||
std::string strHex = HexStr(ssBlock);
|
||||
return strHex;
|
||||
}
|
||||
|
||||
@@ -2159,7 +2159,7 @@ UniValue scantxoutset(const JSONRPCRequest& request)
|
||||
UniValue unspent(UniValue::VOBJ);
|
||||
unspent.pushKV("txid", outpoint.hash.GetHex());
|
||||
unspent.pushKV("vout", (int32_t)outpoint.n);
|
||||
unspent.pushKV("scriptPubKey", HexStr(txo.scriptPubKey.begin(), txo.scriptPubKey.end()));
|
||||
unspent.pushKV("scriptPubKey", HexStr(txo.scriptPubKey));
|
||||
unspent.pushKV("desc", descriptors[txo.scriptPubKey]);
|
||||
unspent.pushKV("amount", ValueFromAmount(txo.nValue));
|
||||
unspent.pushKV("height", (int32_t)coin.nHeight);
|
||||
|
||||
@@ -873,7 +873,7 @@ static UniValue getblocktemplate(const JSONRPCRequest& request)
|
||||
result.pushKV("height", (int64_t)(pindexPrev->nHeight+1));
|
||||
|
||||
if (!pblocktemplate->vchCoinbaseCommitment.empty()) {
|
||||
result.pushKV("default_witness_commitment", HexStr(pblocktemplate->vchCoinbaseCommitment.begin(), pblocktemplate->vchCoinbaseCommitment.end()));
|
||||
result.pushKV("default_witness_commitment", HexStr(pblocktemplate->vchCoinbaseCommitment));
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
@@ -63,7 +63,7 @@ static UniValue validateaddress(const JSONRPCRequest& request)
|
||||
ret.pushKV("address", currentAddress);
|
||||
|
||||
CScript scriptPubKey = GetScriptForDestination(dest);
|
||||
ret.pushKV("scriptPubKey", HexStr(scriptPubKey.begin(), scriptPubKey.end()));
|
||||
ret.pushKV("scriptPubKey", HexStr(scriptPubKey));
|
||||
|
||||
UniValue detail = DescribeAddress(dest);
|
||||
ret.pushKVs(detail);
|
||||
@@ -131,7 +131,7 @@ static UniValue createmultisig(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;
|
||||
|
||||
@@ -305,7 +305,7 @@ static UniValue gettxoutproof(const JSONRPCRequest& request)
|
||||
CDataStream ssMB(SER_NETWORK, PROTOCOL_VERSION | SERIALIZE_TRANSACTION_NO_WITNESS);
|
||||
CMerkleBlock mb(block, setTxids);
|
||||
ssMB << mb;
|
||||
std::string strHex = HexStr(ssMB.begin(), ssMB.end());
|
||||
std::string strHex = HexStr(ssMB);
|
||||
return strHex;
|
||||
}
|
||||
|
||||
@@ -1186,7 +1186,7 @@ UniValue decodepsbt(const JSONRPCRequest& request)
|
||||
if (!input.final_script_witness.IsNull()) {
|
||||
UniValue txinwitness(UniValue::VARR);
|
||||
for (const auto& item : input.final_script_witness.stack) {
|
||||
txinwitness.push_back(HexStr(item.begin(), item.end()));
|
||||
txinwitness.push_back(HexStr(item));
|
||||
}
|
||||
in.pushKV("final_scriptwitness", txinwitness);
|
||||
}
|
||||
|
||||
@@ -138,10 +138,10 @@ static void TxInErrorToJSON(const CTxIn& txin, UniValue& vErrorsRet, const std::
|
||||
entry.pushKV("vout", (uint64_t)txin.prevout.n);
|
||||
UniValue witness(UniValue::VARR);
|
||||
for (unsigned int i = 0; i < txin.scriptWitness.stack.size(); i++) {
|
||||
witness.push_back(HexStr(txin.scriptWitness.stack[i].begin(), txin.scriptWitness.stack[i].end()));
|
||||
witness.push_back(HexStr(txin.scriptWitness.stack[i]));
|
||||
}
|
||||
entry.pushKV("witness", witness);
|
||||
entry.pushKV("scriptSig", HexStr(txin.scriptSig.begin(), txin.scriptSig.end()));
|
||||
entry.pushKV("scriptSig", HexStr(txin.scriptSig));
|
||||
entry.pushKV("sequence", (uint64_t)txin.nSequence);
|
||||
entry.pushKV("error", strMessage);
|
||||
vErrorsRet.push_back(entry);
|
||||
|
||||
@@ -224,7 +224,7 @@ public:
|
||||
obj.pushKV("isscript", false);
|
||||
obj.pushKV("iswitness", true);
|
||||
obj.pushKV("witness_version", 0);
|
||||
obj.pushKV("witness_program", HexStr(id.begin(), id.end()));
|
||||
obj.pushKV("witness_program", HexStr(id));
|
||||
return obj;
|
||||
}
|
||||
|
||||
@@ -234,7 +234,7 @@ public:
|
||||
obj.pushKV("isscript", true);
|
||||
obj.pushKV("iswitness", true);
|
||||
obj.pushKV("witness_version", 0);
|
||||
obj.pushKV("witness_program", HexStr(id.begin(), id.end()));
|
||||
obj.pushKV("witness_program", HexStr(id));
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user