From: merge-script Date: Fri, 8 May 2026 18:49:43 +0000 (-0300) Subject: Merge bitcoindevkit/bdk#2195: fix(electrum): do not pick unindexed outputs for histor... X-Git-Url: http://internal-gitweb-vhost/%22bdk_chain/struct.ScriptBuf.html?a=commitdiff_plain;h=641b4000b1aa41788deb3abb2d2fa030d1ef66f4;p=bdk Merge bitcoindevkit/bdk#2195: fix(electrum): do not pick unindexed outputs for history lookup 2e3d52e80fdc504c718426b9255a30fc24b7ceda 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: d87a0580c0db4e86ee6fce84a82ac56ef70378b46405bb54ca33f1a2a643feba6fa769c0ba2a9e01c77cc6308c777ccc34f89d548e46a1bbf036e31d8c3ddcd0 --- 641b4000b1aa41788deb3abb2d2fa030d1ef66f4