diff options
author | MarcoFalke <falke.marco@gmail.com> | 2021-05-25 09:00:25 +0200 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2021-05-25 09:00:27 +0200 |
commit | db1aca01d5dee845b6c44a33d3fa3269c8427273 (patch) | |
tree | c3690548699410b6476a25123864d261c7dabfce /src/wallet | |
parent | aeecb1c2eb57bcdf0f1be4682a5d0b79b5470e57 (diff) | |
parent | 4f504f826bcbb1a4aa4701e87cb68da4ca05b857 (diff) |
Merge bitcoin/bitcoin#22021: rpc: bumpfee/psbtbumpfee fixes and updates
4f504f826bcbb1a4aa4701e87cb68da4ca05b857 rpc: fix code comment for bumpfee/psbtbumpfee output (Jon Atack)
5cb7ac23fb97a0cbc75b7eef0951da0e0bc5292b rpc: fix docs for bumpfee psbt update (Jon Atack)
Pull request description:
Follow-up to #21544 and #20891 for the `bumpfee_helper` used for RPCs bumpfee and psbtbumpfee:
- "psbt" field is only returned in psbtbumpfee and not bumpfee
- bumpfee raises if private keys are disabled, so the txid help "Only returned when wallet private keys are enabled." no longer makes sense; remove it
- add missing space in RPC examples ("Bump the fee, get the new transaction'stxid")
- update txid/psbt code comments
ACKs for top commit:
klementtan:
ACK [`4f504f8`](https://github.com/bitcoin/bitcoin/pull/22021/commits/4f504f826bcbb1a4aa4701e87cb68da4ca05b857)
Tree-SHA512: 194faf8af52383eb8ac5cd22825265931bcde135dac79d8ecc4f84f698070da9b9373c00eef8623961881bb293157c7c9a0d71d1bcccf481ae3605a2d1444ed8
Diffstat (limited to 'src/wallet')
-rw-r--r-- | src/wallet/rpcwallet.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 4e3c8ce49d..a2124cc05e 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -3430,12 +3430,10 @@ static RPCHelpMan bumpfee_helper(std::string method_name) "options"}, }, RPCResult{ - RPCResult::Type::OBJ, "", "", Cat(Cat<std::vector<RPCResult>>( - { - {RPCResult::Type::STR, "psbt", "The base64-encoded unsigned PSBT of the new transaction."}, - }, - want_psbt ? std::vector<RPCResult>{} : std::vector<RPCResult>{{RPCResult::Type::STR_HEX, "txid", "The id of the new transaction. Only returned when wallet private keys are enabled."}} - ), + RPCResult::Type::OBJ, "", "", Cat( + want_psbt ? + std::vector<RPCResult>{{RPCResult::Type::STR, "psbt", "The base64-encoded unsigned PSBT of the new transaction."}} : + std::vector<RPCResult>{{RPCResult::Type::STR_HEX, "txid", "The id of the new transaction."}}, { {RPCResult::Type::STR_AMOUNT, "origfee", "The fee of the replaced transaction."}, {RPCResult::Type::STR_AMOUNT, "fee", "The fee of the new transaction."}, @@ -3446,7 +3444,7 @@ static RPCHelpMan bumpfee_helper(std::string method_name) }) }, RPCExamples{ - "\nBump the fee, get the new transaction\'s" + std::string(want_psbt ? "psbt" : "txid") + "\n" + + "\nBump the fee, get the new transaction\'s " + std::string(want_psbt ? "psbt" : "txid") + "\n" + HelpExampleCli(method_name, "<txid>") }, [want_psbt](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue @@ -3528,8 +3526,8 @@ static RPCHelpMan bumpfee_helper(std::string method_name) UniValue result(UniValue::VOBJ); - // If wallet private keys are enabled, return the new transaction id, - // otherwise return the base64-encoded unsigned PSBT of the new transaction. + // For bumpfee, return the new transaction id. + // For psbtbumpfee, return the base64-encoded unsigned PSBT of the new transaction. if (!want_psbt) { if (!feebumper::SignTransaction(*pwallet, mtx)) { throw JSONRPCError(RPC_WALLET_ERROR, "Can't sign transaction."); |