From c2bef84c06888055cb2a04b51df07c5b98e27253 Mon Sep 17 00:00:00 2001 From: Sergi Rene Date: Tue, 5 Nov 2024 10:02:30 +0100 Subject: [PATCH] skew fix --- block/submit.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/block/submit.go b/block/submit.go index 63b48ffe7..ae02fd216 100644 --- a/block/submit.go +++ b/block/submit.go @@ -77,7 +77,6 @@ func SubmitLoopInner( if err != nil { return err } - fmt.Println("skew time", skewTime) types.RollappPendingSubmissionsSkewTimeHours.Set(float64(skewTime.Hours())) @@ -108,21 +107,24 @@ func SubmitLoopInner( } pending := pendingBytes.Load() - skewTime, err := skewTime() + skew, err := skewTime() if err != nil { return err } - fmt.Println("skew time", skewTime) types.RollappPendingSubmissionsSkewBytes.Set(float64(pending)) types.RollappPendingSubmissionsSkewBlocks.Set(float64(unsubmittedBlocksNum())) - types.RollappPendingSubmissionsSkewTimeHours.Set(float64(skewTime.Hours())) + types.RollappPendingSubmissionsSkewTimeHours.Set(float64(skew.Hours())) // while there are accumulated blocks, create and submit batches!! for { done := ctx.Err() != nil nothingToSubmit := pending == 0 - lastSubmissionIsRecent := skewTime < maxBatchTime + skew, err = skewTime() + if err != nil { + return err + } + lastSubmissionIsRecent := skew < maxBatchTime maxDataNotExceeded := pending <= maxBatchBytes if done || nothingToSubmit || (lastSubmissionIsRecent && maxDataNotExceeded) { break @@ -342,7 +344,6 @@ func (m *Manager) GetSkewTime() (time.Duration, error) { if err != nil { return time.Duration(0), err } - fmt.Println(lastSettlementBlockTime, m.State.GetLastBlockTime()) return m.State.GetLastBlockTime().Sub(lastSettlementBlockTime), nil }