Skip to content

Commit

Permalink
swapd: checkme, fixed pattern match to avoid failing unwrap
Browse files Browse the repository at this point in the history
treating as if the bug is on the pop unwrap, since the expect is checked

2022-07-17T13:13:23.6366705Z [2022-07-17T13:13:23Z DEBUG microservices::esb::controller] syncer<(Monero,Local)> -> swap<0x8478…a469>: syncer_event(TransactionConfirmations(TransactionConfirmations { id: TaskId(1
1), block: [178, 67, 8, 101, 245, 54, 2, 17, 91, 42, 117, 121, 49, 102, 1, 0, 114, 0, 189, 96, 58, 32, 16, 52, 132, 231, 198, 83, 77, 42, 7, 187], confirmations: Some(20), tx: [] }))
2022-07-17T13:13:23.6368099Z thread 'main' panicked at 'Checked above', src/swapd/runtime.rs:1239:30
2022-07-17T13:13:23.6368705Z note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
  • Loading branch information
zkao committed Jul 18, 2022
1 parent 1ca94b5 commit 38ad945
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/swapd/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1223,10 +1223,15 @@ impl Runtime {
Event::TransactionConfirmations(TransactionConfirmations {
confirmations: Some(confirmations),
..
}) if self.state.b_buy_sig()
|| (self.state.a_refundsig() && self.state.a_xmr_locked())
&& *confirmations >= self.temporal_safety.sweep_monero_thr
&& self.pending_requests().contains_key(&source) =>
}) if (self.state.b_buy_sig()
|| (self.state.a_refundsig() && self.state.a_xmr_locked()))
&& *confirmations >= self.temporal_safety.sweep_monero_thr
&& self.pending_requests().contains_key(&source)
&& self
.pending_requests()
.get(&source)
.map(|r| r.len() > 0)
.unwrap_or(false) =>
{
let PendingRequest {
source,
Expand Down

0 comments on commit 38ad945

Please sign in to comment.