-
Notifications
You must be signed in to change notification settings - Fork 403
Discourage fee sniping with nLockTime #611
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
Discourage fee sniping with nLockTime #611
Conversation
d9753d7
to
e809697
Compare
e809697
to
a7859d4
Compare
a7859d4
to
6556fbb
Compare
6556fbb
to
f8da54e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tACK f8da54e
Just for the sake of completeness, maybe one more test showing, when the wallet isn't synced locktime defaults to 0?
And few other non blocking nits..
f8da54e
to
dc5471f
Compare
Thanks for the review! I updated the code removing the duplicated test, and adding some checks to the already existing tests (for example, testing that the current_height won't override the user specified nlocktime). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tACK dc5471f
Thanks for the update.. Just one more comment for future PR maybe..
This one seems good to go..
dc5471f
to
a46bf9b
Compare
Rebased |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested ACK. Just had a question
a46bf9b
to
a546738
Compare
3f528f2
to
07c77f9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ReACK 07c77f9
This needs rebasing and then it's ready to go |
By default bdk sets the transaction's nLockTime to current_height to discourage fee sniping. current_height can be provided by the user through TxParams; if the user didn't provide it, we use the last sync height, or 0 if we never synced. Fixes bitcoindevkit#533
07c77f9
to
97bc9dc
Compare
Rebased :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 97bc9dc
e85aa24 Avoid using immature coinbase inputs (Daniela Brozzoni) 0e0d5a0 populate_test_db accepts a `coinbase` param (Daniela Brozzoni) Pull request description: ### Description With this PR we start considering how many confirmations a coinbase has. If it's not mature yet, we don't use it for building transactions. Fixes #413 ### Notes to the reviewers This PR is based on #611, review that one before reviewing this 😄 007c5a7 adds a coinbase parameter to `populate_test_db`, to specify if you want the db to be populated with immature coins. This is useful for `test_spend_coinbase`, but that's probably going to be the only use case. I don't think it's a big deal to have a test function take an almost_always_useless parameter - it's not an exposed API, anyways. But, if you can come up with a different way of implementing `test_spend_coinbase` that doesn't require 007c5a7, even better! I looked for it for a while, but other than duplicating the whole `populate_test_db` code, which made the test way harder to comprehend, I didn't find any other way. ### Checklists #### All Submissions: * [x] I've signed all my commits * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md) * [x] I ran `cargo fmt` and `cargo clippy` before committing #### Bugfixes: * [ ] This pull request breaks the existing API * [x] I've added tests to reproduce the issue which are now passing * [x] I'm linking the issue being fixed by this PR ACKs for top commit: afilini: ACK e85aa24 Tree-SHA512: 30f470c33f9ffe928500a58f821f8ce445c653766459465eb005031ac523c6f143856fc9ca68a8e1f23a485c6543a9565bd889f9557c92bf5322e81291212a5f
92b9597 Rename `set_current_height` to `current_height` (Alekos Filini) Pull request description: ### Description Usually we don't have any prefix except for methods that can *add* to a list or replace the list entirely (e.g. `add_recipients` vs `set_recipients`) I missed this during review of #611 ### Checklists #### All Submissions: * [x] I've signed all my commits * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md) * [x] I ran `cargo fmt` and `cargo clippy` before committing ACKs for top commit: danielabrozzoni: utACK 92b9597 - I'm sorry I didn't notice it! Tree-SHA512: 3391068b2761bcd04d740ef41f9e772039fca7bc0e0736afcbc582ec74b6c91eb155d9e09dd7a07462eec29e32ac86e41ba339d9a550af3f754164cab6bdbf61
Description
By default bdk sets the transaction's nLockTime to current_height
to prevent fee sniping.
current_height can be provided by the user through TxParams; if the user
didn't provide it, we use the last sync height, or 0 if we never synced.
Fixes #533
Notes to the reviewers:
If you want to know more about fee sniping: https://bitcoinops.org/en/topics/fee-sniping/
Checklists
All Submissions:
cargo fmt
andcargo clippy
before committingNew Features:
CHANGELOG.md