-
Notifications
You must be signed in to change notification settings - Fork 403
test: legacy descriptors #1130
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
test: legacy descriptors #1130
Conversation
"shoulld be ok when outpoint does match psbt_input" | ||
"should be ok when outpoint does match psbt_input" |
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.
This typo was autofixed by my linter.
This is ready, Cc @notmandatory and @danielabrozzoni. (PS: Thanks for all the help, Daniela) |
@@ -12,7 +12,7 @@ members = [ | |||
"example-crates/wallet_esplora_blocking", | |||
"example-crates/wallet_esplora_async", | |||
"nursery/tmp_plan", | |||
"nursery/coin_select" | |||
"nursery/coin_select", |
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.
autoformat
#[allow(unused_mut)] | ||
#[allow(unused_mut)] |
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.
autoformat
e47eedb
to
d5bf32c
Compare
/// A floating point assert! that takes an additional third argument `delta` | ||
/// as a tolerance value when test for equality the first and second argument. | ||
macro_rules! assert_delta { | ||
($x:expr, $y:expr, $d:expr) => { | ||
if !($x - $y < $d || $y - $x < $d) { | ||
panic!(); | ||
} | ||
}; | ||
} | ||
|
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.
This the way I've found to ignore rounding errors when comparing FeeRate::from_sat_per_vb
after the wallet signed with PKH descriptor.
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.
I think once #1141 is in you'll be able to use a different function to compare fee rates like to_sat_per_kwu(self) or to_sat_per_vb_ceil(self).
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.
fix: typo
d5bf32c
to
600824e
Compare
I think the proposed tests are useful and a great addition. However the PR has become stale and I guess we could move it out from |
Hey @realeinherjar, this PR needs to be closed and moved to the new bdk_wallet repo. Here's how:
|
@notmandatory or @ValuedMammal, you need to close this one, he doesn't use this nym anymore. |
5dcf128 test: fixup value of P2WPKH_FAKE_PK_SIZE (33) (valued mammal) 833ed78 chore(test): destructure `wallet.sent_and_received()` into `(sent, received)` (Luis Schwab) 9b3eb94 fix(test): `check_fee!` returns `Amount` instead of `Result<Amount>` (Luis Schwab) b56f4bd fix(test): push P2WPKH's signature and pubkey separately into witness (Luis Schwab) 1b4f31c fix: clippy (Luis Schwab) 4c963d9 test: add `test_legacy_bump_fee_add_input()` (Luis Schwab) 6c2e5a5 test: add `test_legacy_bump_fee_drain_wallet()` (Luis Schwab) a094c6e test: add `test_legacy_bump_fee_zero_abs()` (Luis Schwab) 19f9095 test: add `test_legacy_create_tx_custom_sighash()` (Luis Schwab) ba06877 test: add `test_legacy_create_tx_default_sighash()` (Luis Schwab) 2dcf7ad test: add `test_legacy_create_tx_absolute_high_fee()` (Luis Schwab) cc5ba73 test: add `test_legacy_create_tx_absolute_zero_fee()` (Luis Schwab) cf0125c test: add `test_legacy_create_tx_absolute_fee()` (Luis Schwab) a8a0df4 test: add `test_legacy_create_tx_custom_fee_rate()` (Luis Schwab) 73e9b6f test: add `test_legacy_get_funded_wallet_tx_fee_rate()` (Luis Schwab) a4de9be feat: create `assert_fee_rate_legacy!` macro (Luis Schwab) 5444fe7 test: add `get_test_pkh` (Luis Schwab) Pull request description: <!-- You can erase any parts of this template not applicable to your Pull Request. --> ### Description This PR closes #134 and is a revival of bitcoindevkit/bdk#1130, which adds the following tests: - `test_legacy_bump_fee_no_change_add_input_and_change()` - `test_legacy_bump_fee_add_input()` - `test_legacy_bump_fee_drain_wallet()` - `test_legacy_bump_fee_zero_abs()` - `test_legacy_create_tx_custom_sighash()` - `test_legacy_create_tx_default_sighash()` - `test_legacy_create_tx_absolute_high_fee()` - `test_legacy_create_tx_absolute_zero_fee()` - `test_legacy_create_tx_absolute_fee()` - `test_legacy_create_tx_custom_fee_rate()` - `test_legacy_get_funded_wallet_tx_fee_rate()` ### Changelog: - Add the above mentioned tests. - Add a new `assert_fee_rate_legacy!` macro for legacy transactions. - The `check_fee!` macro now returns `Amount` instead of `Result<Amount>`. - All `wallet.sent_and_received` got destructured to `(sent, received)` instead of `sent_and_received.{0,1}`. - ~Swap `TweakedKeypair::to_inner()` for `TweakedKeypair::to_keypair()`.~ ### 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: ValuedMammal: ACK 5dcf128 Tree-SHA512: 4ce84749f6611ee540bd0d161ef22f731b827c9bef80a567977ba954e68bbbd1a93a1eaaf35d91cfc87f82d10ce7a62f2866aeceb5fef87792a18c2f72e2ace7
Description
We currently don't have much tests with legacy descriptors (
pkh
).This PR adds some, mainly focused on fee stuff.
Notes to the reviewers
This discussion came up on #1115 and also in bitcoindevkit/bdk_wallet#134 (it doesn't fully close).
Changelog notice
Added
Checklists
All Submissions:
cargo fmt
andcargo clippy
before committingNew Features:
Bugfixes: