[depends] Univalue: push_back(Pair()) -> pushKV() in AsyncRPCOperation*

This commit is contained in:
Jon Layton 2018-10-02 09:23:52 -05:00 committed by Jon Layton
parent 2a63c34936
commit 59971d2b4b
4 changed files with 43 additions and 43 deletions

View File

@ -124,8 +124,8 @@ UniValue AsyncRPCOperation::getError() const {
std::lock_guard<std::mutex> guard(lock_);
UniValue error(UniValue::VOBJ);
error.push_back(Pair("code", this->error_code_));
error.push_back(Pair("message", this->error_message_));
error.pushKV("code", this->error_code_);
error.pushKV("message", this->error_message_);
return error;
}
@ -152,21 +152,21 @@ UniValue AsyncRPCOperation::getResult() const {
UniValue AsyncRPCOperation::getStatus() const {
OperationStatus status = this->getState();
UniValue obj(UniValue::VOBJ);
obj.push_back(Pair("id", this->id_));
obj.push_back(Pair("status", OperationStatusMap[status]));
obj.push_back(Pair("creation_time", this->creation_time_));
obj.pushKV("id", this->id_);
obj.pushKV("status", OperationStatusMap[status]);
obj.pushKV("creation_time", this->creation_time_);
// TODO: Issue #1354: There may be other useful metadata to return to the user.
UniValue err = this->getError();
if (!err.isNull()) {
obj.push_back(Pair("error", err.get_obj()));
obj.pushKV("error", err.get_obj());
}
UniValue result = this->getResult();
if (!result.isNull()) {
obj.push_back(Pair("result", result));
obj.pushKV("result", result);
// Include execution time for successful operation
std::chrono::duration<double> elapsed_seconds = end_time_ - start_time_;
obj.push_back(Pair("execution_secs", elapsed_seconds.count()));
obj.pushKV("execution_secs", elapsed_seconds.count());
}
return obj;

View File

@ -263,7 +263,7 @@ bool AsyncRPCOperation_mergetoaddress::main_impl()
*/
if (isPureTaddrOnlyTx) {
UniValue obj(UniValue::VOBJ);
obj.push_back(Pair("rawtxn", EncodeHexTx(tx_)));
obj.pushKV("rawtxn", EncodeHexTx(tx_));
sign_send_raw_transaction(obj);
return true;
}
@ -652,7 +652,7 @@ void AsyncRPCOperation_mergetoaddress::sign_send_raw_transaction(UniValue obj)
std::string txid = sendResultValue.get_str();
UniValue o(UniValue::VOBJ);
o.push_back(Pair("txid", txid));
o.pushKV("txid", txid);
set_result(o);
} else {
// Test mode does not send the transaction to the network.
@ -662,9 +662,9 @@ void AsyncRPCOperation_mergetoaddress::sign_send_raw_transaction(UniValue obj)
stream >> tx;
UniValue o(UniValue::VOBJ);
o.push_back(Pair("test", 1));
o.push_back(Pair("txid", tx.GetHash().ToString()));
o.push_back(Pair("hex", signedtxn));
o.pushKV("test", 1);
o.pushKV("txid", tx.GetHash().ToString());
o.pushKV("hex", signedtxn);
set_result(o);
}
@ -852,11 +852,11 @@ UniValue AsyncRPCOperation_mergetoaddress::perform_joinsplit(
// !!! Payment disclosure END
UniValue obj(UniValue::VOBJ);
obj.push_back(Pair("encryptednote1", encryptedNote1));
obj.push_back(Pair("encryptednote2", encryptedNote2));
obj.push_back(Pair("rawtxn", HexStr(ss.begin(), ss.end())));
obj.push_back(Pair("inputmap", arrInputMap));
obj.push_back(Pair("outputmap", arrOutputMap));
obj.pushKV("encryptednote1", encryptedNote1);
obj.pushKV("encryptednote2", encryptedNote2);
obj.pushKV("rawtxn", HexStr(ss.begin(), ss.end()));
obj.pushKV("inputmap", arrInputMap);
obj.pushKV("outputmap", arrOutputMap);
return obj;
}
@ -895,8 +895,8 @@ UniValue AsyncRPCOperation_mergetoaddress::getStatus() const
}
UniValue obj = v.get_obj();
obj.push_back(Pair("method", "z_mergetoaddress"));
obj.push_back(Pair("params", contextinfo_));
obj.pushKV("method", "z_mergetoaddress");
obj.pushKV("params", contextinfo_);
return obj;
}

View File

@ -356,7 +356,7 @@ bool AsyncRPCOperation_sendmany::main_impl() {
}
UniValue obj(UniValue::VOBJ);
obj.push_back(Pair("rawtxn", EncodeHexTx(tx_)));
obj.pushKV("rawtxn", EncodeHexTx(tx_));
sign_send_raw_transaction(obj);
return true;
}
@ -787,7 +787,7 @@ void AsyncRPCOperation_sendmany::sign_send_raw_transaction(UniValue obj)
std::string txid = sendResultValue.get_str();
UniValue o(UniValue::VOBJ);
o.push_back(Pair("txid", txid));
o.pushKV("txid", txid);
set_result(o);
} else {
// Test mode does not send the transaction to the network.
@ -797,9 +797,9 @@ void AsyncRPCOperation_sendmany::sign_send_raw_transaction(UniValue obj)
stream >> tx;
UniValue o(UniValue::VOBJ);
o.push_back(Pair("test", 1));
o.push_back(Pair("txid", tx.GetHash().ToString()));
o.push_back(Pair("hex", signedtxn));
o.pushKV("test", 1);
o.pushKV("txid", tx.GetHash().ToString());
o.pushKV("hex", signedtxn);
set_result(o);
}
@ -1068,11 +1068,11 @@ UniValue AsyncRPCOperation_sendmany::perform_joinsplit(
// !!! Payment disclosure END
UniValue obj(UniValue::VOBJ);
obj.push_back(Pair("encryptednote1", encryptedNote1));
obj.push_back(Pair("encryptednote2", encryptedNote2));
obj.push_back(Pair("rawtxn", HexStr(ss.begin(), ss.end())));
obj.push_back(Pair("inputmap", arrInputMap));
obj.push_back(Pair("outputmap", arrOutputMap));
obj.pushKV("encryptednote1", encryptedNote1);
obj.pushKV("encryptednote2", encryptedNote2);
obj.pushKV("rawtxn", HexStr(ss.begin(), ss.end()));
obj.pushKV("inputmap", arrInputMap);
obj.pushKV("outputmap", arrOutputMap);
return obj;
}
@ -1150,7 +1150,7 @@ UniValue AsyncRPCOperation_sendmany::getStatus() const {
}
UniValue obj = v.get_obj();
obj.push_back(Pair("method", "z_sendmany"));
obj.push_back(Pair("params", contextinfo_ ));
obj.pushKV("method", "z_sendmany");
obj.pushKV("params", contextinfo_ );
return obj;
}

View File

@ -266,7 +266,7 @@ void AsyncRPCOperation_shieldcoinbase::sign_send_raw_transaction(UniValue obj)
std::string txid = sendResultValue.get_str();
UniValue o(UniValue::VOBJ);
o.push_back(Pair("txid", txid));
o.pushKV("txid", txid);
set_result(o);
} else {
// Test mode does not send the transaction to the network.
@ -276,9 +276,9 @@ void AsyncRPCOperation_shieldcoinbase::sign_send_raw_transaction(UniValue obj)
stream >> tx;
UniValue o(UniValue::VOBJ);
o.push_back(Pair("test", 1));
o.push_back(Pair("txid", tx.GetHash().ToString()));
o.push_back(Pair("hex", signedtxn));
o.pushKV("test", 1);
o.pushKV("txid", tx.GetHash().ToString());
o.pushKV("hex", signedtxn);
set_result(o);
}
@ -439,11 +439,11 @@ UniValue AsyncRPCOperation_shieldcoinbase::perform_joinsplit(ShieldCoinbaseJSInf
// !!! Payment disclosure END
UniValue obj(UniValue::VOBJ);
obj.push_back(Pair("encryptednote1", encryptedNote1));
obj.push_back(Pair("encryptednote2", encryptedNote2));
obj.push_back(Pair("rawtxn", HexStr(ss.begin(), ss.end())));
obj.push_back(Pair("inputmap", arrInputMap));
obj.push_back(Pair("outputmap", arrOutputMap));
obj.pushKV("encryptednote1", encryptedNote1);
obj.pushKV("encryptednote2", encryptedNote2);
obj.pushKV("rawtxn", HexStr(ss.begin(), ss.end()));
obj.pushKV("inputmap", arrInputMap);
obj.pushKV("outputmap", arrOutputMap);
return obj;
}
@ -457,8 +457,8 @@ UniValue AsyncRPCOperation_shieldcoinbase::getStatus() const {
}
UniValue obj = v.get_obj();
obj.push_back(Pair("method", "z_shieldcoinbase"));
obj.push_back(Pair("params", contextinfo_ ));
obj.pushKV("method", "z_shieldcoinbase");
obj.pushKV("params", contextinfo_ );
return obj;
}