Skip to content

Commit

Permalink
code review
Browse files Browse the repository at this point in the history
  • Loading branch information
jannotti committed Dec 5, 2024
1 parent 6eb6ad2 commit 35d32b0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions data/transactions/heartbeat.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ type HeartbeatTxnFields struct {
// HbProof is a signature using HeartbeatAddress's partkey, thereby showing it is online.
HbProof crypto.HeartbeatProof `codec:"hbprf"`

// HbSeed must be the block seed for the block before this transaction's
// firstValid. It is supplied in the transaction so that Proof can be
// checked at submit time without a ledger lookup, and must be checked at
// evaluation time for equality with the actual blockseed.
// HbSeed must be the block seed for the this transaction's firstValid
// block. It is supplied in the transaction so that Proof can be checked at
// submit time without a ledger lookup, and must be checked at evaluation
// time for equality with the actual blockseed.
HbSeed committee.Seed `codec:"hbsd"`
}
2 changes: 1 addition & 1 deletion ledger/apply/challenge.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func FindChallenge(rules config.ProposerPayoutRules, current basics.Round, heade
}
challengeHdr, err := headers.BlockHdr(lastChallenge)
if err != nil {
panic(err)
return challenge{}

Check warning on line 75 in ledger/apply/challenge.go

View check run for this annotation

Codecov / codecov/patch

ledger/apply/challenge.go#L75

Added line #L75 was not covered by tests
}
challengeProto := config.Consensus[challengeHdr.CurrentProtocol]
// challenge is not considered if rules have changed since that round
Expand Down
2 changes: 1 addition & 1 deletion ledger/apply/heartbeat.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func Heartbeat(hb transactions.HeartbeatTxnFields, header transactions.Header, b
return fmt.Errorf("%s heartbeat is not allowed when not IncentiveEligible %+v", kind, hb.HbAddress)
}
ch := FindChallenge(proto.Payouts, round, provider, ChRisky)
if ch.round == 0 {
if ch.IsZero() {
return fmt.Errorf("%s heartbeat for %s is not allowed with no challenge", kind, hb.HbAddress)
}
if !ch.Failed(hb.HbAddress, account.LastSeen()) {
Expand Down

0 comments on commit 35d32b0

Please sign in to comment.