Merge branch 'develop' of https://github.com/maticnetwork/bor into v2.1.0-candidate

This commit is contained in:
Pratik Patil 2025-06-06 10:59:30 +05:30
commit 43e60980c9
No known key found for this signature in database
GPG key ID: AFDCA496554874B3
2 changed files with 6 additions and 4 deletions

View file

@ -231,7 +231,7 @@ type Bor struct {
// The fields below are for testing only // The fields below are for testing only
fakeDiff bool // Skip difficulty verifications fakeDiff bool // Skip difficulty verifications
devFakeAuthor bool DevFakeAuthor bool
closeOnce sync.Once closeOnce sync.Once
} }
@ -276,7 +276,7 @@ func New(
GenesisContractsClient: genesisContracts, GenesisContractsClient: genesisContracts,
HeimdallClient: heimdallClient, HeimdallClient: heimdallClient,
spanStore: spanStore, spanStore: spanStore,
devFakeAuthor: devFakeAuthor, DevFakeAuthor: devFakeAuthor,
} }
c.authorizedSigner.Store(&signer{ c.authorizedSigner.Store(&signer{
@ -553,7 +553,7 @@ func (c *Bor) verifyCascadingFields(chain consensus.ChainHeaderReader, header *t
func (c *Bor) snapshot(chain consensus.ChainHeaderReader, number uint64, hash common.Hash, parents []*types.Header) (*Snapshot, error) { func (c *Bor) snapshot(chain consensus.ChainHeaderReader, number uint64, hash common.Hash, parents []*types.Header) (*Snapshot, error) {
// Search for a snapshot in memory or on disk for checkpoints // Search for a snapshot in memory or on disk for checkpoints
signer := common.BytesToAddress(c.authorizedSigner.Load().signer.Bytes()) signer := common.BytesToAddress(c.authorizedSigner.Load().signer.Bytes())
if c.devFakeAuthor && signer.String() != "0x0000000000000000000000000000000000000000" { if c.DevFakeAuthor && signer.String() != "0x0000000000000000000000000000000000000000" {
log.Info("👨💻Using DevFakeAuthor", "signer", signer) log.Info("👨💻Using DevFakeAuthor", "signer", signer)
val := valset.NewValidator(signer, 1000) val := valset.NewValidator(signer, 1000)

View file

@ -597,11 +597,13 @@ func (w *worker) mainLoop() {
} }
}() }()
bor, isBor := w.engine.(*bor.Bor)
devFakeAuthor := isBor && bor != nil && bor.DevFakeAuthor
for { for {
select { select {
case req := <-w.newWorkCh: case req := <-w.newWorkCh:
if w.chainConfig.ChainID.Cmp(params.BorMainnetChainConfig.ChainID) == 0 || w.chainConfig.ChainID.Cmp(params.MumbaiChainConfig.ChainID) == 0 || w.chainConfig.ChainID.Cmp(params.AmoyChainConfig.ChainID) == 0 { if w.chainConfig.ChainID.Cmp(params.BorMainnetChainConfig.ChainID) == 0 || w.chainConfig.ChainID.Cmp(params.MumbaiChainConfig.ChainID) == 0 || w.chainConfig.ChainID.Cmp(params.AmoyChainConfig.ChainID) == 0 {
if w.eth.PeerCount() > 0 { if w.eth.PeerCount() > 0 || devFakeAuthor {
//nolint:contextcheck //nolint:contextcheck
w.commitWork(req.interrupt, req.noempty, req.timestamp) w.commitWork(req.interrupt, req.noempty, req.timestamp)
} }