]> Untitled Git - bdk/commit
feat(testenv): add `mine_block` with custom timestamp and coinbase address
author志宇 <hello@evanlinjin.me>
Sat, 24 Jan 2026 10:20:23 +0000 (10:20 +0000)
committer志宇 <hello@evanlinjin.me>
Thu, 5 Mar 2026 06:51:35 +0000 (06:51 +0000)
commit9b1111fd18eed69839ca10e8cacb3b513a8a7aa4
tree4c73055a595f59cf06923257a5cdb008ffd255bb
parent01d0dd3b842f29d9dd167227f707d418ddb39036
feat(testenv): add `mine_block` with custom timestamp and coinbase address

Refactor block mining in `TestEnv` to use `getblocktemplate` RPC properly:

- Add `MineParams` struct to configure mining (empty blocks, custom
  timestamp, custom coinbase address)
- Add `mine_block()` method that builds blocks from the template with
  proper BIP34 coinbase scriptSig, witness commitment, and merkle root
- Add `min_time_for_next_block()` and `get_block_template()` helpers
- Refactor `mine_empty_block()` to use the new `mine_block()` API
- Include mempool transactions when `empty: false`
crates/testenv/src/lib.rs