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: fe5d22bc67
This commit is contained in:
parent
a3fe125490
commit
cfdd6b2f6c
2 changed files with 4 additions and 4 deletions
|
@ -1662,10 +1662,10 @@ UniValue finalizepsbt(const JSONRPCRequest& request)
|
||||||
mtx.vin[i].scriptWitness = psbtx.inputs[i].final_script_witness;
|
mtx.vin[i].scriptWitness = psbtx.inputs[i].final_script_witness;
|
||||||
}
|
}
|
||||||
ssTx << mtx;
|
ssTx << mtx;
|
||||||
result.pushKV("hex", HexStr(ssTx.begin(), ssTx.end()));
|
result.pushKV("hex", HexStr(ssTx.str()));
|
||||||
} else {
|
} else {
|
||||||
ssTx << psbtx;
|
ssTx << psbtx;
|
||||||
result.pushKV("psbt", EncodeBase64((unsigned char*)ssTx.data(), ssTx.size()));
|
result.pushKV("psbt", EncodeBase64(ssTx.str()));
|
||||||
}
|
}
|
||||||
result.pushKV("complete", complete);
|
result.pushKV("complete", complete);
|
||||||
|
|
||||||
|
|
|
@ -4649,7 +4649,7 @@ UniValue walletprocesspsbt(const JSONRPCRequest& request)
|
||||||
UniValue result(UniValue::VOBJ);
|
UniValue result(UniValue::VOBJ);
|
||||||
CDataStream ssTx(SER_NETWORK, PROTOCOL_VERSION);
|
CDataStream ssTx(SER_NETWORK, PROTOCOL_VERSION);
|
||||||
ssTx << psbtx;
|
ssTx << psbtx;
|
||||||
result.pushKV("psbt", EncodeBase64((unsigned char*)ssTx.data(), ssTx.size()));
|
result.pushKV("psbt", EncodeBase64(ssTx.str()));
|
||||||
result.pushKV("complete", complete);
|
result.pushKV("complete", complete);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -4763,7 +4763,7 @@ UniValue walletcreatefundedpsbt(const JSONRPCRequest& request)
|
||||||
ssTx << psbtx;
|
ssTx << psbtx;
|
||||||
|
|
||||||
UniValue result(UniValue::VOBJ);
|
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("fee", ValueFromAmount(fee));
|
||||||
result.pushKV("changepos", change_position);
|
result.pushKV("changepos", change_position);
|
||||||
return result;
|
return result;
|
||||||
|
|
Loading…
Reference in a new issue