mirror of
https://github.com/bitcoin/bitcoin.git
synced 2024-11-20 10:38:42 +01:00
Merge bitcoin/bitcoin#30094: rpc: move UniValue in blockToJSON
b77bad309e
rpc: move UniValue in blockToJSON (willcl-ark) Pull request description: Fixes: #24542 Fixes: #30052 Without explicitly declaring the move, these `UniValues` get copied, causing increased memory usage. Fix this by explicitly moving the `UniValue` objects. Used by `rest_block` and `getblock` RPC. ACKs for top commit: maflcko: review ACKb77bad309e
ismaelsadeeq: ACKb77bad309e
TheCharlatan: ACKb77bad309e
theuni: utACKb77bad309e
hebasto: ACKb77bad309e
, I have reviewed the code and it looks OK. BrandonOdiwuor: ACKb77bad309e
Tree-SHA512: 767608331040f9cfe5c3568ed0e3c338920633472a1a50d4bbb47d1dc69d2bb11466d611f050ac8ad1a894b47fe1ea4d968cf34cbd44d4bb8d479fc5c7475f6d
This commit is contained in:
commit
0503cbea9a
@ -188,12 +188,12 @@ UniValue blockToJSON(BlockManager& blockman, const CBlock& block, const CBlockIn
|
||||
const CTxUndo* txundo = (have_undo && i > 0) ? &blockUndo.vtxundo.at(i - 1) : nullptr;
|
||||
UniValue objTx(UniValue::VOBJ);
|
||||
TxToUniv(*tx, /*block_hash=*/uint256(), /*entry=*/objTx, /*include_hex=*/true, txundo, verbosity);
|
||||
txs.push_back(objTx);
|
||||
txs.push_back(std::move(objTx));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
result.pushKV("tx", txs);
|
||||
result.pushKV("tx", std::move(txs));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user