Sitelet https://github.com/Fantom-foundation/go-opera/commit/2ef5800adfd7cf60a50f1c5a4bfb06c7ae6f0afd
Skip to content

Commit 2ef5800

Browse files
authored
Merge pull request #480 from uprendis/feature/doublecheck-self-parent
Emitter doublechecks selected self-parent
2 parents 23c82d4 + e85f907 commit 2ef5800

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

‎gossip/emitter/emitter.go‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package emitter
22

33
import (
4+
"errors"
45
"fmt"
56
"math/rand"
67
"os"
@@ -19,6 +20,7 @@ import (
1920
"github.com/Fantom-foundation/go-opera/inter"
2021
"github.com/Fantom-foundation/go-opera/logger"
2122
"github.com/Fantom-foundation/go-opera/tracing"
23+
"github.com/Fantom-foundation/go-opera/utils/errlock"
2224
"github.com/Fantom-foundation/go-opera/utils/rate"
2325
)
2426

@@ -307,6 +309,12 @@ func (em *Emitter) createEvent(sortedTxs *types.TransactionsByPriceAndNonce) (*i
307309
if !ok {
308310
return nil, nil
309311
}
312+
prevEmitted := em.readLastEmittedEventID()
313+
if prevEmitted != nil && prevEmitted.Epoch() >= em.epoch {
314+
if selfParent == nil || *selfParent != *prevEmitted {
315+
errlock.Permanent(errors.New("Local database is corrupted, which may lead to a doublesign"))
316+
}
317+
}
310318

311319
// Set parent-dependent fields
312320
parentHeaders := make(inter.Events, len(parents))

0 commit comments

Comments
 (0)