mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
tests/fuzzers/txfetcher: pull in suggestion from Marius
This commit is contained in:
parent
4a0d6cac97
commit
c44bcfb71b
1 changed files with 5 additions and 1 deletions
|
|
@ -117,6 +117,8 @@ func Fuzz(input []byte) int {
|
|||
var (
|
||||
announceIdxs = make([]int, announce)
|
||||
announces = make([]common.Hash, announce)
|
||||
types = make([]byte, announce)
|
||||
sizes = make([]uint32, announce)
|
||||
)
|
||||
for i := 0; i < len(announces); i++ {
|
||||
annBuf := make([]byte, 2)
|
||||
|
|
@ -125,11 +127,13 @@ func Fuzz(input []byte) int {
|
|||
}
|
||||
announceIdxs[i] = (int(annBuf[0])*256 + int(annBuf[1])) % len(txs)
|
||||
announces[i] = txs[announceIdxs[i]].Hash()
|
||||
types[i] = txs[announceIdxs[i]].Type()
|
||||
sizes[i] = uint32(txs[announceIdxs[i]].Size())
|
||||
}
|
||||
if verbose {
|
||||
fmt.Println("Notify", peer, announceIdxs)
|
||||
}
|
||||
if err := f.Notify(peer, nil, nil, announces); err != nil {
|
||||
if err := f.Notify(peer, types, sizes, announces); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue