Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

testing: fix random failure in TestAppEmptyAccountsLocal #2302

Merged
merged 1 commit into from
Jun 17, 2021
Merged
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
4 changes: 3 additions & 1 deletion ledger/applications_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -926,7 +926,7 @@ return`
Header: txHeader,
ApplicationCallTxnFields: appCallFields,
}
err = l.appendUnvalidatedTx(t, genesisInitState.Accounts, initKeys, appCall, transactions.ApplyData{
err = l.appendUnvalidatedTx(t, nil, initKeys, appCall, transactions.ApplyData{
EvalDelta: basics.EvalDelta{
LocalDeltas: map[uint64]basics.StateDelta{0: {"lk": basics.ValueDelta{
Action: basics.SetBytesAction,
Expand Down Expand Up @@ -975,6 +975,8 @@ return`
err = l.appendUnvalidated(blk)
a.NoError(err)

l.WaitForCommit(3)

// save data into DB and write into local state
l.accts.accountsWriting.Add(1)
l.accts.commitRound(3, 0, 0)
Expand Down
13 changes: 11 additions & 2 deletions ledger/ledger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,17 @@ func makeNewEmptyBlock(t *testing.T, l *Ledger, GenesisID string, initAccounts m
proto := config.Consensus[lastBlock.CurrentProtocol]
poolAddr := testPoolAddr
var totalRewardUnits uint64
for _, acctdata := range initAccounts {
totalRewardUnits += acctdata.MicroAlgos.RewardUnits(proto)
if l.Latest() == 0 {
require.NotNil(t, initAccounts)
for _, acctdata := range initAccounts {
if acctdata.Status != basics.NotParticipating {
totalRewardUnits += acctdata.MicroAlgos.RewardUnits(proto)
}
}
} else {
totals, err := l.Totals(l.Latest())
require.NoError(t, err)
totalRewardUnits = totals.RewardUnits()
}
poolBal, err := l.Lookup(l.Latest(), poolAddr)
a.NoError(err, "could not get incentive pool balance")
Expand Down