mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 02:42:27 +00:00
move cache to insert func
This commit is contained in:
parent
46c96249bf
commit
cd81c5c8b6
2 changed files with 6 additions and 1 deletions
|
|
@ -853,7 +853,7 @@ func (c *Posv) Finalize(chain consensus.ChainReader, header *types.Header, state
|
|||
number := header.Number.Uint64()
|
||||
rCheckpoint := chain.Config().Posv.RewardCheckpoint
|
||||
|
||||
_ = c.CacheData(header, txs, receipts)
|
||||
// _ = c.CacheData(header, txs, receipts)
|
||||
|
||||
if c.HookReward != nil && number%rCheckpoint == 0 {
|
||||
err, rewards := c.HookReward(chain, state, header)
|
||||
|
|
@ -1045,6 +1045,7 @@ func (c *Posv) CacheData(header *types.Header, txs []*types.Transaction, receipt
|
|||
}
|
||||
}
|
||||
|
||||
log.Debug("Save tx signers to cache", "hash", header.Hash().String(), "number", header.Number, "len(txs)", len(signTxs))
|
||||
c.BlockSigners.Add(header.Hash(), signTxs)
|
||||
|
||||
return nil
|
||||
|
|
|
|||
|
|
@ -506,6 +506,10 @@ func (bc *BlockChain) insert(block *types.Block) {
|
|||
}
|
||||
bc.currentBlock.Store(block)
|
||||
|
||||
// save cache BlockSigners
|
||||
engine := bc.Engine().(*posv.Posv)
|
||||
engine.CacheData(block.Header(), block.Transactions(), bc.GetReceiptsByHash(block.Hash()))
|
||||
|
||||
// If the block is better than our head or is on a different chain, force update heads
|
||||
if updateHeads {
|
||||
bc.hc.SetCurrentHeader(block.Header())
|
||||
|
|
|
|||
Loading…
Reference in a new issue