mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 06:28:31 +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:
@@ -131,13 +131,13 @@ std::string EncodeHexTx(const CTransaction& tx, const int serializeFlags)
|
||||
{
|
||||
CDataStream ssTx(SER_NETWORK, PROTOCOL_VERSION | serializeFlags);
|
||||
ssTx << tx;
|
||||
return HexStr(ssTx.begin(), ssTx.end());
|
||||
return HexStr(ssTx);
|
||||
}
|
||||
|
||||
void ScriptToUniv(const CScript& script, UniValue& out, bool include_address)
|
||||
{
|
||||
out.pushKV("asm", ScriptToAsmStr(script));
|
||||
out.pushKV("hex", HexStr(script.begin(), script.end()));
|
||||
out.pushKV("hex", HexStr(script));
|
||||
|
||||
std::vector<std::vector<unsigned char>> solns;
|
||||
txnouttype type = Solver(script, solns);
|
||||
@@ -158,7 +158,7 @@ void ScriptPubKeyToUniv(const CScript& scriptPubKey,
|
||||
|
||||
out.pushKV("asm", ScriptToAsmStr(scriptPubKey));
|
||||
if (fIncludeHex)
|
||||
out.pushKV("hex", HexStr(scriptPubKey.begin(), scriptPubKey.end()));
|
||||
out.pushKV("hex", HexStr(scriptPubKey));
|
||||
|
||||
if (!ExtractDestinations(scriptPubKey, type, addresses, nRequired) || type == TX_PUBKEY) {
|
||||
out.pushKV("type", GetTxnOutputType(type));
|
||||
@@ -190,19 +190,19 @@ void TxToUniv(const CTransaction& tx, const uint256& hashBlock, UniValue& entry,
|
||||
const CTxIn& txin = tx.vin[i];
|
||||
UniValue in(UniValue::VOBJ);
|
||||
if (tx.IsCoinBase())
|
||||
in.pushKV("coinbase", HexStr(txin.scriptSig.begin(), txin.scriptSig.end()));
|
||||
in.pushKV("coinbase", HexStr(txin.scriptSig));
|
||||
else {
|
||||
in.pushKV("txid", txin.prevout.hash.GetHex());
|
||||
in.pushKV("vout", (int64_t)txin.prevout.n);
|
||||
UniValue o(UniValue::VOBJ);
|
||||
o.pushKV("asm", ScriptToAsmStr(txin.scriptSig, true));
|
||||
o.pushKV("hex", HexStr(txin.scriptSig.begin(), txin.scriptSig.end()));
|
||||
o.pushKV("hex", HexStr(txin.scriptSig));
|
||||
in.pushKV("scriptSig", o);
|
||||
}
|
||||
if (!tx.vin[i].scriptWitness.IsNull()) {
|
||||
UniValue txinwitness(UniValue::VARR);
|
||||
for (const auto& item : tx.vin[i].scriptWitness.stack) {
|
||||
txinwitness.push_back(HexStr(item.begin(), item.end()));
|
||||
txinwitness.push_back(HexStr(item));
|
||||
}
|
||||
in.pushKV("txinwitness", txinwitness);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user