Browse Source

Don't panic on unexpected messages

This is actually a security bug as it would allow remote triggers
of panics!
fix-olivia-event-id
Thomas Eizinger 3 years ago
parent
commit
00883af0a9
No known key found for this signature in database GPG Key ID: 651AC83A6C6C8B96
  1. 6
      daemon/src/maker_cfd.rs
  2. 4
      daemon/src/taker_cfd.rs

6
daemon/src/maker_cfd.rs

@ -154,9 +154,9 @@ impl Actor {
SetupState::Active { taker, .. } => {
anyhow::bail!("Currently setting up contract with taker {}", taker)
}
SetupState::None => unreachable!(
"`SetupState` is guaranteed to be `Active` before anyone sends a message"
),
SetupState::None => {
anyhow::bail!("Received setup message without an active contract setup");
}
}
Ok(())

4
daemon/src/taker_cfd.rs

@ -220,7 +220,9 @@ impl Actor {
SetupState::Active { sender } => {
sender.send(msg).await?;
}
SetupState::None => anyhow::bail!("OrderAccepted message should arrive first"),
SetupState::None => {
anyhow::bail!("Received setup message without an active contract setup")
}
}
Ok(())

Loading…
Cancel
Save