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.cpp106
1 files changed, 53 insertions, 53 deletions
diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp
index ce71c052ab..2ecaeeaf40 100644
--- a/src/rpc/rawtransaction.cpp
+++ b/src/rpc/rawtransaction.cpp
@@ -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));
}
}
@@ -1073,7 +1073,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);
@@ -1087,10 +1087,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()));
@@ -1103,16 +1103,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;
@@ -1132,9 +1132,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;
}
@@ -1143,7 +1143,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;
}
@@ -1164,7 +1164,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
@@ -1176,12 +1176,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
@@ -1193,9 +1193,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
@@ -1203,14 +1203,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
@@ -1219,7 +1219,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
@@ -1228,7 +1228,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
@@ -1237,7 +1237,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
@@ -1246,7 +1246,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
@@ -1263,9 +1263,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
@@ -1280,10 +1280,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
@@ -1299,10 +1299,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
@@ -1324,9 +1324,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
@@ -1335,12 +1335,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;
@@ -1352,12 +1352,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
@@ -1368,9 +1368,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
@@ -1386,9 +1386,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
@@ -1404,10 +1404,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
@@ -1419,9 +1419,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
@@ -1430,10 +1430,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)) {
@@ -1443,7 +1443,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));
}
@@ -1880,7 +1880,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));
@@ -1893,14 +1893,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);