Allow fallback names for protocols (#8682)

* Allow fallback names for protocols

* Apply suggestions from code review

Co-authored-by: Roman Proskuryakov <humbug@deeptown.org>

* Fix some issues

* Fix compilation after merging master

Co-authored-by: Roman Proskuryakov <humbug@deeptown.org>
This commit is contained in:
Pierre Krieger
2021-05-06 16:01:01 +02:00
committed by GitHub
parent db69eb04bb
commit 62650989a3
18 changed files with 340 additions and 115 deletions
+2 -1
View File
@@ -136,6 +136,7 @@ impl TransactionsHandlerPrototype {
pub fn set_config(&self) -> config::NonDefaultSetConfig {
config::NonDefaultSetConfig {
notifications_protocol: self.protocol_name.clone(),
fallback_names: Vec::new(),
max_notification_size: MAX_TRANSACTIONS_SIZE,
set_config: config::SetConfig {
in_peers: 0,
@@ -318,7 +319,7 @@ impl<B: BlockT + 'static, H: ExHashT> TransactionsHandler<B, H> {
}
},
Event::NotificationStreamOpened { remote, protocol, role } if protocol == self.protocol_name => {
Event::NotificationStreamOpened { remote, protocol, role, .. } if protocol == self.protocol_name => {
let _was_in = self.peers.insert(remote, Peer {
known_transactions: LruHashSet::new(NonZeroUsize::new(MAX_KNOWN_TRANSACTIONS)
.expect("Constant is nonzero")),