Skip to content

Commit

Permalink
review fix: clarify some comments
Browse files Browse the repository at this point in the history
  • Loading branch information
shamardy committed Oct 2, 2024
1 parent cdfd809 commit 860544f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions mm2src/mm2_main/src/lp_ordermatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ fn process_maker_order_cancelled(
}
} else {
// Add the order to the recently cancelled list to ignore it
// if a new order with the same uuid is received within the RECENTLY_CANCELLED_TIMEOUT timeframe
// if a new order with the same uuid is received within the `RECENTLY_CANCELLED_TIMEOUT` timeframe
// We only do this if the order is not in the order_set, because if it is, it means that the order was already
// created and messages did arrive in the correct order
orderbook.recently_cancelled.insert(uuid, from_pubkey);
Expand Down Expand Up @@ -2512,7 +2512,8 @@ struct Orderbook {
/// a map of orderbook states of known maker pubkeys
pubkeys_state: HashMap<String, OrderbookPubkeyState>,
/// The `TimeCache` of recently canceled orders, mapping `Uuid` to the maker pubkey as `String`,
/// used to avoid order recreation in case of out of order p2p messages.
/// used to avoid order recreation in case of out-of-order p2p messages,
/// e.g., when receiving the order cancellation message before the order is created.
/// Entries are kept for `RECENTLY_CANCELLED_TIMEOUT` seconds.
recently_cancelled: TimeCache<Uuid, String>,
topics_subscribed_to: HashMap<String, OrderbookRequestingState>,
Expand Down
2 changes: 1 addition & 1 deletion mm2src/mm2_main/tests/mm2_tests/mm2_tests_inner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1564,7 +1564,7 @@ fn test_cancel_order() {
assert_eq!(alice_orderbook.asks.len(), 0, "Alice RICK/MORTY asks are not empty");
}

/// This also covers recently canceled orders implementation.
/// This also covers the case where order creation/cancellation messages are received out of sequence.
/// The cancellation message sometimes arrives to Alice before the order creation message,
/// in this case Alice gets the order creation message from p2p cache using IHAVE / IWANT control messages.
#[test]
Expand Down

0 comments on commit 860544f

Please sign in to comment.