mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-15 12:51:00 +02:00
rpc: Avoid copies in JSONRPCReplyObj()
Change parameters from const references to values, so they can be moved into the reply instead of copied. Also update callers to move instead of copy.
This commit is contained in:
parent
09416f9ec4
commit
df6e3756d6
5 changed files with 16 additions and 23 deletions
|
|
@ -302,7 +302,7 @@ public:
|
|||
}
|
||||
addresses.pushKV("total", total);
|
||||
result.pushKV("addresses_known", addresses);
|
||||
return JSONRPCReplyObj(result, NullUniValue, 1);
|
||||
return JSONRPCReplyObj(std::move(result), NullUniValue, 1);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -371,7 +371,7 @@ public:
|
|||
}
|
||||
result.pushKV("relayfee", batch[ID_NETWORKINFO]["result"]["relayfee"]);
|
||||
result.pushKV("warnings", batch[ID_NETWORKINFO]["result"]["warnings"]);
|
||||
return JSONRPCReplyObj(result, NullUniValue, 1);
|
||||
return JSONRPCReplyObj(std::move(result), NullUniValue, 1);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -709,7 +709,7 @@ public:
|
|||
UniValue result(UniValue::VOBJ);
|
||||
result.pushKV("address", address_str);
|
||||
result.pushKV("blocks", reply.get_obj()["result"]);
|
||||
return JSONRPCReplyObj(result, NullUniValue, 1);
|
||||
return JSONRPCReplyObj(std::move(result), NullUniValue, 1);
|
||||
}
|
||||
protected:
|
||||
std::string address_str;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue