Skip to content

Commit 6aba330

Browse files
committed
fix: gracefully handle reveal_to_target
This fixes a potential panic in `create_tx` by removing the use of `.expect`. This way we can handle a possible `index_changeset` without relying on the implementation of `reveal_to_target`.
1 parent 741f2ae commit 6aba330

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

wallet/src/wallet/mod.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1593,13 +1593,12 @@ impl Wallet {
15931593

15941594
// recording changes to the change keychain
15951595
if let (Excess::Change { .. }, Some((keychain, index))) = (excess, drain_index) {
1596-
let (_, index_changeset) = self
1597-
.indexed_graph
1598-
.index
1599-
.reveal_to_target(keychain, index)
1600-
.expect("must not be None");
1601-
self.stage.merge(index_changeset.into());
1602-
self.mark_used(keychain, index);
1596+
if let Some((_, index_changeset)) =
1597+
self.indexed_graph.index.reveal_to_target(keychain, index)
1598+
{
1599+
self.stage.merge(index_changeset.into());
1600+
self.mark_used(keychain, index);
1601+
}
16031602
}
16041603

16051604
Ok(psbt)

0 commit comments

Comments
 (0)