Skip to content

bor: re-visit logic of mutex lock/unlock in finality #11129

Open
@AskAlexSharov

Description

@AskAlexSharov

Need re-visit this code and remove if possible. Or move this logic to 1 level down - where can lock+defer unlock mutex inside 1 func.

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 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())

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions