Skip to content
This repository has been archived by the owner on Jun 9, 2024. It is now read-only.

Commit

Permalink
bet
Browse files Browse the repository at this point in the history
  • Loading branch information
itsdevbear committed Jun 1, 2024
1 parent 48c9b7a commit 2c17323
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions cosmos/runtime/miner/miner.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,15 @@ func (m *Miner) submitPayloadForBuilding(ctx context.Context) error {
// to clock skew / rounding to commit two blocks in succession with the same
// unix time. This will prevent the block from being built.
prevBlockTs := uint64(0)
if finalBlock := m.bc.CurrentFinalBlock(); finalBlock != nil {
prevBlockTs = finalBlock.Time
if finalBlock := m.bc.GetBlockByNumber(uint64(sCtx.BlockHeight()) - 1); finalBlock != nil {
prevBlockTs = finalBlock.Time()
} else {
// If we fail to find the previous block, we minimum of the current time
// and the next block time, time.Now() is always increasing, so eventually
// time.Now() > sCtx.BlockTime() + 1.
prevBlockTs = min(uint64(time.Now().Unix()))
}

ts := max(uint64(sCtx.BlockTime().Unix()), prevBlockTs+1)

// Build Payload.
Expand Down

0 comments on commit 2c17323

Please sign in to comment.