diff --git a/cmd/rpcdaemon/commands/txpool_api_test.go b/cmd/rpcdaemon/commands/txpool_api_test.go index a59bb00cd8b515014da8706faed3bdae14c9035d..d91a7b2202a7591f21d043b26d9fa9987317f983 100644 --- a/cmd/rpcdaemon/commands/txpool_api_test.go +++ b/cmd/rpcdaemon/commands/txpool_api_test.go @@ -2,11 +2,9 @@ package commands import ( "bytes" - "math/big" "testing" "github.com/holiman/uint256" - "github.com/ledgerwatch/erigon-lib/gointerfaces/sentry" "github.com/ledgerwatch/erigon-lib/gointerfaces/txpool" "github.com/ledgerwatch/erigon-lib/kv/kvcache" "github.com/ledgerwatch/erigon/cmd/rpcdaemon/filters" @@ -16,50 +14,19 @@ import ( "github.com/ledgerwatch/erigon/common/u256" "github.com/ledgerwatch/erigon/core" "github.com/ledgerwatch/erigon/core/types" - "github.com/ledgerwatch/erigon/eth/protocols/eth" "github.com/ledgerwatch/erigon/params" - "github.com/ledgerwatch/erigon/rlp" "github.com/ledgerwatch/erigon/turbo/stages" "github.com/stretchr/testify/require" ) func TestTxPoolContent(t *testing.T) { - t.Skipf("will restore now") m, require := stages.Mock(t), require.New(t) chain, err := core.GenerateChain(m.ChainConfig, m.Genesis, m.Engine, m.DB, 1, func(i int, b *core.BlockGen) { b.SetCoinbase(common.Address{1}) }, false /* intemediateHashes */) require.NoError(err) - { // Do 1 step to start txPool - - // Send NewBlock message - b, err := rlp.EncodeToBytes(ð.NewBlockPacket{ - Block: chain.TopBlock, - TD: big.NewInt(1), // This is ignored anyway - }) - require.NoError(err) - m.ReceiveWg.Add(1) - for _, err = range m.Send(&sentry.InboundMessage{Id: sentry.MessageId_NEW_BLOCK_66, Data: b, PeerId: m.PeerId}) { - require.NoError(err) - } - // Send all the headers - b, err = rlp.EncodeToBytes(ð.BlockHeadersPacket66{ - RequestId: 1, - BlockHeadersPacket: chain.Headers, - }) - require.NoError(err) - m.ReceiveWg.Add(1) - for _, err = range m.Send(&sentry.InboundMessage{Id: sentry.MessageId_BLOCK_HEADERS_66, Data: b, PeerId: m.PeerId}) { - require.NoError(err) - } - m.ReceiveWg.Wait() // Wait for all messages to be processed before we proceeed - - initialCycle := true - highestSeenHeader := chain.TopBlock.NumberU64() - if err := stages.StageLoopStep(m.Ctx, m.DB, m.Sync, highestSeenHeader, m.Notifications, initialCycle, m.UpdateHead, nil); err != nil { - t.Fatal(err) - } - } + err = m.InsertChain(chain) + require.NoError(err) ctx, conn := rpcdaemontest.CreateTestGrpcConn(t, m) txPool := txpool.NewTxpoolClient(conn)