diff --git a/core/blockchain.go b/core/blockchain.go index 7f476fe595..2ca1e2fc7b 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -532,8 +532,12 @@ func (bc *BlockChain) loadLastState() error { // was fast synced or full synced and in which state, the method will try to // delete minimal data from disk whilst retaining chain consistency. func (bc *BlockChain) SetHead(head uint64) error { - _, err := bc.setHeadBeyondRoot(head, common.Hash{}, false) - return err + if _, err := bc.setHeadBeyondRoot(head, common.Hash{}, false); err != nil { + return err + } + // Send chain head event to update the transaction pool + bc.chainHeadFeed.Send(ChainHeadEvent{Block: bc.CurrentBlock()}) + return nil } // SetFinalized sets the finalized block. diff --git a/ethclient/gethclient/gethclient_test.go b/ethclient/gethclient/gethclient_test.go index e60490c616..ef84d71559 100644 --- a/ethclient/gethclient/gethclient_test.go +++ b/ethclient/gethclient/gethclient_test.go @@ -118,9 +118,6 @@ func TestGethClient(t *testing.T) { }, { "TestGetNodeInfo", func(t *testing.T) { testGetNodeInfo(t, client) }, - }, { - "TestSetHead", - func(t *testing.T) { testSetHead(t, client) }, }, { "TestSubscribePendingTxHashes", func(t *testing.T) { testSubscribePendingTransactions(t, client) }, @@ -138,6 +135,9 @@ func TestGethClient(t *testing.T) { { "TestAccessList", func(t *testing.T) { testAccessList(t, client) }, + }, { + "TestSetHead", + func(t *testing.T) { testSetHead(t, client) }, }, } for _, tt := range tests {