mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-04-10 05:11:20 +02:00
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`](4f504f826b
)
Tree-SHA512: 194faf8af52383eb8ac5cd22825265931bcde135dac79d8ecc4f84f698070da9b9373c00eef8623961881bb293157c7c9a0d71d1bcccf481ae3605a2d1444ed8
This commit is contained in:
commit
db1aca01d5
@ -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.");
|
||||
|
Loading…
x
Reference in New Issue
Block a user