Related to, but not intended as a fix for #25229.
Currently the RPC will have the same data stored thrice:
UniValue ret(memory filled byListTransactions)std::vector<UniValue> vec(constructed by callingpush_backV)UniValue result(the actual result, memory filled bypush_backV)
Fix this by filling the memory only once:
std::vector<UniValue> ret(memory filled byListTransactions)- Pass iterators to
push_backVinstead of creating a full copy - Move memory into
UniValue resultinstead of copying it

