Skip to content

Commit

Permalink
Test: fix fail due to duplicated TX ID error
Browse files Browse the repository at this point in the history
pass validated=true for execution of already committed transition
  • Loading branch information
hijung committed Sep 15, 2023
1 parent 8799a7c commit 0bc9459
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions icon/ictest/blockv0gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,9 @@ func NewBlockV0Generator(t *testing.T, genesis string) *BlockV0Generator {
itr, err := g.node.SM.CreateInitialTransition(nil, nil)
assert.NoError(t, err)
g.lastTr = itr
// pass validated=true for already committed transition
g.executeAndAddReceipts(
g.last.NormalTransactions(), g.last.Height(), g.last.Timestamp(),
g.last.NormalTransactions(), g.last.Height(), g.last.Timestamp(), true,
)
return g
}
Expand All @@ -118,17 +119,18 @@ func (g *BlockV0Generator) executeAndAddReceiptsV0TXs(
for i := range txs {
txs_[i] = txs[i].Transaction
}
return g.executeAndAddReceipts(txs_, height, ts)
return g.executeAndAddReceipts(txs_, height, ts, false)
}

func (g *BlockV0Generator) executeAndAddReceipts(
txs []module.Transaction,
height int64,
ts int64,
validated bool,
) []byte {
txl := transaction.NewTransactionListFromSlice(g.node.Chain.Database(), txs)
tr, err := g.node.SM.CreateTransition(
g.lastTr, txl, common.NewBlockInfo(height, ts), nil, false,
g.lastTr, txl, common.NewBlockInfo(height, ts), nil, validated,
)
assert.NoError(g.t, err)
transitionExecute(g.t, tr)
Expand Down

0 comments on commit 0bc9459

Please sign in to comment.