rpc, gui: bumpfee signer support #21576

pull Sjors wants to merge 3 commits into bitcoin:master from Sjors:2021/04/signer_bumpfee changing 4 files +52 −10
  1. Sjors commented at 6:38 PM on April 2, 2021: member

    The bumpfee RPC call and GUI fee bump interface now work with an external signer.

  2. Sjors commented at 6:39 PM on April 2, 2021: member

    I'm not tremendously excited by this approach of overloading bumpfee. But it also seems wrong to use psbtbumpfee here for the simple case of a single signer that has all the required keys. I could add yet another RPC method signerbumpfee?

    cc @achow101 @instagibbs

  3. DrahtBot added the label Build system on Apr 2, 2021
  4. DrahtBot added the label RPC/REST/ZMQ on Apr 2, 2021
  5. DrahtBot added the label Wallet on Apr 2, 2021
  6. DrahtBot commented at 1:22 AM on April 3, 2021: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK furszy, achow101, jarolrod
    Concept ACK luke-jr
    Stale ACK meshcollider

    If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #26485 (RPC: Accept options as named-only parameters by ryanofsky)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

  7. DrahtBot cross-referenced this on Apr 3, 2021 from issue Drop JSONRPCRequest constructors after #21366 by ryanofsky
  8. DrahtBot cross-referenced this on Apr 3, 2021 from issue Fix wrong wallet RPC context set after #21366 by ryanofsky
  9. DrahtBot cross-referenced this on Apr 3, 2021 from issue fuzz: Add fuzzing syscall sandbox: detect use of unexpected syscalls when fuzzing ("syscall sanitizer") by practicalswift
  10. DrahtBot cross-referenced this on Apr 3, 2021 from issue Convert taproot to flag day activation by ajtowns
  11. DrahtBot cross-referenced this on Apr 3, 2021 from issue MOVEONLY: CWallet transaction code out of wallet.cpp/.h by ryanofsky
  12. DrahtBot cross-referenced this on Apr 3, 2021 from issue refactor: Make CWalletTx sync state type-safe by ryanofsky
  13. DrahtBot cross-referenced this on Apr 3, 2021 from issue Use std::filesystem. Remove Boost Filesystem & System by fanquake
  14. DrahtBot cross-referenced this on Apr 3, 2021 from issue Fix Windows build with --enable-werror by hebasto
  15. DrahtBot cross-referenced this on Apr 3, 2021 from issue Add syscall sandboxing using seccomp-bpf (Linux secure computing mode) by practicalswift
  16. DrahtBot cross-referenced this on Apr 3, 2021 from issue wallet: Migrate legacy wallets to descriptor wallets by achow101
  17. DrahtBot cross-referenced this on Apr 3, 2021 from issue Introduce deploymentstatus by ajtowns
  18. DrahtBot cross-referenced this on Apr 4, 2021 from issue refactor: remove ::vpwallets and related global variables by ryanofsky
  19. Sjors force-pushed on Apr 27, 2021
  20. Sjors marked this as ready for review on Apr 27, 2021
  21. in src/wallet/rpcwallet.cpp:3529 in 0c0d293d31 outdated
    3531 | -        uint256 txid;
    3532 | -        if (feebumper::CommitTransaction(*pwallet, hash, std::move(mtx), errors, txid) != feebumper::Result::OK) {
    3533 | -            throw JSONRPCError(RPC_WALLET_ERROR, errors[0].original);
    3534 | -        }
    3535 | +            // First fill transaction with our data without signing,
    3536 | +            // so external signers are not asked sign more than once.
    


    meshcollider commented at 8:56 AM on May 30, 2021:

    nit: asked sign -> asked to sign

  22. in src/wallet/rpcwallet.cpp:3532 in 0c0d293d31 outdated
    3534 | -        }
    3535 | +            // First fill transaction with our data without signing,
    3536 | +            // so external signers are not asked sign more than once.
    3537 | +            bool complete;
    3538 | +            pwallet->FillPSBT(psbtx, complete, SIGHASH_ALL, false, true);
    3539 | +            const TransactionError err = pwallet->FillPSBT(psbtx, complete, SIGHASH_ALL, true, false);
    


    meshcollider commented at 8:57 AM on May 30, 2021:

    style nit: would be good to include the usual /* sign */ etc. comments for the bools here.

  23. in src/wallet/rpcwallet.cpp:3537 in 0c0d293d31 outdated
    3540 | +            if (err != TransactionError::OK) {
    3541 | +                throw JSONRPCTransactionError(err);
    3542 | +            }
    3543 |  
    3544 | -        result.pushKV("txid", txid.GetHex());
    3545 | +            CMutableTransaction mtx;
    


    meshcollider commented at 8:58 AM on May 30, 2021:

    redefinition of mtx?

  24. meshcollider commented at 9:00 AM on May 30, 2021: contributor

    utACK 0c0d293d31e96c9119e4793df66b375ec9f8495e

  25. in src/wallet/rpcwallet.cpp:3522 in 0c0d293d31 outdated
    3520 | @@ -3521,16 +3521,39 @@ static RPCHelpMan bumpfee_helper(std::string method_name)
    3521 |      // If wallet private keys are enabled, return the new transaction id,
    3522 |      // otherwise return the base64-encoded unsigned PSBT of the new transaction.
    


    jonatack commented at 9:06 AM on May 30, 2021:

    Do the merged changes in #22021 need to be updated with this pull?


    Sjors commented at 1:53 PM on May 31, 2021:

    I'll do a rebase and also address the nits above.


    Sjors commented at 3:07 PM on May 31, 2021:

    For now these comments are correct. In a multisig setup bumpfee will throw "Transaction incomplete. Try psbtbumpfee instead." (which in turn won't call the external signer). We can improve that later.

  26. Sjors commented at 3:31 PM on May 31, 2021: member

    Rebased, addressed comments and added a test.

  27. Sjors force-pushed on May 31, 2021
  28. meshcollider commented at 1:19 AM on June 1, 2021: contributor

    re-utACK dda02ce4f99cff37bbd41373df6ecb4541ed66f5

  29. DrahtBot cross-referenced this on Jun 4, 2021 from issue Basic Taproot signing support for descriptor wallets by sipa
  30. DrahtBot added the label Needs rebase on Jun 17, 2021
  31. Sjors force-pushed on Jun 18, 2021
  32. DrahtBot removed the label Needs rebase on Jun 18, 2021
  33. DrahtBot cross-referenced this on Jul 24, 2021 from issue rpc: Allow walletprocesspsbt to sign without finalizing by achow101
  34. DrahtBot cross-referenced this on Jul 27, 2021 from issue psbt: Taproot fields for PSBT by achow101
  35. in src/wallet/rpcwallet.cpp:4200 in c7e4cc0c95 outdated
    4194 | @@ -4174,10 +4195,10 @@ static RPCHelpMan send()
    4195 |              PartiallySignedTransaction psbtx(rawTx);
    4196 |  
    4197 |              // First fill transaction with our data without signing,
    4198 | -            // so external signers are not asked sign more than once.
    4199 | +            // so external signers are not asked to sign more than once.
    4200 |              bool complete;
    4201 | -            pwallet->FillPSBT(psbtx, complete, SIGHASH_DEFAULT, false, true);
    4202 | -            const TransactionError err = pwallet->FillPSBT(psbtx, complete, SIGHASH_DEFAULT, true, false);
    4203 | +            pwallet->FillPSBT(psbtx, complete, SIGHASH_DEFAULT, false /* sign */, true /* bip32derivs */);
    


    luke-jr commented at 1:46 AM on September 1, 2021:

    Usually we put the meaning-comment before the value.


    Sjors commented at 2:05 PM on September 1, 2021:

    That indeed seems more common (*/, has 93 results vs 441 for , /* )

  36. in src/wallet/rpcwallet.cpp:3552 in c7e4cc0c95 outdated
    3555 | +
    3556 | +            if (!complete) {
    3557 | +                throw JSONRPCError(RPC_WALLET_ERROR, "Transaction incomplete. Try psbtbumpfee instead.");
    3558 | +            }
    3559 | +            CTransactionRef tx(MakeTransactionRef(std::move(mtx)));
    3560 | +            result.pushKV("txid", tx->GetHash().GetHex());
    


    luke-jr commented at 1:51 AM on September 1, 2021:

    Prefer to assign txid here and do a single shared pushKV later.

  37. luke-jr approved
  38. luke-jr commented at 2:00 AM on September 1, 2021: member

    utACK

  39. luke-jr commented at 2:04 AM on September 1, 2021: member

    On further reflection, any reason not to put these details in feebumper::SignTransaction so it's more easily reused in the GUI?

  40. Sjors force-pushed on Sep 1, 2021
  41. Sjors force-pushed on Sep 1, 2021
  42. Sjors commented at 2:54 PM on September 1, 2021: member

    @luke-jr good idea: now it works with GUI too!

  43. Sjors renamed this:
    rpc: bumpfee signer support
    rpc, gui: bumpfee signer support
    on Sep 1, 2021
  44. Sjors force-pushed on Sep 1, 2021
  45. DrahtBot cross-referenced this on Sep 2, 2021 from issue qt: Add Create Unsigned button to SendConfirmationDialog by achow101
  46. luke-jr referenced this in commit 2f54a8d7f7 on Oct 10, 2021
  47. DrahtBot cross-referenced this on Nov 27, 2021 from issue wallet: Split stuff from rpcwallet by maflcko
  48. DrahtBot cross-referenced this on Nov 29, 2021 from issue Check descriptors returned by external signers by sstone
  49. DrahtBot cross-referenced this on Dec 2, 2021 from issue MOVEONLY: Move wallet backup and encryption RPCs out of rpcwallet by meshcollider
  50. DrahtBot cross-referenced this on Dec 6, 2021 from issue Split up rpcwallet by meshcollider
  51. DrahtBot added the label Needs rebase on Dec 8, 2021
  52. Sjors force-pushed on Dec 8, 2021
  53. Sjors commented at 5:46 AM on December 8, 2021: member

    Rebased after #23667 (manually re-applied changes from wallet/rpcwallet.cpp to wallet/rpc/spend.cpp)

  54. DrahtBot removed the label Needs rebase on Dec 8, 2021
  55. Sjors force-pushed on Dec 9, 2021
  56. achow101 commented at 9:35 PM on December 20, 2021: member

    There was a bad rebase, you've re-added src/wallet/rpcwallet.cpp.

  57. Sjors force-pushed on Dec 21, 2021
  58. Sjors commented at 2:54 AM on December 21, 2021: member

    Oops, fixed.

  59. achow101 commented at 8:22 PM on December 21, 2021: member

    ACK d5f720fb48d3eeb64101af1d5614a3650643bb1e

  60. DrahtBot added the label Needs rebase on Jan 9, 2022
  61. Sjors commented at 3:47 PM on January 12, 2022: member

    Rebased after bitcoin-core/gui#441, though not tested yet.

  62. Sjors force-pushed on Jan 12, 2022
  63. DrahtBot removed the label Needs rebase on Jan 12, 2022
  64. DrahtBot cross-referenced this on Feb 10, 2022 from issue Add 'sendall' RPC née sweep by murchandamus
  65. DrahtBot added the label Needs rebase on Mar 30, 2022
  66. in src/wallet/rpc/spend.cpp:1130 in ea8f5db52b outdated
    1128 | +            // so external signers are not asked to sign more than once.
    1129 |              bool complete;
    1130 | -            pwallet->FillPSBT(psbtx, complete, SIGHASH_DEFAULT, false, true);
    1131 | -            const TransactionError err = pwallet->FillPSBT(psbtx, complete, SIGHASH_DEFAULT, true, false);
    1132 | +            pwallet->FillPSBT(psbtx, complete, SIGHASH_DEFAULT, /* sign */ false, /* bip32derivs */ true);
    1133 | +            const TransactionError err = pwallet->FillPSBT(psbtx, complete, SIGHASH_DEFAULT, /* sign */ true, /* bip32derivs */ false);
    


    luke-jr commented at 3:10 PM on April 23, 2022:
                const TransactionError err = pwallet->FillPSBT(psbtx, complete, SIGHASH_DEFAULT, /*sign=*/true, /*bip32derivs=*/false);
    

    & other such changes


    Sjors commented at 3:45 PM on April 25, 2022:

    Fixed (after the rebase moved everything around)

  67. rpc: document bools in FillPSBT() calls 304ece9945
  68. Sjors force-pushed on Apr 25, 2022
  69. Sjors commented at 3:56 PM on April 25, 2022: member

    Rebased, but for the GUI to work I first need to apply the same change as bitcoin-core/gui#555

  70. Sjors force-pushed on Apr 25, 2022
  71. Sjors commented at 4:10 PM on April 25, 2022: member

    Ok, it works again now.

  72. rpc: bumpfee signer support 7e02a33297
  73. gui: bumpfee signer support
    Specifically this enables the Send button in the fee bump dialog for wallets with external signer support. Similar to 2efdfb88aab6496dcf2b98e0de30635bc6bade85.
    2c07cfacd1
  74. Sjors force-pushed on Apr 25, 2022
  75. DrahtBot removed the label Needs rebase on Apr 25, 2022
  76. luke-jr referenced this in commit b2424b5573 on May 21, 2022
  77. luke-jr referenced this in commit ab92f28122 on May 21, 2022
  78. in src/wallet/feebumper.cpp:254 in 2c07cfacd1
     250 | +        bool complete;
     251 | +        wallet.FillPSBT(psbtx, complete, SIGHASH_ALL, false /* sign */, true /* bip32derivs */);
     252 | +        const TransactionError err = wallet.FillPSBT(psbtx, complete, SIGHASH_ALL, true /* sign */, false  /* bip32derivs */);
     253 | +        if (err != TransactionError::OK) return false;
     254 | +        complete = FinalizeAndExtractPSBT(psbtx, mtx);
     255 | +        return complete;
    


    furszy commented at 3:41 PM on June 5, 2022:

    nit: as this is the same code that we have in "rpc/send" --> FinishTransaction, could decouple it into a new function and use it from both sides.


    Sjors commented at 2:58 PM on July 18, 2022:

    I looked into deduplicating the part where we fill without signing and then call fill, but it's not that easy. The following doesn't work: https://github.com/Sjors/bitcoin/commit/5d55117e53c6a460222dea99842edc4fda47622c (because it won't add the bip32 info for some reason)

  79. furszy commented at 3:51 PM on June 5, 2022: member

    code review ACK 2c07cfac

  80. jarolrod commented at 5:23 AM on October 14, 2022: member

    Approach ACK

    I was able to successfully sign for a fee increase on my external signer. Want to continue to do more testing.

  81. fanquake removed the label Build system on Oct 31, 2022
  82. DrahtBot cross-referenced this on Nov 12, 2022 from issue RPC: Accept options as named-only parameters by ryanofsky
  83. achow101 commented at 9:15 PM on December 15, 2022: member

    ACK 2c07cfacd1745844a1d3c57f2e8617549b9815d7

  84. jarolrod approved
  85. jarolrod commented at 1:54 AM on December 17, 2022: member

    tACK 2c07cfa

    I have tested and reviewed the code and agree it can be merged.

  86. achow101 merged this on Dec 20, 2022
  87. achow101 closed this on Dec 20, 2022

  88. sidhujag referenced this in commit ee9fae8586 on Dec 21, 2022
  89. Sjors deleted the branch on Jan 2, 2023
  90. bitcoin locked this on Jan 2, 2024

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-05-20 06:54 UTC