mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2024-10-01 01:45:40 -04:00
Only break if Bob has requested amounts already
We don't want Bob to be able to crash us by sending an out of order message. Only break if Bob has not requested amounts.
This commit is contained in:
parent
5da84a3d48
commit
b8130d23a6
@ -51,10 +51,13 @@ pub async fn swap(
|
|||||||
swarm.send_amounts(channel, p);
|
swarm.send_amounts(channel, p);
|
||||||
}
|
}
|
||||||
OutEvent::Message0(msg) => {
|
OutEvent::Message0(msg) => {
|
||||||
debug!("Got message0 from Bob");
|
// We don't want Bob to be able to crash us by sending an out of
|
||||||
// TODO: Do this in a more Rusty/functional way.
|
// order message. Keep looping if Bob has not requested amounts.
|
||||||
message0 = msg;
|
if last_amounts.is_some() {
|
||||||
break;
|
// TODO: We should verify the amounts and notify Bob if they have changed.
|
||||||
|
message0 = msg;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
other => panic!("Unexpected event: {:?}", other),
|
other => panic!("Unexpected event: {:?}", other),
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user