aboutsummaryrefslogtreecommitdiff
path: root/src/rpc/rawtransaction.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/rpc/rawtransaction.cpp')
-rw-r--r--src/rpc/rawtransaction.cpp110
1 files changed, 55 insertions, 55 deletions
diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp
index b1e6d677f8..7fa6652f9e 100644
--- a/src/rpc/rawtransaction.cpp
+++ b/src/rpc/rawtransaction.cpp
@@ -62,7 +62,7 @@ static void TxToJSON(const CTransaction& tx, const uint256 hashBlock, UniValue&
// Blockchain contextual information (confirmations and blocktime) is not
// available to code in bitcoin-common, so we query them here and push the
// data into the returned UniValue.
- TxToUniv(tx, /*block_hash=*/uint256(), entry, /*include_hex=*/true, RPCSerializationWithoutWitness(), txundo, verbosity);
+ TxToUniv(tx, /*block_hash=*/uint256(), entry, /*include_hex=*/true, txundo, verbosity);
if (!hashBlock.IsNull()) {
LOCK(cs_main);
@@ -383,7 +383,7 @@ static RPCHelpMan getrawtransaction()
}
if (verbosity <= 0) {
- return EncodeHexTx(*tx, /*without_witness=*/RPCSerializationWithoutWitness());
+ return EncodeHexTx(*tx);
}
UniValue result(UniValue::VOBJ);
@@ -618,7 +618,7 @@ static RPCHelpMan decodescript()
}
ScriptToUniv(segwitScr, /*out=*/sr, /*include_hex=*/true, /*include_address=*/true, /*provider=*/&provider);
sr.pushKV("p2sh-segwit", EncodeDestination(ScriptHash(segwitScr)));
- r.pushKV("segwit", sr);
+ r.pushKV("segwit", std::move(sr));
}
}
@@ -1069,7 +1069,7 @@ static RPCHelpMan decodepsbt()
// Add the decoded tx
UniValue tx_univ(UniValue::VOBJ);
TxToUniv(CTransaction(*psbtx.tx), /*block_hash=*/uint256(), /*entry=*/tx_univ, /*include_hex=*/false);
- result.pushKV("tx", tx_univ);
+ result.pushKV("tx", std::move(tx_univ));
// Add the global xpubs
UniValue global_xpubs(UniValue::VARR);
@@ -1083,10 +1083,10 @@ static RPCHelpMan decodepsbt()
keypath.pushKV("xpub", EncodeBase58Check(ser_xpub));
keypath.pushKV("master_fingerprint", HexStr(Span<unsigned char>(xpub_pair.first.fingerprint, xpub_pair.first.fingerprint + 4)));
keypath.pushKV("path", WriteHDKeypath(xpub_pair.first.path));
- global_xpubs.push_back(keypath);
+ global_xpubs.push_back(std::move(keypath));
}
}
- result.pushKV("global_xpubs", global_xpubs);
+ result.pushKV("global_xpubs", std::move(global_xpubs));
// PSBT version
result.pushKV("psbt_version", static_cast<uint64_t>(psbtx.GetVersion()));
@@ -1099,16 +1099,16 @@ static RPCHelpMan decodepsbt()
this_prop.pushKV("subtype", entry.subtype);
this_prop.pushKV("key", HexStr(entry.key));
this_prop.pushKV("value", HexStr(entry.value));
- proprietary.push_back(this_prop);
+ proprietary.push_back(std::move(this_prop));
}
- result.pushKV("proprietary", proprietary);
+ result.pushKV("proprietary", std::move(proprietary));
// Unknown data
UniValue unknowns(UniValue::VOBJ);
for (auto entry : psbtx.unknown) {
unknowns.pushKV(HexStr(entry.first), HexStr(entry.second));
}
- result.pushKV("unknown", unknowns);
+ result.pushKV("unknown", std::move(unknowns));
// inputs
CAmount total_in = 0;
@@ -1128,9 +1128,9 @@ static RPCHelpMan decodepsbt()
UniValue out(UniValue::VOBJ);
out.pushKV("amount", ValueFromAmount(txout.nValue));
- out.pushKV("scriptPubKey", o);
+ out.pushKV("scriptPubKey", std::move(o));
- in.pushKV("witness_utxo", out);
+ in.pushKV("witness_utxo", std::move(out));
have_a_utxo = true;
}
@@ -1139,7 +1139,7 @@ static RPCHelpMan decodepsbt()
UniValue non_wit(UniValue::VOBJ);
TxToUniv(*input.non_witness_utxo, /*block_hash=*/uint256(), /*entry=*/non_wit, /*include_hex=*/false);
- in.pushKV("non_witness_utxo", non_wit);
+ in.pushKV("non_witness_utxo", std::move(non_wit));
have_a_utxo = true;
}
@@ -1160,7 +1160,7 @@ static RPCHelpMan decodepsbt()
for (const auto& sig : input.partial_sigs) {
partial_sigs.pushKV(HexStr(sig.second.first), HexStr(sig.second.second));
}
- in.pushKV("partial_signatures", partial_sigs);
+ in.pushKV("partial_signatures", std::move(partial_sigs));
}
// Sighash
@@ -1172,12 +1172,12 @@ static RPCHelpMan decodepsbt()
if (!input.redeem_script.empty()) {
UniValue r(UniValue::VOBJ);
ScriptToUniv(input.redeem_script, /*out=*/r);
- in.pushKV("redeem_script", r);
+ in.pushKV("redeem_script", std::move(r));
}
if (!input.witness_script.empty()) {
UniValue r(UniValue::VOBJ);
ScriptToUniv(input.witness_script, /*out=*/r);
- in.pushKV("witness_script", r);
+ in.pushKV("witness_script", std::move(r));
}
// keypaths
@@ -1189,9 +1189,9 @@ static RPCHelpMan decodepsbt()
keypath.pushKV("master_fingerprint", strprintf("%08x", ReadBE32(entry.second.fingerprint)));
keypath.pushKV("path", WriteHDKeypath(entry.second.path));
- keypaths.push_back(keypath);
+ keypaths.push_back(std::move(keypath));
}
- in.pushKV("bip32_derivs", keypaths);
+ in.pushKV("bip32_derivs", std::move(keypaths));
}
// Final scriptSig and scriptwitness
@@ -1199,14 +1199,14 @@ static RPCHelpMan decodepsbt()
UniValue scriptsig(UniValue::VOBJ);
scriptsig.pushKV("asm", ScriptToAsmStr(input.final_script_sig, true));
scriptsig.pushKV("hex", HexStr(input.final_script_sig));
- in.pushKV("final_scriptSig", scriptsig);
+ in.pushKV("final_scriptSig", std::move(scriptsig));
}
if (!input.final_script_witness.IsNull()) {
UniValue txinwitness(UniValue::VARR);
for (const auto& item : input.final_script_witness.stack) {
txinwitness.push_back(HexStr(item));
}
- in.pushKV("final_scriptwitness", txinwitness);
+ in.pushKV("final_scriptwitness", std::move(txinwitness));
}
// Ripemd160 hash preimages
@@ -1215,7 +1215,7 @@ static RPCHelpMan decodepsbt()
for (const auto& [hash, preimage] : input.ripemd160_preimages) {
ripemd160_preimages.pushKV(HexStr(hash), HexStr(preimage));
}
- in.pushKV("ripemd160_preimages", ripemd160_preimages);
+ in.pushKV("ripemd160_preimages", std::move(ripemd160_preimages));
}
// Sha256 hash preimages
@@ -1224,7 +1224,7 @@ static RPCHelpMan decodepsbt()
for (const auto& [hash, preimage] : input.sha256_preimages) {
sha256_preimages.pushKV(HexStr(hash), HexStr(preimage));
}
- in.pushKV("sha256_preimages", sha256_preimages);
+ in.pushKV("sha256_preimages", std::move(sha256_preimages));
}
// Hash160 hash preimages
@@ -1233,7 +1233,7 @@ static RPCHelpMan decodepsbt()
for (const auto& [hash, preimage] : input.hash160_preimages) {
hash160_preimages.pushKV(HexStr(hash), HexStr(preimage));
}
- in.pushKV("hash160_preimages", hash160_preimages);
+ in.pushKV("hash160_preimages", std::move(hash160_preimages));
}
// Hash256 hash preimages
@@ -1242,7 +1242,7 @@ static RPCHelpMan decodepsbt()
for (const auto& [hash, preimage] : input.hash256_preimages) {
hash256_preimages.pushKV(HexStr(hash), HexStr(preimage));
}
- in.pushKV("hash256_preimages", hash256_preimages);
+ in.pushKV("hash256_preimages", std::move(hash256_preimages));
}
// Taproot key path signature
@@ -1259,9 +1259,9 @@ static RPCHelpMan decodepsbt()
sigobj.pushKV("pubkey", HexStr(xonly));
sigobj.pushKV("leaf_hash", HexStr(leaf_hash));
sigobj.pushKV("sig", HexStr(sig));
- script_sigs.push_back(sigobj);
+ script_sigs.push_back(std::move(sigobj));
}
- in.pushKV("taproot_script_path_sigs", script_sigs);
+ in.pushKV("taproot_script_path_sigs", std::move(script_sigs));
}
// Taproot leaf scripts
@@ -1276,10 +1276,10 @@ static RPCHelpMan decodepsbt()
for (const auto& control_block : control_blocks) {
control_blocks_univ.push_back(HexStr(control_block));
}
- script_info.pushKV("control_blocks", control_blocks_univ);
- tap_scripts.push_back(script_info);
+ script_info.pushKV("control_blocks", std::move(control_blocks_univ));
+ tap_scripts.push_back(std::move(script_info));
}
- in.pushKV("taproot_scripts", tap_scripts);
+ in.pushKV("taproot_scripts", std::move(tap_scripts));
}
// Taproot bip32 keypaths
@@ -1295,10 +1295,10 @@ static RPCHelpMan decodepsbt()
for (const auto& leaf_hash : leaf_hashes) {
leaf_hashes_arr.push_back(HexStr(leaf_hash));
}
- path_obj.pushKV("leaf_hashes", leaf_hashes_arr);
- keypaths.push_back(path_obj);
+ path_obj.pushKV("leaf_hashes", std::move(leaf_hashes_arr));
+ keypaths.push_back(std::move(path_obj));
}
- in.pushKV("taproot_bip32_derivs", keypaths);
+ in.pushKV("taproot_bip32_derivs", std::move(keypaths));
}
// Taproot internal key
@@ -1320,9 +1320,9 @@ static RPCHelpMan decodepsbt()
this_prop.pushKV("subtype", entry.subtype);
this_prop.pushKV("key", HexStr(entry.key));
this_prop.pushKV("value", HexStr(entry.value));
- proprietary.push_back(this_prop);
+ proprietary.push_back(std::move(this_prop));
}
- in.pushKV("proprietary", proprietary);
+ in.pushKV("proprietary", std::move(proprietary));
}
// Unknown data
@@ -1331,12 +1331,12 @@ static RPCHelpMan decodepsbt()
for (auto entry : input.unknown) {
unknowns.pushKV(HexStr(entry.first), HexStr(entry.second));
}
- in.pushKV("unknown", unknowns);
+ in.pushKV("unknown", std::move(unknowns));
}
- inputs.push_back(in);
+ inputs.push_back(std::move(in));
}
- result.pushKV("inputs", inputs);
+ result.pushKV("inputs", std::move(inputs));
// outputs
CAmount output_value = 0;
@@ -1348,12 +1348,12 @@ static RPCHelpMan decodepsbt()
if (!output.redeem_script.empty()) {
UniValue r(UniValue::VOBJ);
ScriptToUniv(output.redeem_script, /*out=*/r);
- out.pushKV("redeem_script", r);
+ out.pushKV("redeem_script", std::move(r));
}
if (!output.witness_script.empty()) {
UniValue r(UniValue::VOBJ);
ScriptToUniv(output.witness_script, /*out=*/r);
- out.pushKV("witness_script", r);
+ out.pushKV("witness_script", std::move(r));
}
// keypaths
@@ -1364,9 +1364,9 @@ static RPCHelpMan decodepsbt()
keypath.pushKV("pubkey", HexStr(entry.first));
keypath.pushKV("master_fingerprint", strprintf("%08x", ReadBE32(entry.second.fingerprint)));
keypath.pushKV("path", WriteHDKeypath(entry.second.path));
- keypaths.push_back(keypath);
+ keypaths.push_back(std::move(keypath));
}
- out.pushKV("bip32_derivs", keypaths);
+ out.pushKV("bip32_derivs", std::move(keypaths));
}
// Taproot internal key
@@ -1382,9 +1382,9 @@ static RPCHelpMan decodepsbt()
elem.pushKV("depth", (int)depth);
elem.pushKV("leaf_ver", (int)leaf_ver);
elem.pushKV("script", HexStr(script));
- tree.push_back(elem);
+ tree.push_back(std::move(elem));
}
- out.pushKV("taproot_tree", tree);
+ out.pushKV("taproot_tree", std::move(tree));
}
// Taproot bip32 keypaths
@@ -1400,10 +1400,10 @@ static RPCHelpMan decodepsbt()
for (const auto& leaf_hash : leaf_hashes) {
leaf_hashes_arr.push_back(HexStr(leaf_hash));
}
- path_obj.pushKV("leaf_hashes", leaf_hashes_arr);
- keypaths.push_back(path_obj);
+ path_obj.pushKV("leaf_hashes", std::move(leaf_hashes_arr));
+ keypaths.push_back(std::move(path_obj));
}
- out.pushKV("taproot_bip32_derivs", keypaths);
+ out.pushKV("taproot_bip32_derivs", std::move(keypaths));
}
// Proprietary
@@ -1415,9 +1415,9 @@ static RPCHelpMan decodepsbt()
this_prop.pushKV("subtype", entry.subtype);
this_prop.pushKV("key", HexStr(entry.key));
this_prop.pushKV("value", HexStr(entry.value));
- proprietary.push_back(this_prop);
+ proprietary.push_back(std::move(this_prop));
}
- out.pushKV("proprietary", proprietary);
+ out.pushKV("proprietary", std::move(proprietary));
}
// Unknown data
@@ -1426,10 +1426,10 @@ static RPCHelpMan decodepsbt()
for (auto entry : output.unknown) {
unknowns.pushKV(HexStr(entry.first), HexStr(entry.second));
}
- out.pushKV("unknown", unknowns);
+ out.pushKV("unknown", std::move(unknowns));
}
- outputs.push_back(out);
+ outputs.push_back(std::move(out));
// Fee calculation
if (MoneyRange(psbtx.tx->vout[i].nValue) && MoneyRange(output_value + psbtx.tx->vout[i].nValue)) {
@@ -1439,7 +1439,7 @@ static RPCHelpMan decodepsbt()
have_all_utxos = false;
}
}
- result.pushKV("outputs", outputs);
+ result.pushKV("outputs", std::move(outputs));
if (have_all_utxos) {
result.pushKV("fee", ValueFromAmount(total_in - output_value));
}
@@ -1876,7 +1876,7 @@ static RPCHelpMan analyzepsbt()
for (const CKeyID& pubkey : input.missing_pubkeys) {
missing_pubkeys_univ.push_back(HexStr(pubkey));
}
- missing.pushKV("pubkeys", missing_pubkeys_univ);
+ missing.pushKV("pubkeys", std::move(missing_pubkeys_univ));
}
if (!input.missing_redeem_script.IsNull()) {
missing.pushKV("redeemscript", HexStr(input.missing_redeem_script));
@@ -1889,14 +1889,14 @@ static RPCHelpMan analyzepsbt()
for (const CKeyID& pubkey : input.missing_sigs) {
missing_sigs_univ.push_back(HexStr(pubkey));
}
- missing.pushKV("signatures", missing_sigs_univ);
+ missing.pushKV("signatures", std::move(missing_sigs_univ));
}
if (!missing.getKeys().empty()) {
- input_univ.pushKV("missing", missing);
+ input_univ.pushKV("missing", std::move(missing));
}
- inputs_result.push_back(input_univ);
+ inputs_result.push_back(std::move(input_univ));
}
- if (!inputs_result.empty()) result.pushKV("inputs", inputs_result);
+ if (!inputs_result.empty()) result.pushKV("inputs", std::move(inputs_result));
if (psbta.estimated_vsize != std::nullopt) {
result.pushKV("estimated_vsize", (int)*psbta.estimated_vsize);