Skip to content

Commit 1b3ab73

Browse files
committed
simplify
1 parent 0d5303f commit 1b3ab73

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

network/wsNetwork.go

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1194,24 +1194,20 @@ func (wn *WebsocketNetwork) maybeSendMessagesOfInterest(peer *wsPeer, messagesOf
11941194
if sendEnc == nil {
11951195
sendEnc = wn.messagesOfInterestEnc
11961196
}
1197-
if !peerSupportsStatefulCompression {
1197+
if !peerSupportsStatefulCompression && wn.messagesOfInterest[protocol.VotePackedTag] {
11981198
// Filter VP tag for peers lacking stateful compression support; older nodes (<= v4.3)
11991199
// treat unknown tags as protocol violations and disconnect.
1200-
if wn.messagesOfInterest[protocol.VotePackedTag] {
1201-
perPeerTags = make(map[protocol.Tag]bool, len(wn.messagesOfInterest))
1202-
for tag, flag := range wn.messagesOfInterest {
1203-
if tag == protocol.VotePackedTag {
1204-
continue
1205-
}
1206-
perPeerTags[tag] = flag
1200+
perPeerTags = make(map[protocol.Tag]bool, len(wn.messagesOfInterest))
1201+
for tag, flag := range wn.messagesOfInterest {
1202+
if tag == protocol.VotePackedTag {
1203+
continue
12071204
}
1205+
perPeerTags[tag] = flag
12081206
}
1207+
sendEnc = marshallMessageOfInterestMap(perPeerTags)
12091208
}
12101209
wn.messagesOfInterestMu.Unlock()
12111210
}
1212-
if perPeerTags != nil {
1213-
sendEnc = marshallMessageOfInterestMap(perPeerTags)
1214-
}
12151211
if sendEnc != nil {
12161212
peer.sendMessagesOfInterest(messagesOfInterestGeneration, sendEnc)
12171213
} else {

0 commit comments

Comments
 (0)