mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-11 14:33:52 +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.Root = state.IntermediateRoot(chain.Config().IsEIP158(header.Number))
|
||||||
header.UncleHash = types.CalcUncleHash(nil)
|
header.UncleHash = types.CalcUncleHash(nil)
|
||||||
header.SetStateSync(stateSyncData)
|
header.SetStateSync(stateSyncData)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// FinalizeAndAssemble implements consensus.Engine, ensuring no uncles are set,
|
// FinalizeAndAssemble implements consensus.Engine, ensuring no uncles are set,
|
||||||
|
|
|
||||||
|
|
@ -1542,10 +1542,6 @@ func (bc *BlockChain) writeBlockWithState(block *types.Block, receipts []*types.
|
||||||
if emitHeadEvent {
|
if emitHeadEvent {
|
||||||
bc.chainHeadFeed.Send(ChainHeadEvent{Block: block})
|
bc.chainHeadFeed.Send(ChainHeadEvent{Block: block})
|
||||||
}
|
}
|
||||||
syncData := block.StateSyncData()
|
|
||||||
for _, data := range syncData {
|
|
||||||
bc.stateSyncFeed.Send(StateSyncEvent{StateData: data})
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
bc.chainSideFeed.Send(ChainSideEvent{Block: block})
|
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
|
// Process block using the parent state as reference point
|
||||||
substart := time.Now()
|
substart := time.Now()
|
||||||
receipts, logs, usedGas, err := bc.processor.Process(block, statedb, bc.vmConfig)
|
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 {
|
if err != nil {
|
||||||
bc.reportBlock(block, receipts, err)
|
bc.reportBlock(block, receipts, err)
|
||||||
atomic.StoreUint32(&followupInterrupt, 1)
|
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)
|
// Finalize the block, applying any consensus engine specific extras (e.g. block rewards)
|
||||||
p.engine.Finalize(p.bc, header, statedb, block.Transactions(), block.Uncles())
|
p.engine.Finalize(p.bc, header, statedb, block.Transactions(), block.Uncles())
|
||||||
|
block.SetStateSync(header.StateData())
|
||||||
return receipts, allLogs, *usedGas, nil
|
return receipts, allLogs, *usedGas, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -114,8 +114,18 @@ func (h *Header) Size() common.StorageSize {
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetStateSync set sync data in block
|
// SetStateSync set sync data in block
|
||||||
func (b *Header) SetStateSync(stateData []*StateData) {
|
func (h *Header) SetStateSync(stateData []*StateData) {
|
||||||
b.stateSyncData = 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
|
// 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.
|
// Block represents an entire block in the Ethereum blockchain.
|
||||||
type Block struct {
|
type Block struct {
|
||||||
header *Header
|
header *Header
|
||||||
uncles []*Header
|
uncles []*Header
|
||||||
transactions Transactions
|
transactions Transactions
|
||||||
|
stateSyncData []*StateData
|
||||||
|
|
||||||
// caches
|
// caches
|
||||||
hash atomic.Value
|
hash atomic.Value
|
||||||
size 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) GasUsed() uint64 { return b.header.GasUsed }
|
||||||
func (b *Block) Difficulty() *big.Int { return new(big.Int).Set(b.header.Difficulty) }
|
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) 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) NumberU64() uint64 { return b.header.Number.Uint64() }
|
||||||
func (b *Block) MixDigest() common.Hash { return b.header.MixDigest }
|
func (b *Block) MixDigest() common.Hash { return b.header.MixDigest }
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue