aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlenn Willen <gwillen@nerdnet.org>2018-10-26 15:18:52 -0700
committerPieter Wuille <pieter.wuille@gmail.com>2018-12-03 10:34:20 -0800
commitcfdd6b2f6c01c5c8dbe4691cc84c65b9705784c3 (patch)
tree5188ca63db09af206ea0b003b0de95ec5b88032d
parenta3fe125490978a684528c40fc9a15ccdfdf2c92a (diff)
More concise conversion of CDataStream to string
Use .str() instead of .data() and .size() when converting CDataStream to a string. Uses std::string, avoiding conversion to a C string. Github-Pull: #14588 Rebased-From: fe5d22bc676f158e8d567d71edb3451118759d62
-rw-r--r--src/rpc/rawtransaction.cpp4
-rw-r--r--src/wallet/rpcwallet.cpp4
2 files changed, 4 insertions, 4 deletions
diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp
index 314184ab06..2fdbe38145 100644
--- a/src/rpc/rawtransaction.cpp
+++ b/src/rpc/rawtransaction.cpp
@@ -1662,10 +1662,10 @@ UniValue finalizepsbt(const JSONRPCRequest& request)
mtx.vin[i].scriptWitness = psbtx.inputs[i].final_script_witness;
}
ssTx << mtx;
- result.pushKV("hex", HexStr(ssTx.begin(), ssTx.end()));
+ result.pushKV("hex", HexStr(ssTx.str()));
} else {
ssTx << psbtx;
- result.pushKV("psbt", EncodeBase64((unsigned char*)ssTx.data(), ssTx.size()));
+ result.pushKV("psbt", EncodeBase64(ssTx.str()));
}
result.pushKV("complete", complete);
diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp
index 0a9242327b..c5cc277c4a 100644
--- a/src/wallet/rpcwallet.cpp
+++ b/src/wallet/rpcwallet.cpp
@@ -4649,7 +4649,7 @@ UniValue walletprocesspsbt(const JSONRPCRequest& request)
UniValue result(UniValue::VOBJ);
CDataStream ssTx(SER_NETWORK, PROTOCOL_VERSION);
ssTx << psbtx;
- result.pushKV("psbt", EncodeBase64((unsigned char*)ssTx.data(), ssTx.size()));
+ result.pushKV("psbt", EncodeBase64(ssTx.str()));
result.pushKV("complete", complete);
return result;
@@ -4763,7 +4763,7 @@ UniValue walletcreatefundedpsbt(const JSONRPCRequest& request)
ssTx << psbtx;
UniValue result(UniValue::VOBJ);
- result.pushKV("psbt", EncodeBase64((unsigned char*)ssTx.data(), ssTx.size()));
+ result.pushKV("psbt", EncodeBase64(ssTx.str()));
result.pushKV("fee", ValueFromAmount(fee));
result.pushKV("changepos", change_position);
return result;