Skip to content

Commit

Permalink
Add some debug_asserts for paritytech#8171 (paritytech#8181)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomaka authored and jam10o-new committed Feb 28, 2021
1 parent a8cf203 commit 4dca913
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions client/network/src/transactions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,14 +319,16 @@ impl<B: BlockT + 'static, H: ExHashT> TransactionsHandler<B, H> {
},

Event::NotificationStreamOpened { remote, protocol, role } if protocol == self.protocol_name => {
self.peers.insert(remote, Peer {
let _was_in = self.peers.insert(remote, Peer {
known_transactions: LruHashSet::new(NonZeroUsize::new(MAX_KNOWN_TRANSACTIONS)
.expect("Constant is nonzero")),
role,
});
debug_assert!(_was_in.is_none());
}
Event::NotificationStreamClosed { remote, protocol } if protocol == self.protocol_name => {
self.peers.remove(&remote);
let _peer = self.peers.remove(&remote);
debug_assert!(_peer.is_some());
}

Event::NotificationsReceived { remote, messages } => {
Expand Down

0 comments on commit 4dca913

Please sign in to comment.