Skip to content

Commit 3a93019

Browse files
committed
added processing initial tick to cfg that override node initial tick
1 parent 1354bd8 commit 3a93019

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

main.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ func run() error {
5959
ProcessTickTimeout time.Duration `conf:"default:5s"`
6060
DisableTransactionStatusAddon bool `conf:"default:false"`
6161
ArbitratorIdentity string `conf:"default:AFZPUAIYVPNUYGJRQVLUKOPPVLHAZQTGLYAAUUNBXFTVTAMSBKQBLEIEPCVJ"`
62+
InitialTick uint32 `conf:"default:0"` // Initial tick to start processing from, 0 means disabled
6263
}
6364
Store struct {
6465
ResetEmptyTickKeys bool `conf:"default:false"`
@@ -195,7 +196,7 @@ func run() error {
195196
return errors.Wrapf(err, "getting arbitrator public key from [%s]", cfg.Qubic.ArbitratorIdentity)
196197
}
197198

198-
proc := processor.NewProcessor(p, ps, cfg.Qubic.ProcessTickTimeout, arbitratorPubKey, cfg.Qubic.DisableTransactionStatusAddon)
199+
proc := processor.NewProcessor(p, ps, cfg.Qubic.ProcessTickTimeout, arbitratorPubKey, cfg.Qubic.DisableTransactionStatusAddon, cfg.Qubic.InitialTick)
199200
procErrors := make(chan error, 1)
200201

201202
// Start the service listening for requests.

processor/processor.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,18 @@ type Processor struct {
3030
ps *store.PebbleStore
3131
arbitratorPubKey [32]byte
3232
processTickTimeout time.Duration
33+
initialTick uint32
3334
disableStatusAddon bool
3435
}
3536

36-
func NewProcessor(p *qubic.Pool, ps *store.PebbleStore, processTickTimeout time.Duration, arbitratorPubKey [32]byte, disableStatusAddon bool) *Processor {
37+
func NewProcessor(p *qubic.Pool, ps *store.PebbleStore, processTickTimeout time.Duration, arbitratorPubKey [32]byte, disableStatusAddon bool, initialTick uint32) *Processor {
3738
return &Processor{
3839
pool: p,
3940
ps: ps,
4041
processTickTimeout: processTickTimeout,
4142
arbitratorPubKey: arbitratorPubKey,
4243
disableStatusAddon: disableStatusAddon,
44+
initialTick: initialTick,
4345
}
4446
}
4547

@@ -82,6 +84,9 @@ func (p *Processor) processOneByOne() error {
8284
if err != nil {
8385
return errors.Wrap(err, "getting tick info")
8486
}
87+
if p.initialTick != 0 {
88+
tickInfo.InitialTick = p.initialTick
89+
}
8590

8691
lastTick, err := p.getLastProcessedTick(ctx, tickInfo)
8792
if err != nil {

0 commit comments

Comments
 (0)