Currently the RPC will have the same data stored thrice: - UniValue ret (memory filled by ListTransactions) - std::vector<UniValue> vec (constructed by calling push_backV) - UniValue result (the actual result, memory filled by push_backV) Fix this by filling the memory only once: - std::vector<UniValue> ret (memory filled by ListTransactions) - Pass iterators to push_backV instead of creating a full copy - Move memory into UniValue result instead of copying it
Backport of core#25464.