Skip to content

Commit f07423a

Browse files
committed
Merge #2170: fix(chain): add missing continue in CanonicalIter assumed-tx processing
27ab7ee fix(chain): add missing `continue` in `CanonicalIter` assumed-tx processing (Elias Rohrer) c4c87c5 ci: pin `hyper-rustls` to 0.27.7 for 1.75.0 toolchain (valued mammal) Pull request description: ### Description Without the `continue`, the loop falls through to the subsequent processing blocks when assumed-canonical transactions are the only remaining unprocessed source. If the anchored, seen, and leftover iterators are all exhausted, the loop reaches `return None` and silently drops the assumed transactions that were just marked canonical. ### Notes to the reviewers Co-Authored-By: HAL 9000 ### Checklists #### All Submissions: * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md) #### Bugfixes: * [ ] This pull request breaks the existing API * [x] I've added tests to reproduce the issue which are now passing * [ ] I'm linking the issue being fixed by this PR ACKs for top commit: ValuedMammal: ACK 27ab7ee Tree-SHA512: 9d06d6b254c51144b174d61859cc6e5b5f8b803324925e2091c4ac438b3dd86d2a9c8312ace8785d4c1d04f533869c2036b2999f02f886c05bff698e6a582a14
2 parents d9aa92b + 27ab7ee commit f07423a

4 files changed

Lines changed: 35 additions & 3 deletions

File tree

.github/workflows/cont_integration.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ jobs:
5959
cargo update -p time --precise "0.3.41"
6060
cargo update -p proptest --precise "1.8.0"
6161
cargo update -p "getrandom@0.4.2" --precise "0.2.17"
62+
cargo update -p "hyper-rustls" --precise "0.27.7"
6263
- name: Pin dependencies for MSRV
6364
if: matrix.rust.version == '1.63.0'
6465
run: ./ci/pin-msrv.sh

ci/pin-msrv.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ cargo update -p base64ct --precise "1.6.0"
2929
cargo update -p minreq --precise "2.13.2"
3030
cargo update -p tracing --precise "0.1.40"
3131
cargo update -p tracing-core --precise "0.1.33"
32-
cargo update -p "webpki-roots@1.0.6" --precise "1.0.1"
32+
cargo update -p "webpki-roots@1.0.7" --precise "1.0.1"
3333
cargo update -p rayon --precise "1.10.0"
3434
cargo update -p rayon-core --precise "1.12.1"
3535
cargo update -p openssl --precise "0.10.73"
@@ -53,10 +53,12 @@ cargo update -p unicode-ident --precise "1.0.13"
5353
cargo update -p hyper-util --precise "0.1.6"
5454
cargo update -p pin-project --precise "1.1.5"
5555
cargo update -p pin-project-internal --precise "1.1.5"
56-
cargo update -p "rustls@0.23.37" --precise "0.23.26"
56+
cargo update -p "rustls@0.23.38" --precise "0.23.26"
57+
cargo update -p "libc" --precise "0.2.183"
58+
cargo update -p "semver" --precise "1.0.27"
5759

5860
# all pinning required due to `clap` usage in `example_cli`
59-
cargo update -p "clap@4.6.0" --precise "4.5.17"
61+
cargo update -p "clap@4.6.1" --precise "4.5.17"
6062
cargo update -p proc-macro2 --precise "1.0.92"
6163
cargo update -p quote --precise "1.0.41"
6264
cargo update -p syn --precise "2.0.106"

crates/chain/src/canonical_iter.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ impl<A: Anchor, C: ChainOracle> Iterator for CanonicalIter<'_, A, C> {
218218
if !self.is_canonicalized(txid) {
219219
self.mark_canonical(txid, tx, CanonicalReason::assumed());
220220
}
221+
continue;
221222
}
222223

223224
if let Some((txid, tx, anchors)) = self.unprocessed_anchored_txs.next() {

crates/chain/tests/test_tx_graph_conflicts.rs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -943,6 +943,34 @@ fn test_tx_conflict_handling() {
943943
confirmed: Amount::ZERO,
944944
},
945945
},
946+
Scenario {
947+
name: "only assumed-canonical txs are yielded without anchored or seen txs",
948+
tx_templates: &[
949+
TxTemplate {
950+
tx_name: "assumed_a",
951+
inputs: &[TxInTemplate::Bogus],
952+
outputs: &[TxOutTemplate::new(21_000, Some(0))],
953+
assume_canonical: true,
954+
..Default::default()
955+
},
956+
TxTemplate {
957+
tx_name: "assumed_b",
958+
inputs: &[TxInTemplate::Bogus],
959+
outputs: &[TxOutTemplate::new(18_000, Some(1))],
960+
assume_canonical: true,
961+
..Default::default()
962+
},
963+
],
964+
exp_chain_txs: HashSet::from(["assumed_a", "assumed_b"]),
965+
exp_chain_txouts: HashSet::from([("assumed_a", 0), ("assumed_b", 0)]),
966+
exp_unspents: HashSet::from([("assumed_a", 0), ("assumed_b", 0)]),
967+
exp_balance: Balance {
968+
immature: Amount::ZERO,
969+
trusted_pending: Amount::from_sat(21_000 + 18_000),
970+
untrusted_pending: Amount::ZERO,
971+
confirmed: Amount::ZERO,
972+
},
973+
},
946974
Scenario {
947975
name: "coinbase tx must not become unconfirmed",
948976
tx_templates: &[

0 commit comments

Comments
 (0)