]> Untitled Git - bdk/commitdiff
feat(bdk): changeset's `Append` impl checks that network is consistent
author志宇 <hello@evanlinjin.me>
Mon, 6 Nov 2023 03:52:03 +0000 (11:52 +0800)
committer志宇 <hello@evanlinjin.me>
Wed, 15 Nov 2023 23:07:49 +0000 (07:07 +0800)
crates/bdk/src/wallet/mod.rs

index c9a1c28cb29efd6680bacd436d1b850823888d39..e396b8d4f6e667e0f15c480963d9cb43aad51b10 100644 (file)
@@ -138,6 +138,10 @@ impl Append for ChangeSet {
         Append::append(&mut self.chain, other.chain);
         Append::append(&mut self.indexed_tx_graph, other.indexed_tx_graph);
         if other.network.is_some() {
+            debug_assert!(
+                self.network.is_none() || self.network == other.network,
+                "network type must be consistent"
+            );
             self.network = other.network;
         }
     }