@@ -114,7 +114,7 @@ var errTerminated = errors.New("terminated")
114
114
type txAnnounce struct {
115
115
origin string // Identifier of the peer originating the notification
116
116
hashes []common.Hash // Batch of transaction hashes being announced
117
- metas []* txMetadata // Batch of metadatas associated with the hashes (nil before eth/68)
117
+ metas []* txMetadata // Batch of metadata associated with the hashes
118
118
}
119
119
120
120
// txMetadata is a set of extra data transmitted along the announcement for better
@@ -137,7 +137,7 @@ type txRequest struct {
137
137
type txDelivery struct {
138
138
origin string // Identifier of the peer originating the notification
139
139
hashes []common.Hash // Batch of transaction hashes having been delivered
140
- metas []txMetadata // Batch of metadatas associated with the delivered hashes
140
+ metas []txMetadata // Batch of metadata associated with the delivered hashes
141
141
direct bool // Whether this is a direct reply or a broadcast
142
142
}
143
143
@@ -260,11 +260,11 @@ func (f *TxFetcher) Notify(peer string, types []byte, sizes []uint32, hashes []c
260
260
underpriced ++
261
261
default :
262
262
unknownHashes = append (unknownHashes , hash )
263
- if types == nil {
264
- unknownMetas = append ( unknownMetas , nil )
265
- } else {
266
- unknownMetas = append ( unknownMetas , & txMetadata { kind : types [ i ], size : sizes [ i ]})
267
- }
263
+
264
+ // Transaction metadata has been available since eth68, and all
265
+ // legacy eth protocols (prior to eth68) have been deprecated.
266
+ // Therefore, metadata is always expected in the announcement.
267
+ unknownMetas = append ( unknownMetas , & txMetadata { kind : types [ i ], size : sizes [ i ]})
268
268
}
269
269
}
270
270
txAnnounceKnownMeter .Mark (duplicate )
@@ -892,13 +892,8 @@ func (f *TxFetcher) scheduleFetches(timer *mclock.Timer, timeout chan struct{},
892
892
if len (hashes ) >= maxTxRetrievals {
893
893
return false // break in the for-each
894
894
}
895
- if meta != nil { // Only set eth/68 and upwards
896
- bytes += uint64 (meta .size )
897
- if bytes >= maxTxRetrievalSize {
898
- return false
899
- }
900
- }
901
- return true // scheduled, try to add more
895
+ bytes += uint64 (meta .size )
896
+ return bytes < maxTxRetrievalSize
902
897
})
903
898
// If any hashes were allocated, request them from the peer
904
899
if len (hashes ) > 0 {
0 commit comments