Skip to content

Commit cc281fa

Browse files
authored
Merge pull request #47 from qubic/dev
Fix empty tick checks
2 parents 7118ff3 + 32e366f commit cc281fa

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

validator/tick/empty_tick.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,11 @@ import (
77
"github.com/qubic/go-archiver/protobuff"
88
"github.com/qubic/go-archiver/store"
99
"github.com/qubic/go-node-connector/types"
10+
"google.golang.org/protobuf/proto"
1011
)
1112

13+
var emptyTickData = &protobuff.TickData{}
14+
1215
func CalculateEmptyTicksForEpoch(ctx context.Context, ps *store.PebbleStore, epoch uint32) (uint32, error) {
1316

1417
epochs, err := ps.GetProcessedTickIntervals(ctx)
@@ -24,6 +27,7 @@ func CalculateEmptyTicksForEpoch(ctx context.Context, ps *store.PebbleStore, epo
2427
var emptyTicks uint32
2528

2629
for _, interval := range e.Intervals {
30+
fmt.Printf("Interval: %d -> %d\n", interval.InitialProcessedTick, interval.LastProcessedTick)
2731
for tickOffset := range interval.LastProcessedTick - interval.InitialProcessedTick + 1 {
2832
tickNumber := tickOffset + interval.InitialProcessedTick
2933

@@ -33,7 +37,7 @@ func CalculateEmptyTicksForEpoch(ctx context.Context, ps *store.PebbleStore, epo
3337
}
3438

3539
if CheckIfTickIsEmptyProto(tickData) {
36-
fmt.Printf("Found empty tick.\n")
40+
fmt.Printf("Found empty tick: %d\n", tickNumber)
3741
emptyTicks += 1
3842
continue
3943
}
@@ -45,7 +49,8 @@ func CalculateEmptyTicksForEpoch(ctx context.Context, ps *store.PebbleStore, epo
4549
}
4650

4751
func CheckIfTickIsEmptyProto(tickData *protobuff.TickData) bool {
48-
if tickData == nil {
52+
53+
if tickData == nil || proto.Equal(tickData, emptyTickData) {
4954
return true
5055
}
5156

0 commit comments

Comments
 (0)