Skip to content

Commit 80077cb

Browse files
authored
Testing: Don't fail for heartbeat in same block as proposal (algorand#6229)
1 parent afb8216 commit 80077cb

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

test/e2e-go/features/incentives/challenge_test.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ func testChallengesOnce(t *testing.T, a *require.Assertions) (retry bool) {
177177
// Watch the first half grace period for proposals from challenged nodes, since they won't have to heartbeat.
178178
lucky := util.MakeSet[basics.Address]()
179179
fixture.WithEveryBlock(challengeRound, challengeRound+grace/2, func(block bookkeeping.Block) {
180+
t.Logf("1st half Block %d, proposed by %s\n", block.Round(), block.Proposer())
180181
if eligible2.Contains(block.Proposer()) {
181182
lucky.Add(block.Proposer())
182183
}
@@ -186,10 +187,7 @@ func testChallengesOnce(t *testing.T, a *require.Assertions) (retry bool) {
186187
// In the second half of the grace period, Node 2 should heartbeat for its eligible accounts
187188
beated := util.MakeSet[basics.Address]()
188189
fixture.WithEveryBlock(challengeRound+grace/2+1, challengeRound+grace, func(block bookkeeping.Block) {
189-
t.Logf("2nd half Block %d\n", block.Round())
190-
if eligible2.Contains(block.Proposer()) {
191-
lucky.Add(block.Proposer())
192-
}
190+
t.Logf("2nd half Block %d, proposed by %s\n", block.Round(), block.Proposer())
193191
for i, txn := range block.Payset {
194192
hb := txn.Txn.HeartbeatTxnFields
195193
t.Logf("Heartbeat txn %v in position %d round %d\n", hb, i, block.Round())
@@ -199,6 +197,9 @@ func testChallengesOnce(t *testing.T, a *require.Assertions) (retry bool) {
199197
beated.Add(hb.HbAddress)
200198
a.NotContains(lucky, hb.HbAddress, "unneeded %s", hb.HbAddress) // we should not see a heartbeat from an account that proposed
201199
}
200+
if eligible2.Contains(block.Proposer()) {
201+
lucky.Add(block.Proposer())
202+
}
202203
a.Empty(block.AbsentParticipationAccounts) // nobody suspended during grace
203204
})
204205
a.Equal(eligible2, util.Union(beated, lucky))

0 commit comments

Comments
 (0)