mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
eth/fetcher: relax eth/68 validation a bit for flakey clients
This commit is contained in:
parent
3c6a45e537
commit
4a0d6cac97
1 changed files with 17 additions and 2 deletions
|
|
@ -20,6 +20,7 @@ import (
|
|||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
"math"
|
||||
mrand "math/rand"
|
||||
"sort"
|
||||
"time"
|
||||
|
|
@ -581,9 +582,16 @@ func (f *TxFetcher) loop() {
|
|||
f.dropPeer(peer)
|
||||
} else if delivery.metas[i].size != meta.size {
|
||||
log.Warn("Announced transaction size mismatch", "peer", peer, "tx", hash, "size", delivery.metas[i].size, "ann", meta.size)
|
||||
if math.Abs(float64(delivery.metas[i].size)-float64(meta.size)) > 8 {
|
||||
// Normally we should drop a peer considering this is a protocol violation.
|
||||
// However, due to the RLP vs consensus format messyness, allow a few bytes
|
||||
// wiggle-room where we only warn, but don't drop.
|
||||
//
|
||||
// TODO(karalabe): Get rid of this relaxation when clients are proven stable.
|
||||
f.dropPeer(peer)
|
||||
}
|
||||
}
|
||||
}
|
||||
delete(txset, hash)
|
||||
if len(txset) == 0 {
|
||||
delete(f.waitslots, peer)
|
||||
|
|
@ -599,9 +607,16 @@ func (f *TxFetcher) loop() {
|
|||
f.dropPeer(peer)
|
||||
} else if delivery.metas[i].size != meta.size {
|
||||
log.Warn("Announced transaction size mismatch", "peer", peer, "tx", hash, "size", delivery.metas[i].size, "ann", meta.size)
|
||||
if math.Abs(float64(delivery.metas[i].size)-float64(meta.size)) > 8 {
|
||||
// Normally we should drop a peer considering this is a protocol violation.
|
||||
// However, due to the RLP vs consensus format messyness, allow a few bytes
|
||||
// wiggle-room where we only warn, but don't drop.
|
||||
//
|
||||
// TODO(karalabe): Get rid of this relaxation when clients are proven stable.
|
||||
f.dropPeer(peer)
|
||||
}
|
||||
}
|
||||
}
|
||||
delete(txset, hash)
|
||||
if len(txset) == 0 {
|
||||
delete(f.announces, peer)
|
||||
|
|
|
|||
Loading…
Reference in a new issue