Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions x/challenge/keeper/challenge.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ func (k Keeper) RemoveChallengeUntil(ctx sdk.Context, height uint64) {
}
}

// RemoveChallenge removes a specific challenge from the store
func (k Keeper) RemoveChallenge(ctx sdk.Context, challengeId uint64) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.ChallengeKeyPrefix)
store.Delete(getChallengeKeyBytes(challengeId))
}

// ExistsChallenge check whether there exists ongoing challenge for an id
func (k Keeper) ExistsChallenge(ctx sdk.Context, challengeId uint64) bool {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.ChallengeKeyPrefix)
Expand Down
2 changes: 2 additions & 0 deletions x/challenge/keeper/msg_server_attest.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ func (k msgServer) Attest(goCtx context.Context, msg *types.MsgAttest) (*types.M
if err != nil {
return nil, err
}
// prevent heartbeat attestation replay (SRC-816)
k.RemoveChallenge(ctx, msg.ChallengeId)
}
k.AppendAttestedChallenge(ctx, &types.AttestedChallenge{
Id: msg.ChallengeId,
Expand Down
Loading