@@ -581,7 +581,6 @@ func (wp *wsPeer) readLoop() {
581581 networkP2PReceivedBytesByTag .Add (string (tag [:]), uint64 (len (msg .Data )+ 2 ))
582582 networkP2PMessageReceivedByTag .Add (string (tag [:]), 1 )
583583 }
584- originalTag := msg .Tag
585584 msg .Data , err = wp .msgCodec .decompress (msg .Tag , msg .Data )
586585 if err != nil {
587586 // Handle VP errors by sending abort message and continuing
@@ -607,7 +606,7 @@ func (wp *wsPeer) readLoop() {
607606 } else {
608607 networkP2PReceivedUncompressedBytesByTag .Add (string (msg .Tag ), uint64 (len (msg .Data )+ 2 ))
609608 }
610- if originalTag == protocol .VotePackedTag {
609+ if msg . Tag == protocol .VotePackedTag { // re-tag decompressed VP as AV
611610 msg .Tag = protocol .AgreementVoteTag
612611 }
613612 msg .Sender = wp
@@ -1148,12 +1147,6 @@ func (wp *wsPeer) vpackStatefulCompressionSupported() bool {
11481147// getBestVpackTableSize returns the negotiated table size.
11491148// This calculates the minimum between our max size and the peer's advertised max size.
11501149func (wp * wsPeer ) getBestVpackTableSize () uint {
1151- // Get our max size
1152- ourMaxSize := wp .voteCompressionTableSize
1153- if ourMaxSize == 0 {
1154- return 0
1155- }
1156-
11571150 // Get peer's max size from their features
11581151 var peerMaxSize uint
11591152 switch {
@@ -1174,10 +1167,11 @@ func (wp *wsPeer) getBestVpackTableSize() uint {
11741167 case wp .features & pfCompressedVoteVpackStateful16 != 0 :
11751168 peerMaxSize = 16
11761169 default :
1177- return 0 // Peer doesn't support stateful vote compression
1170+ peerMaxSize = 0 // Peer doesn't support stateful vote compression
11781171 }
11791172
1180- return min (ourMaxSize , peerMaxSize )
1173+ // Return the minimum between our max size and peer's max size
1174+ return min (wp .voteCompressionTableSize , peerMaxSize )
11811175}
11821176
11831177//msgp:ignore peerFeatureFlag
0 commit comments