Skip to content

Commit

Permalink
Adjusted existing unit tests for heartbeats
Browse files Browse the repository at this point in the history
  • Loading branch information
tomaszslabon committed May 14, 2024
1 parent 4e32ec6 commit 82dc68a
Show file tree
Hide file tree
Showing 2 changed files with 319 additions and 20 deletions.
16 changes: 14 additions & 2 deletions pkg/tbtc/heartbeat.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,18 @@ type heartbeatSigningExecutor interface {
) (*tecdsa.Signature, uint32, uint64, error)
}

// heartbeatInactivityClaimExecutor is an interface meant to decouple the
// specific implementation of the inactivity claim executor from the heartbeat
// action.
type heartbeatInactivityClaimExecutor interface {
claimInactivity(
ctx context.Context,
inactiveMembersIndexes []group.MemberIndex,
heartbeatFailed bool,
sessionID *big.Int,
) error
}

// heartbeatAction is a walletAction implementation handling heartbeat requests
// from the wallet coordinator.
type heartbeatAction struct {
Expand All @@ -75,7 +87,7 @@ type heartbeatAction struct {
proposal *HeartbeatProposal
failureCounter *heartbeatFailureCounter

inactivityClaimExecutor *inactivityClaimExecutor
inactivityClaimExecutor heartbeatInactivityClaimExecutor

startBlock uint64
expiryBlock uint64
Expand All @@ -90,7 +102,7 @@ func newHeartbeatAction(
signingExecutor heartbeatSigningExecutor,
proposal *HeartbeatProposal,
failureCounter *heartbeatFailureCounter,
inactivityClaimExecutor *inactivityClaimExecutor,
inactivityClaimExecutor heartbeatInactivityClaimExecutor,
startBlock uint64,
expiryBlock uint64,
waitForBlockFn waitForBlockFn,
Expand Down
Loading

0 comments on commit 82dc68a

Please sign in to comment.