Skip to content

Commit acca54a

Browse files
committed
Check for the first interval
1 parent 4b4c443 commit acca54a

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

rocketpool/watchtower/submit-rewards-tree-stateless.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -175,12 +175,15 @@ func (t *submitRewardsTree_Stateless) Run(nodeTrusted bool, state *state.Network
175175

176176
// Check if the node has already submitted the rewards for the previous interval
177177
// In case we just had consensus, we want other nodes to also submit
178-
hasSubmitted, err := t.hasSubmittedTree(nodeAccount.Address, currentIndexBig.Sub(currentIndexBig, big.NewInt(1)))
179-
if err != nil {
180-
return fmt.Errorf("error checking if Merkle tree submission has already been processed: %w", err)
181-
}
182-
if !hasSubmitted { // didn't participate in the previous consensus. Decrement the index and submit it as a health check
183-
currentIndexBig = currentIndexBig.Sub(currentIndexBig, big.NewInt(1))
178+
var hasSubmitted bool
179+
if currentIndexBig.Cmp(big.NewInt(0)) > 0 {
180+
hasSubmitted, err := t.hasSubmittedTree(nodeAccount.Address, currentIndexBig.Sub(currentIndexBig, big.NewInt(1)))
181+
if err != nil {
182+
return fmt.Errorf("error checking if Merkle tree submission has already been processed: %w", err)
183+
}
184+
if !hasSubmitted { // didn't participate in the previous consensus. Decrement the index and submit it as a health check
185+
currentIndexBig = currentIndexBig.Sub(currentIndexBig, big.NewInt(1))
186+
}
184187
}
185188

186189
// Check if rewards generation is already running

0 commit comments

Comments
 (0)