]> Untitled Git - bdk/commit
fix(electrum): Handle negative heights properly
author志宇 <hello@evanlinjin.me>
Sat, 15 Feb 2025 14:47:20 +0000 (01:47 +1100)
committer志宇 <hello@evanlinjin.me>
Thu, 20 Feb 2025 14:03:10 +0000 (01:03 +1100)
commit75020521db4e5268960d1b84fe13482f9c6c9457
tree375c49277e186b2c8c793aefd6cf149533e87ca3
parenta41db8261e49d7d96d926e40c791b6353f292e5a
fix(electrum): Handle negative heights properly

In electrum, heights returned alongside txs may be 0 or -1. 0 means the
tx is unconfirmed. -1 means the tx is unconfirmed and spends an
unconfirmed tx.

Previously, the codebase assumed that heights cannot be negative and
used a `i32 as usize` cast (which would lead to panic if the i32 is
negative).
crates/electrum/src/bdk_electrum_client.rs