mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-28 07:36:44 +00:00
Fix: broadcast deposit event from non-validator node
This commit is contained in:
parent
eec8916845
commit
38ebecb2fa
4 changed files with 24 additions and 12 deletions
|
|
@ -680,7 +680,6 @@ func (c *Bor) Finalize(chain consensus.ChainReader, header *types.Header, state
|
|||
header.Root = state.IntermediateRoot(chain.Config().IsEIP158(header.Number))
|
||||
header.UncleHash = types.CalcUncleHash(nil)
|
||||
header.SetStateSync(stateSyncData)
|
||||
|
||||
}
|
||||
|
||||
// FinalizeAndAssemble implements consensus.Engine, ensuring no uncles are set,
|
||||
|
|
|
|||
|
|
@ -1542,10 +1542,6 @@ func (bc *BlockChain) writeBlockWithState(block *types.Block, receipts []*types.
|
|||
if emitHeadEvent {
|
||||
bc.chainHeadFeed.Send(ChainHeadEvent{Block: block})
|
||||
}
|
||||
syncData := block.StateSyncData()
|
||||
for _, data := range syncData {
|
||||
bc.stateSyncFeed.Send(StateSyncEvent{StateData: data})
|
||||
}
|
||||
} else {
|
||||
bc.chainSideFeed.Send(ChainSideEvent{Block: block})
|
||||
}
|
||||
|
|
@ -1797,6 +1793,11 @@ func (bc *BlockChain) insertChain(chain types.Blocks, verifySeals bool) (int, er
|
|||
// Process block using the parent state as reference point
|
||||
substart := time.Now()
|
||||
receipts, logs, usedGas, err := bc.processor.Process(block, statedb, bc.vmConfig)
|
||||
syncData := block.StateSyncData()
|
||||
|
||||
for _, data := range syncData {
|
||||
bc.stateSyncFeed.Send(StateSyncEvent{StateData: data})
|
||||
}
|
||||
if err != nil {
|
||||
bc.reportBlock(block, receipts, err)
|
||||
atomic.StoreUint32(&followupInterrupt, 1)
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ func (p *StateProcessor) Process(block *types.Block, statedb *state.StateDB, cfg
|
|||
}
|
||||
// Finalize the block, applying any consensus engine specific extras (e.g. block rewards)
|
||||
p.engine.Finalize(p.bc, header, statedb, block.Transactions(), block.Uncles())
|
||||
|
||||
block.SetStateSync(header.StateData())
|
||||
return receipts, allLogs, *usedGas, nil
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -114,8 +114,18 @@ func (h *Header) Size() common.StorageSize {
|
|||
}
|
||||
|
||||
// SetStateSync set sync data in block
|
||||
func (b *Header) SetStateSync(stateData []*StateData) {
|
||||
b.stateSyncData = stateData
|
||||
func (h *Header) SetStateSync(stateData []*StateData) {
|
||||
h.stateSyncData = stateData
|
||||
}
|
||||
|
||||
// SetStateSync set sync data in block
|
||||
func (h *Block) SetStateSync(stateData []*StateData) {
|
||||
h.stateSyncData = stateData
|
||||
}
|
||||
|
||||
// StateSyncData set sync data in block
|
||||
func (h *Header) StateData() []*StateData {
|
||||
return h.stateSyncData
|
||||
}
|
||||
|
||||
// SanityCheck checks a few basic things -- these checks are way beyond what
|
||||
|
|
@ -162,9 +172,11 @@ type Body struct {
|
|||
|
||||
// Block represents an entire block in the Ethereum blockchain.
|
||||
type Block struct {
|
||||
header *Header
|
||||
uncles []*Header
|
||||
transactions Transactions
|
||||
header *Header
|
||||
uncles []*Header
|
||||
transactions Transactions
|
||||
stateSyncData []*StateData
|
||||
|
||||
// caches
|
||||
hash atomic.Value
|
||||
size atomic.Value
|
||||
|
|
@ -321,7 +333,7 @@ func (b *Block) GasLimit() uint64 { return b.header.GasLimit }
|
|||
func (b *Block) GasUsed() uint64 { return b.header.GasUsed }
|
||||
func (b *Block) Difficulty() *big.Int { return new(big.Int).Set(b.header.Difficulty) }
|
||||
func (b *Block) Time() uint64 { return b.header.Time }
|
||||
func (b *Block) StateSyncData() []*StateData { return b.header.stateSyncData }
|
||||
func (b *Block) StateSyncData() []*StateData { return b.stateSyncData }
|
||||
|
||||
func (b *Block) NumberU64() uint64 { return b.header.Number.Uint64() }
|
||||
func (b *Block) MixDigest() common.Hash { return b.header.MixDigest }
|
||||
|
|
|
|||
Loading…
Reference in a new issue