mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-18 02:40:45 +00:00
remove caculate uncle block XDPoS
This commit is contained in:
parent
6ad335097c
commit
e2e75095ea
1 changed files with 29 additions and 24 deletions
|
|
@ -289,10 +289,11 @@ func (self *worker) update() {
|
||||||
|
|
||||||
// Handle ChainSideEvent
|
// Handle ChainSideEvent
|
||||||
case ev := <-self.chainSideCh:
|
case ev := <-self.chainSideCh:
|
||||||
|
if self.config.XDPoS == nil {
|
||||||
self.uncleMu.Lock()
|
self.uncleMu.Lock()
|
||||||
self.possibleUncles[ev.Block.Hash()] = ev.Block
|
self.possibleUncles[ev.Block.Hash()] = ev.Block
|
||||||
self.uncleMu.Unlock()
|
self.uncleMu.Unlock()
|
||||||
|
}
|
||||||
// Handle TxPreEvent
|
// Handle TxPreEvent
|
||||||
case ev := <-self.txCh:
|
case ev := <-self.txCh:
|
||||||
// Apply transaction to the pending state if we're not mining
|
// Apply transaction to the pending state if we're not mining
|
||||||
|
|
@ -447,6 +448,7 @@ func (self *worker) makeCurrent(parent *types.Block, header *types.Header) error
|
||||||
createdAt: time.Now(),
|
createdAt: time.Now(),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if self.config.XDPoS == nil {
|
||||||
// when 08 is processed ancestors contain 07 (quick block)
|
// when 08 is processed ancestors contain 07 (quick block)
|
||||||
for _, ancestor := range self.chain.GetBlocksFromHash(parent.Hash(), 7) {
|
for _, ancestor := range self.chain.GetBlocksFromHash(parent.Hash(), 7) {
|
||||||
for _, uncle := range ancestor.Uncles() {
|
for _, uncle := range ancestor.Uncles() {
|
||||||
|
|
@ -455,6 +457,7 @@ func (self *worker) makeCurrent(parent *types.Block, header *types.Header) error
|
||||||
work.family.Add(ancestor.Hash())
|
work.family.Add(ancestor.Hash())
|
||||||
work.ancestors.Add(ancestor.Hash())
|
work.ancestors.Add(ancestor.Hash())
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Keep track of transactions which return errors so they can be removed
|
// Keep track of transactions which return errors so they can be removed
|
||||||
work.tcount = 0
|
work.tcount = 0
|
||||||
|
|
@ -608,6 +611,7 @@ func (self *worker) commitNewWork() {
|
||||||
uncles []*types.Header
|
uncles []*types.Header
|
||||||
badUncles []common.Hash
|
badUncles []common.Hash
|
||||||
)
|
)
|
||||||
|
if self.config.XDPoS == nil {
|
||||||
for hash, uncle := range self.possibleUncles {
|
for hash, uncle := range self.possibleUncles {
|
||||||
if len(uncles) == 2 {
|
if len(uncles) == 2 {
|
||||||
break
|
break
|
||||||
|
|
@ -625,6 +629,7 @@ func (self *worker) commitNewWork() {
|
||||||
for _, hash := range badUncles {
|
for _, hash := range badUncles {
|
||||||
delete(self.possibleUncles, hash)
|
delete(self.possibleUncles, hash)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// Create the new block to seal with the consensus engine
|
// Create the new block to seal with the consensus engine
|
||||||
if work.Block, err = self.engine.Finalize(self.chain, header, work.state, work.txs, uncles, work.receipts); err != nil {
|
if work.Block, err = self.engine.Finalize(self.chain, header, work.state, work.txs, uncles, work.receipts); err != nil {
|
||||||
log.Error("Failed to finalize block for sealing", "err", err)
|
log.Error("Failed to finalize block for sealing", "err", err)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue