Skip to content

Commit

Permalink
Add a test that reproduces the crash when acceptance is delayed to af…
Browse files Browse the repository at this point in the history
…ter commitment
  • Loading branch information
alexsporn committed Mar 26, 2024
1 parent 4f9de3a commit 008d302
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions pkg/indexer/indexer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,32 @@ type outputTest struct {
outputID iotago.OutputID
}

// TestIndexer_CommitAdd_AcceptAdd tests the following scenario:
// 1. Add output on commitment
// 2. Add output on acceptance (because it was delayed by some reason)
func TestIndexer_CommitAdd_AcceptAdd(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, tt.commitAddThenAccept)
}
}

func (o *outputTest) commitAddThenAccept(t *testing.T) {
ts := newTestSuite(t)

// Commit Add
ts.AddOutputOnCommitment(o.output, o.outputID) // Slot 1

// Accepted outputs are found
ts.requireFound(o.outputID)

// Accept Add
ts.AddOutputOnAcceptance(o.output, o.outputID, 1)

// Still needs to be found
ts.requireFound(o.outputID)

}

// TestIndexer_AcceptAdd_CommitAdd_AcceptDelete_CommitDelete tests the following scenario:
// 1. Add output on acceptance
// 2. Add output on commitment
Expand Down

0 comments on commit 008d302

Please sign in to comment.