From 1e8a19ac3724186df80283b668a4c9d5cbf75992 Mon Sep 17 00:00:00 2001 From: "alex.sharov" Date: Thu, 5 Aug 2021 09:30:59 +0700 Subject: [PATCH] broadcast loop --- txpool/pool_fuzz_test.go | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/txpool/pool_fuzz_test.go b/txpool/pool_fuzz_test.go index 8e17892bc..c4cf58008 100644 --- a/txpool/pool_fuzz_test.go +++ b/txpool/pool_fuzz_test.go @@ -113,6 +113,15 @@ func poolsFromFuzzBytes(rawTxNonce, rawValues, rawSender, rawSenderNonce, rawSen if len(rawSender)/20 != len(rawSenderBalance)/32 { return nil, nil, txs, false } + senderNonce, ok := u64Slice(rawSenderNonce) + if !ok { + return nil, nil, txs, false + } + for i := 0; i < len(senderNonce); i++ { + if senderNonce[i] == 0 { + return nil, nil, txs, false + } + } txNonce, ok := u64Slice(rawTxNonce) if !ok { @@ -122,10 +131,6 @@ func poolsFromFuzzBytes(rawTxNonce, rawValues, rawSender, rawSenderNonce, rawSen if !ok { return nil, nil, txs, false } - senderNonce, ok := u64Slice(rawSenderNonce) - if !ok { - return nil, nil, txs, false - } senderBalance, ok := u256Slice(rawSenderBalance) if !ok { return nil, nil, txs, false @@ -133,9 +138,9 @@ func poolsFromFuzzBytes(rawTxNonce, rawValues, rawSender, rawSenderNonce, rawSen sendersInfo = map[uint64]*senderInfo{} senderIDs = map[string]uint64{} - for i := 0; i < len(rawSender); i += 20 { + for i := 0; i < len(senderNonce); i++ { sendersInfo[uint64(i)] = newSenderInfo(senderNonce[i], senderBalance[i]) - senderIDs[string(rawSender[i:i+20])] = uint64(i) + senderIDs[string(rawSender[i*20:(i+1)*20])] = uint64(i) } for i := range txNonce { txs.txs = append(txs.txs, &TxSlot{