From 95f240d597eaa32ac51b70bbbc0a2882f4952ee1 Mon Sep 17 00:00:00 2001 From: "alex.sharov" <AskAlexSharov@gmail.com> Date: Mon, 25 Oct 2021 17:15:56 +0700 Subject: [PATCH] enable pool test --- cmd/rpcdaemon/commands/txpool_api_test.go | 37 ++--------------------- 1 file changed, 2 insertions(+), 35 deletions(-) diff --git a/cmd/rpcdaemon/commands/txpool_api_test.go b/cmd/rpcdaemon/commands/txpool_api_test.go index a59bb00cd8..d91a7b2202 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) -- GitLab