From 42d915f416c2b0c72dff39bec55c95ec248f0cc5 Mon Sep 17 00:00:00 2001 From: welkin22 Date: Fri, 11 Oct 2024 11:41:59 +0800 Subject: [PATCH] Remove redundant data when generating NonDependentRelFlag --- core/types/dag_test.go | 2 +- core/types/mvstates.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/types/dag_test.go b/core/types/dag_test.go index de4f3e1c44..b4acf1a1e3 100644 --- a/core/types/dag_test.go +++ b/core/types/dag_test.go @@ -156,7 +156,7 @@ func mockSystemTxDAGWithLargeDeps() TxDAG { dag.TxDeps[7].TxIndexes = []uint64{3} dag.TxDeps[8].TxIndexes = []uint64{} //dag.TxDeps[9].TxIndexes = []uint64{0, 1, 2, 6, 7, 8} - dag.TxDeps[9] = NewTxDep([]uint64{3, 4, 5, 10, 11}, NonDependentRelFlag) + dag.TxDeps[9] = NewTxDep([]uint64{3, 4, 5}, NonDependentRelFlag) dag.TxDeps[10] = NewTxDep([]uint64{}, ExcludedTxFlag) dag.TxDeps[11] = NewTxDep([]uint64{}, ExcludedTxFlag) return dag diff --git a/core/types/mvstates.go b/core/types/mvstates.go index d64afd1281..71ea2e4a14 100644 --- a/core/types/mvstates.go +++ b/core/types/mvstates.go @@ -1036,8 +1036,8 @@ func (s *MVStates) ResolveTxDAG(txCnt int, extraTxDeps ...TxDep) (TxDAG, error) // if tx deps larger than half of txs, then convert with NonDependentRelFlag txDAG.TxDeps[i].SetFlag(NonDependentRelFlag) nd := make([]uint64, 0, totalCnt-1-len(txDAG.TxDeps[i].TxIndexes)) - for j := uint64(0); j < uint64(totalCnt); j++ { - if !slices.Contains(txDAG.TxDeps[i].TxIndexes, j) && j != uint64(i) { + for j := uint64(0); j < uint64(i); j++ { + if !slices.Contains(txDAG.TxDeps[i].TxIndexes, j) { nd = append(nd, j) } }