diff --git a/core/blockchain.go b/core/blockchain.go index 7d4af6818..c09e14785 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -1155,7 +1155,6 @@ func (bc *BlockChain) WriteBlockWithState(block *types.Block, receipts []*types. // After insertion is done, all accumulated events will be fired. func (bc *BlockChain) InsertChain(chain types.Blocks, verifyHeaders bool) (int, error) { n, events, logs, err := bc.insertChain(chain, verifyHeaders) - bc.PostChainEvents(events, logs) if err == nil { for idx, block := range chain { header := block.Header() @@ -1197,6 +1196,7 @@ func (bc *BlockChain) InsertChain(chain types.Blocks, verifyHeaders bool) (int, } } + bc.PostChainEvents(events, logs) return n, err } diff --git a/core/tx_pool.go b/core/tx_pool.go index c1da5ca2e..57928aa6a 100644 --- a/core/tx_pool.go +++ b/core/tx_pool.go @@ -292,7 +292,7 @@ func (pool *TxPool) loop() { defer journal.Stop() // Track the previous head headers for transaction reorgs - //head := pool.chain.CurrentBlock() + head := pool.chain.CurrentBlock() // Keep waiting for and reacting to the various events for { @@ -301,12 +301,25 @@ func (pool *TxPool) loop() { case ev := <-pool.chainHeadCh: if ev.Block != nil { pool.mu.Lock() - //if pool.chainconfig.IsHomestead(ev.Block.Number()) { - // pool.homestead = true - //} - //pool.reset(head.Header(), ev.Block.Header()) - //head = ev.Block - + if pool.chainconfig.IsS3(ev.Block.Epoch()) { + pool.homestead = true + } + pool.reset(head.Header(), ev.Block.Header()) + head = ev.Block + + // DEBUG- + pending, queued := pool.stats() + stales := pool.priced.stales + + if pending != prevPending || queued != prevQueued || stales != prevStales { + utils.Logger().Debug(). + Int("executable", pending). + Int("queued", queued). + Int("stales", stales). + Msg("Transaction pool status report") + prevPending, prevQueued, prevStales = pending, queued, stales + } + // - pool.mu.Unlock() } // Be unsubscribed due to system stopped diff --git a/node/node_newblock.go b/node/node_newblock.go index 5991d80e3..4150ce208 100644 --- a/node/node_newblock.go +++ b/node/node_newblock.go @@ -82,6 +82,7 @@ func (node *Node) proposeNewBlock() (*types.Block, error) { // Update worker's current header and state data in preparation to propose/process new transactions coinbase := node.Consensus.SelfAddress + utils.Logger().Info().Msg("11111111111") // Prepare transactions including staking transactions\ pending, err := node.TxPool.Pending() if err != nil { @@ -89,6 +90,7 @@ func (node *Node) proposeNewBlock() (*types.Block, error) { return nil, err } + utils.Logger().Info().Msg("222222222222") // TODO: integrate staking transaction into tx pool pendingStakingTransactions := types2.StakingTransactions{} for _, tx := range node.pendingStakingTransactions { @@ -102,6 +104,7 @@ func (node *Node) proposeNewBlock() (*types.Block, error) { return nil, err } + utils.Logger().Info().Msg("33333333333333") // Prepare cross shard transaction receipts receiptsList := node.proposeReceiptsProof() if len(receiptsList) != 0 {