From: Alekos Filini Date: Tue, 5 Jul 2022 20:25:28 +0000 (+0200) Subject: Merge bitcoindevkit/bdk#614: Avoid using immature coinbase inputs X-Git-Tag: 0.20.0~11 X-Git-Url: http://internal-gitweb-vhost/script/%22https:/enum.SignError.html?a=commitdiff_plain;h=ec22fa2ad0b60250101be3a6ecfd5fa1b8e4b554;p=bdk Merge bitcoindevkit/bdk#614: Avoid using immature coinbase inputs e85aa247cb85601e96f4d82b7a996f709559223f Avoid using immature coinbase inputs (Daniela Brozzoni) 0e0d5a0e957fbf602023011d9114d8bcb8effb67 populate_test_db accepts a `coinbase` param (Daniela Brozzoni) Pull request description: ### Description With this PR we start considering how many confirmations a coinbase has. If it's not mature yet, we don't use it for building transactions. Fixes #413 ### Notes to the reviewers This PR is based on #611, review that one before reviewing this 😄 007c5a78335a3e9f6c9c28a077793c2ba34bbb4e adds a coinbase parameter to `populate_test_db`, to specify if you want the db to be populated with immature coins. This is useful for `test_spend_coinbase`, but that's probably going to be the only use case. I don't think it's a big deal to have a test function take an almost_always_useless parameter - it's not an exposed API, anyways. But, if you can come up with a different way of implementing `test_spend_coinbase` that doesn't require 007c5a78335a3e9f6c9c28a077793c2ba34bbb4e, even better! I looked for it for a while, but other than duplicating the whole `populate_test_db` code, which made the test way harder to comprehend, I didn't find any other way. ### 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 #### Bugfixes: * [ ] This pull request breaks the existing API * [x] I've added tests to reproduce the issue which are now passing * [x] I'm linking the issue being fixed by this PR ACKs for top commit: afilini: ACK e85aa24 Tree-SHA512: 30f470c33f9ffe928500a58f821f8ce445c653766459465eb005031ac523c6f143856fc9ca68a8e1f23a485c6543a9565bd889f9557c92bf5322e81291212a5f --- ec22fa2ad0b60250101be3a6ecfd5fa1b8e4b554