`create_tx` panics when chain tip height is not a valid locktime height
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 85/100
Research direction
Start in src/wallet/mod.rs around the current_height match and the invalid-height expect described in the issue. Reproduce the case by applying a CheckPoint at height 500,000,000 or higher, then call build_tx and finish without setting current_height. Done means transaction building returns an error or otherwise avoids panicking, with a regression test covering the out-of-range tip.
Written by the indexing model from the issue text.
Description
Describe the bug
When TxBuilder::current_height is not set, Wallet::create_tx converts the chain tip height into an absolute::LockTime with .expect("invalid height") (src/wallet/mod.rs, around the current_height match). absolute::LockTime::from_height fails for heights >= 500,000,000, so a chain tip with such a height makes transaction building panic instead of returning an error.
The tip comes from whatever chain source the wallet is synced against, so a malformed or misbehaving source can trigger the panic.
This issue was found by AI.
To Reproduce
- Apply a
CheckPointwith height500_000_000(or higher) to the wallet viaapply_update. - Call
wallet.build_tx()with a recipient andfinish()without settingcurrent_height. - Observe the panic
invalid height.
Expected behavior
create_tx should not panic on an out-of-range tip height; returning an error (or otherwise handling the case) is preferable.
Build environment
- BDK tag/commit:
6fc68462(master)
Which backend(s) are relevant (if any)?
- None / not backend-related (e.g.
bdk_chain,bdk_core)
Is this blocking production use?
- No
- Dominant language
- Rust
- Stars
- 59
- Forks
- 109
- Avg merge
- 3d 13h
- Merged PRs (30d)
- 2
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from bitcoindevkit/bdk_wallet
-
tests
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
bitcoindevkit/bdk_wallet#552 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
bitcoindevkit/bdk_wallet#511 · 1 reaction ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
bitcoindevkit/bdk_wallet#474 · 2 comments ·
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 72/100
bitcoindevkit/bdk_wallet#556 ·
-
bug
Difficulty 5/5 Over a week Newbie friendliness 35/100
bitcoindevkit/bdk_wallet#555 ·
All issues in bitcoindevkit/bdk_wallet
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
gitbutlerapp/gitbutler#15998 · 1 comment ·
-
bug triage:deciding
Difficulty 1/5 Under an hour Newbie friendliness 88/100
open-telemetry/otel-arrow#4132 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100