dont allow submitting blocks more than a second in the future
This commit is contained in:
parent
dad3b1cb26
commit
159117e720
@ -31,7 +31,7 @@ const PaymentChannelClosingDelay = 6 * 60 * 60 / BlockDelay // six hours
|
|||||||
// Consensus / Network
|
// Consensus / Network
|
||||||
|
|
||||||
// Seconds
|
// Seconds
|
||||||
const AllowableClockDrift = BlockDelay * 2
|
const AllowableClockDrift = 1
|
||||||
|
|
||||||
// Epochs
|
// Epochs
|
||||||
const ForkLengthThreshold = Finality
|
const ForkLengthThreshold = Finality
|
||||||
|
@ -480,7 +480,7 @@ func (syncer *Syncer) ValidateBlock(ctx context.Context, b *types.FullBlock) err
|
|||||||
}
|
}
|
||||||
|
|
||||||
if h.Timestamp > uint64(time.Now().Unix()+build.AllowableClockDrift) {
|
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()) {
|
if h.Timestamp > uint64(time.Now().Unix()) {
|
||||||
log.Warn("Got block from the future, but within threshold", h.Timestamp, time.Now().Unix())
|
log.Warn("Got block from the future, but within threshold", h.Timestamp, time.Now().Unix())
|
||||||
|
Loading…
Reference in New Issue
Block a user