Merge pull request #925 from filecoin-project/fix/future-mining

dont allow submitting blocks more than a second in the future
This commit is contained in:
Łukasz Magiera 2019-12-16 12:39:35 +01:00 committed by GitHub
commit 9b2eab6a3f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -31,7 +31,7 @@ const PaymentChannelClosingDelay = 6 * 60 * 60 / BlockDelay // six hours
// Consensus / Network
// Seconds
const AllowableClockDrift = BlockDelay * 2
const AllowableClockDrift = 1
// Epochs
const ForkLengthThreshold = Finality

View File

@ -480,7 +480,7 @@ func (syncer *Syncer) ValidateBlock(ctx context.Context, b *types.FullBlock) err
}
if h.Timestamp > uint64(time.Now().Unix()+build.AllowableClockDrift) {
return xerrors.Errorf("block was from the future")
return xerrors.Errorf("block was from the future: %w", ErrTemporal)
}
if h.Timestamp > uint64(time.Now().Unix()) {
log.Warn("Got block from the future, but within threshold", h.Timestamp, time.Now().Unix())