Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wallet, rpc: document and update sendall behavior around unconfirmed inputs #28979

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

ishaanam
Copy link
Contributor

@ishaanam ishaanam commented Nov 30, 2023

This PR:

  • Adds a functional test that sendall spends unconfirmed change
  • Adds a functional test that sendall spends regular unconfirmed inputs when specified by user
  • Adds ancestor aware funding to sendall by using calculateCombinedBumpFee and adjusting the effective value accordingly
  • Adds a functional test for ancestor aware funding in sendall

@DrahtBot
Copy link
Contributor

DrahtBot commented Nov 30, 2023

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

Code Coverage

For detailed information about the code coverage, see the test coverage report.

Reviews

See the guideline for information on the review process.

Type Reviewers
ACK furszy
Concept ACK jonatack, S3RK, BrandonOdiwuor, murchandamus, tdb3, achow101

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

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #28944 (wallet, rpc: add anti-fee-sniping to send and sendall by ishaanam)

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.

Copy link
Contributor

@jonatack jonatack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concept ACK

test/functional/wallet_sendall.py Outdated Show resolved Hide resolved
@jonatack
Copy link
Contributor

jonatack commented Nov 30, 2023

The code changes cause this test failure for me locally:

$ ./test/functional/wallet_fundrawtransaction.py --legacy-wallet 
2023-11-30T23:17:02.968000Z TestFramework (INFO): PRNG seed is: 4425912909580482609
.../...
2023-11-30T23:17:20.070000Z TestFramework (INFO): Test fundrawtxn with locked wallet and hardened derivation
2023-11-30T23:17:21.869000Z TestFramework (ERROR): Unexpected exception caught during testing
Traceback (most recent call last):
  File "/Users/jon/bitcoin/bitcoin/test/functional/test_framework/test_framework.py", line 131, in main
    self.run_test()
  File "/Users/jon/bitcoin/bitcoin/./test/functional/wallet_fundrawtransaction.py", line 134, in run_test
    self.test_locked_wallet()
  File "/Users/jon/bitcoin/bitcoin/./test/functional/wallet_fundrawtransaction.py", line 603, in test_locked_wallet
    value = inputs[0]["amount"] - get_fee(tx_size, self.min_relay_tx_fee)
            ~~~~~~^^^
IndexError: list index out of range

and

wallet/rpc/spend.cpp:1476:47: error: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy,-warnings-as-errors]
 1476 |                 for (std::shared_ptr<COutput> output : pre_selected_inputs.coins) {
      |                                               ^
      |                      const   

@S3RK
Copy link
Contributor

S3RK commented Dec 3, 2023

Concept ACK

Copy link
Contributor

@BrandonOdiwuor BrandonOdiwuor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concept ACK

@ishaanam ishaanam force-pushed the sendall_ancestor_aware_funding branch 2 times, most recently from 3a91852 to 8d28da4 Compare December 10, 2023 04:50
@ishaanam ishaanam marked this pull request as ready for review December 10, 2023 16:44
Copy link
Contributor

@murchandamus murchandamus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concept ACK, the ancestor aware funding could use a test

test/functional/wallet_sendall.py Show resolved Hide resolved
src/wallet/rpc/spend.cpp Outdated Show resolved Hide resolved

# higher parent feerate
self.def_wallet.sendtoaddress(address=self.wallet.getnewaddress(), amount=17, fee_rate=20)
assert_greater_than(self.wallet.getbalances()["mine"]["untrusted_pending"], 0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code seems correct to me, but the test seems to have failed on line 408:
https://cirrus-ci.com/task/6362440724643840?logs=ci#L2630

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I presume self.def_wallet is not equal to self.wallet, so a mempool sync is missing here, to allow for the transaction to "propagate" through the full validation interface queue.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self.def_wallet is not equal to self.wallet, but they belong to the same node. I have implemented this suggestion, but given that the wallets are in the same node, will it make a difference?

Copy link
Member

@furszy furszy Jan 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self.def_wallet is not equal to self.wallet, but they belong to the same node. I have implemented this suggestion, but given that the wallets are in the same node, will it make a difference?

Need to call syncwithvalidationinterfacequeue() to flush the validation queue before checking the wallet balance. The transaction could have not been processed by the validation interface worker thread. This is the one dispatching the tx to the second wallet.

@murchandamus
Copy link
Contributor

I don’t know why it could be failing here, it doesn’t seem to make sense that it would. Could you try to rebase?

@ishaanam ishaanam force-pushed the sendall_ancestor_aware_funding branch from 5564345 to 551707a Compare January 3, 2024 22:49
@DrahtBot DrahtBot removed the CI failed label Jan 3, 2024
@ishaanam ishaanam force-pushed the sendall_ancestor_aware_funding branch from 551707a to db592e1 Compare January 5, 2024 21:00
test/functional/wallet_sendall.py Outdated Show resolved Hide resolved

# higher parent feerate
self.def_wallet.sendtoaddress(address=self.wallet.getnewaddress(), amount=17, fee_rate=20)
assert_greater_than(self.wallet.getbalances()["mine"]["untrusted_pending"], 0)
Copy link
Member

@furszy furszy Jan 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self.def_wallet is not equal to self.wallet, but they belong to the same node. I have implemented this suggestion, but given that the wallets are in the same node, will it make a difference?

Need to call syncwithvalidationinterfacequeue() to flush the validation queue before checking the wallet balance. The transaction could have not been processed by the validation interface worker thread. This is the one dispatching the tx to the second wallet.

test/functional/wallet_sendall.py Outdated Show resolved Hide resolved
src/wallet/rpc/spend.cpp Outdated Show resolved Hide resolved
test/functional/wallet_sendall.py Show resolved Hide resolved
test/functional/wallet_sendall.py Outdated Show resolved Hide resolved
@ishaanam ishaanam force-pushed the sendall_ancestor_aware_funding branch from e73a56f to a7986ff Compare February 10, 2024 21:55
Copy link
Contributor

@tdb3 tdb3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concept ACK. Nice addition (adding more ancestor awareness).
Received a test failure (inline comment provided).

test/functional/wallet_sendall.py Show resolved Hide resolved
@achow101
Copy link
Member

ACK modulo existing comments.

@ishaanam ishaanam force-pushed the sendall_ancestor_aware_funding branch from a7986ff to 71aae72 Compare May 9, 2024 16:50
Copy link
Member

@furszy furszy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 71aae72

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants