Skip to content

Commit

Permalink
CR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonpaulos committed Apr 28, 2022
1 parent b41bfb9 commit 8d8d84a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 1 addition & 3 deletions data/transactions/logic/eval.go
Original file line number Diff line number Diff line change
Expand Up @@ -2239,8 +2239,7 @@ func (cx *EvalContext) getTxID(txn *transactions.Transaction, groupIndex int, in
if inner {
// Initialize innerTxidCache if necessary
if cx.EvalParams.innerTxidCache == nil {
lastGroupLen := len(cx.getLastInnerGroup())
cx.EvalParams.innerTxidCache = make(map[int]transactions.Txid, lastGroupLen)
cx.EvalParams.innerTxidCache = make(map[int]transactions.Txid)
}

txid, ok := cx.EvalParams.innerTxidCache[groupIndex]
Expand All @@ -2262,7 +2261,6 @@ func (cx *EvalContext) getTxID(txn *transactions.Transaction, groupIndex int, in
cx.EvalParams.txidCache = make(map[int]transactions.Txid, len(cx.TxnGroup))
}

// Hashes are expensive, so we cache computed TxIDs
txid, ok := cx.EvalParams.txidCache[groupIndex]
if !ok {
if cx.caller != nil {
Expand Down
3 changes: 3 additions & 0 deletions data/transactions/logic/evalAppTxn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1423,6 +1423,7 @@ itxn Logs 0
// reported with `global GroupID` are correct for top-level and inner transactions
func TestTxIDAndGroupIDCalculation(t *testing.T) {
partitiontest.PartitionTest(t)
t.Parallel()

withoutGroupID := func(txn transactions.Transaction) transactions.Transaction {
txn.Group = crypto.Digest{}
Expand Down Expand Up @@ -1835,6 +1836,7 @@ int 1
// correct for inner transactions
func TestInnerTxIDCalculation(t *testing.T) {
partitiontest.PartitionTest(t)
t.Parallel()

type actualInfo struct {
txn transactions.Transaction
Expand Down Expand Up @@ -2140,6 +2142,7 @@ int 1

func TestInnerTxIDCaching(t *testing.T) {
partitiontest.PartitionTest(t)
t.Parallel()

parentAppID := basics.AppIndex(888)
childAppID := basics.AppIndex(222)
Expand Down

0 comments on commit 8d8d84a

Please sign in to comment.