Skip to content

Commit

Permalink
jsonrpc: update GetVoteOnHash to not use whitelisting service when ru…
Browse files Browse the repository at this point in the history
…n with Astrid (#13498)
  • Loading branch information
taratorio authored Jan 19, 2025
1 parent 6b399e0 commit 457a1dc
Showing 1 changed file with 16 additions and 17 deletions.
33 changes: 16 additions & 17 deletions turbo/jsonrpc/bor_snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -329,12 +329,6 @@ func (api *BorImpl) GetVoteOnHash(ctx context.Context, starBlockNr uint64, endBl
}
defer tx.Rollback()

service := whitelist.GetWhitelistingService()

if service == nil {
return false, errors.New("only available in Bor engine")
}

//Confirmation of 16 blocks on the endblock
tipConfirmationBlockNr := endBlockNr + uint64(16)

Expand All @@ -352,21 +346,26 @@ func (api *BorImpl) GetVoteOnHash(ctx context.Context, starBlockNr uint64, endBl

localEndBlockHash := localEndBlock.Hash().String()

isLocked := service.LockMutex(endBlockNr)
// TODO whitelisting service is pending removal - https://github.com/erigontech/erigon/issues/12855
if service := whitelist.GetWhitelistingService(); service != nil {
isLocked := service.LockMutex(endBlockNr)

if !isLocked {
service.UnlockMutex(false, "", endBlockNr, common.Hash{})
return false, errors.New("whitelisted number or locked sprint number is more than the received end block number")
}
if !isLocked {
service.UnlockMutex(false, "", endBlockNr, common.Hash{})
return false, errors.New("whitelisted number or locked sprint number is more than the received end block number")
}

if localEndBlockHash != hash {
service.UnlockMutex(false, "", endBlockNr, common.Hash{})
return false, fmt.Errorf("hash mismatch: localChainHash %s, milestoneHash %s", localEndBlockHash, hash)
}
if localEndBlockHash != hash {
service.UnlockMutex(false, "", endBlockNr, common.Hash{})
return false, fmt.Errorf("hash mismatch: localChainHash %s, milestoneHash %s", localEndBlockHash, hash)
}

service.UnlockMutex(true, milestoneId, endBlockNr, localEndBlock.Hash())
service.UnlockMutex(true, milestoneId, endBlockNr, localEndBlock.Hash())

return true, nil
}

return true, nil
return localEndBlockHash == hash, nil
}

type BlockSigners struct {
Expand Down

0 comments on commit 457a1dc

Please sign in to comment.