|
Ran
|
Files
29
|
Run time
2s
|
Badge
README BADGES
|
push
github
Merge bitcoindevkit/bdk#2195: fix(electrum): do not pick unindexed outputs for history lookup <a class=hub.com/bitcoindevkit/bdk/commit/<a class="double-link" href="https://git"><a class=hub.com/bitcoindevkit/bdk/commit/2e3d52e80fdc504c718426b9255a30fc24b7ceda">2e3d52e80 fix(electrum): do not pick unindexed outputs for history lookup (Zoe Faltibà) Pull request description: ### Description `BdkElectrumClient::populate_with_txids` queries each transaction's confirmation status by calling `script_get_history` on the script of one of its outputs. It currently picks the first output unconditionally. This breaks for transactions which first output is an `OP_RETURN`, because Electrum servers don't index `OP_RETURN` scripts and will return an empty history. This is a real-world scenario: protocols like RGB place an `OP_RETURN` commitment as the first output of every transaction. ### Notes to the reviewers The fix selects the first output which script is not `OP_RETURN` or a `OP_FALSE OP_RETURN`. If a transaction has only `OP_RETURN`/`OP_FALSE OP_RETURN` outputs, we fall back to the script of any input's previous output to query history. The only case still skipped is a coinbase with all unindexed outputs, since coinbases have no parent to fall back on. ### Changelog notice ``` Fixed: - `BdkElectrumClient::sync` now correctly retrieves confirmation status for transactions which first output is an `OP_RETURN` or `OP_FALSE OP_RETURN` ``` ### Checklists #### All Submissions: * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md) ACKs for top commit: oleonardolima: ACK 2e3d52e80fdc504c718426b9255a30fc24b7ceda evanlinjin: ACK 2e3d52e80fdc504c718426b9255a30fc24b7ceda Tree-SHA512: d87a0580c6405bb54cc77cc63088c3ddcd0
418 of 562 branches covered (74.38%)
Branch coverage included in aggregate %.
4441 of 5704 relevant lines covered (77.86%)
3194.66 hits per line
| Coverage | ∆ | File | Lines | Relevant | Covered | Missed | Hits/Line | Branch Hits | Branch Misses |
|---|