mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 18:32:23 +00:00
Merge branch 'master' of https://github.com/tomochain/tomochain into genesis
This commit is contained in:
commit
6fa126fca9
3 changed files with 21 additions and 21 deletions
|
|
@ -669,8 +669,8 @@ func (f *Fetcher) insert(peer string, block *types.Block) {
|
||||||
go f.broadcastBlock(block, true)
|
go f.broadcastBlock(block, true)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
block = newBlock
|
f.enqueue(peer,newBlock)
|
||||||
propBroadcastOutTimer.UpdateSince(block.ReceivedAt)
|
return
|
||||||
default:
|
default:
|
||||||
// Something went very wrong, drop the peer
|
// Something went very wrong, drop the peer
|
||||||
log.Debug("Propagated block verification failed", "peer", peer, "number", block.Number(), "hash", hash, "err", err)
|
log.Debug("Propagated block verification failed", "peer", peer, "number", block.Number(), "hash", hash, "err", err)
|
||||||
|
|
@ -693,7 +693,6 @@ func (f *Fetcher) insert(peer string, block *types.Block) {
|
||||||
|
|
||||||
// If import succeeded, broadcast the block
|
// If import succeeded, broadcast the block
|
||||||
propAnnounceOutTimer.UpdateSince(block.ReceivedAt)
|
propAnnounceOutTimer.UpdateSince(block.ReceivedAt)
|
||||||
go f.broadcastBlock(block, true)
|
|
||||||
go f.broadcastBlock(block, false)
|
go f.broadcastBlock(block, false)
|
||||||
|
|
||||||
}()
|
}()
|
||||||
|
|
|
||||||
|
|
@ -877,6 +877,7 @@ func (s *PublicBlockChainAPI) rpcOutputBlock(b *types.Block, inclTx bool, fullTx
|
||||||
if signer == masternode {
|
if signer == masternode {
|
||||||
countFinality++
|
countFinality++
|
||||||
filterSigners = append(filterSigners, masternode)
|
filterSigners = append(filterSigners, masternode)
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -337,6 +337,24 @@ func (self *worker) wait() {
|
||||||
if stat == core.CanonStatTy {
|
if stat == core.CanonStatTy {
|
||||||
events = append(events, core.ChainHeadEvent{Block: block})
|
events = append(events, core.ChainHeadEvent{Block: block})
|
||||||
}
|
}
|
||||||
|
if work.config.Posv != nil {
|
||||||
|
// epoch block
|
||||||
|
if (block.NumberU64() % work.config.Posv.Epoch) == 0 {
|
||||||
|
core.CheckpointCh <- 1
|
||||||
|
}
|
||||||
|
// prepare set of masternodes for the next epoch
|
||||||
|
if (block.NumberU64() % work.config.Posv.Epoch) == (work.config.Posv.Epoch - work.config.Posv.Gap) {
|
||||||
|
err := self.chain.UpdateM1()
|
||||||
|
if err != nil {
|
||||||
|
if err == core.ErrNotPoSV {
|
||||||
|
log.Error("Stopping node", "err", err)
|
||||||
|
os.Exit(1)
|
||||||
|
} else {
|
||||||
|
log.Error("Error when update masternodes set. Keep the current masternodes set for the next epoch.", "err", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
self.chain.PostChainEvents(events, logs)
|
self.chain.PostChainEvents(events, logs)
|
||||||
|
|
||||||
// Insert the block into the set of pending ones to wait for confirmations
|
// Insert the block into the set of pending ones to wait for confirmations
|
||||||
|
|
@ -590,24 +608,6 @@ func (self *worker) commitNewWork() {
|
||||||
log.Info("Commit new mining work", "number", work.Block.Number(), "txs", work.tcount, "special txs", len(specialTxs), "uncles", len(uncles), "elapsed", common.PrettyDuration(time.Since(tstart)))
|
log.Info("Commit new mining work", "number", work.Block.Number(), "txs", work.tcount, "special txs", len(specialTxs), "uncles", len(uncles), "elapsed", common.PrettyDuration(time.Since(tstart)))
|
||||||
self.unconfirmed.Shift(work.Block.NumberU64() - 1)
|
self.unconfirmed.Shift(work.Block.NumberU64() - 1)
|
||||||
}
|
}
|
||||||
if work.config.Posv != nil {
|
|
||||||
// epoch block
|
|
||||||
if (work.Block.NumberU64() % work.config.Posv.Epoch) == 0 {
|
|
||||||
core.CheckpointCh <- 1
|
|
||||||
}
|
|
||||||
// prepare set of masternodes for the next epoch
|
|
||||||
if (work.Block.NumberU64() % work.config.Posv.Epoch) == (work.config.Posv.Epoch - work.config.Posv.Gap) {
|
|
||||||
err := self.chain.UpdateM1()
|
|
||||||
if err != nil {
|
|
||||||
if err == core.ErrNotPoSV {
|
|
||||||
log.Error("Stopping node", "err", err)
|
|
||||||
os.Exit(1)
|
|
||||||
} else {
|
|
||||||
log.Error("Error when update masternodes set. Keep the current masternodes set for the next epoch.", "err", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
self.push(work)
|
self.push(work)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue