From 0c78f572e5c1b4aefff3fa3bf63dc65c785eef0c Mon Sep 17 00:00:00 2001 From: jkrvivian Date: Thu, 9 Nov 2023 14:45:03 +0800 Subject: [PATCH] Rename variable spenddag to spendDAG --- .../mempool/spenddag/tests/framework.go | 16 ++++----- .../engine/mempool/spenddag/tests/tests.go | 34 +++++++++---------- .../engine/mempool/tests/testframework.go | 6 ++-- pkg/protocol/engine/mempool/tests/tests.go | 16 ++++----- pkg/protocol/engine/mempool/v1/mempool.go | 18 +++++----- .../engine/mempool/v1/mempool_test.go | 10 +++--- .../engine/tipselection/v1/tip_selection.go | 16 ++++----- 7 files changed, 58 insertions(+), 58 deletions(-) diff --git a/pkg/protocol/engine/mempool/spenddag/tests/framework.go b/pkg/protocol/engine/mempool/spenddag/tests/framework.go index 1cb2227ce..58bfd21e6 100644 --- a/pkg/protocol/engine/mempool/spenddag/tests/framework.go +++ b/pkg/protocol/engine/mempool/spenddag/tests/framework.go @@ -10,16 +10,16 @@ import ( iotago "github.com/iotaledger/iota.go/v4" ) -// Framework is a test framework for the spenddag that allows to easily create and manipulate the DAG and its +// Framework is a test framework for the SpendDAG that allows to easily create and manipulate the DAG and its // validators using human-readable aliases instead of actual IDs. type Framework struct { - // Instance is the spenddag instance that is used in the tests. + // Instance is the SpendDAG instance that is used in the tests. Instance spenddag.SpendDAG[iotago.TransactionID, iotago.OutputID, vote.MockedRank] // Accounts is the AccountsTestFramework that is used in the tests. Accounts *AccountsTestFramework - // Assert provides a set of assertions that can be used to verify the state of the spenddag. + // Assert provides a set of assertions that can be used to verify the state of the SpendDAG. Assert *Assertions // SpendID is a function that is used to translate a string alias into a (deterministic) iotago.TransactionID. @@ -35,13 +35,13 @@ type Framework struct { // NewFramework creates a new instance of the Framework. func NewFramework( t *testing.T, - spenddag spenddag.SpendDAG[iotago.TransactionID, iotago.OutputID, vote.MockedRank], + spendDAG spenddag.SpendDAG[iotago.TransactionID, iotago.OutputID, vote.MockedRank], validators *AccountsTestFramework, spendID func(string) iotago.TransactionID, resourceID func(string) iotago.OutputID, ) *Framework { f := &Framework{ - Instance: spenddag, + Instance: spendDAG, Accounts: validators, SpendID: spendID, ResourceID: resourceID, @@ -67,8 +67,8 @@ func (f *Framework) UpdateSpendParents(conflictAlias string, addedParentIDs []st // LikedInstead returns the set of conflicts that are liked instead of the given conflicts. func (f *Framework) LikedInstead(conflictAliases ...string) ds.Set[iotago.TransactionID] { var result ds.Set[iotago.TransactionID] - _ = f.Instance.ReadConsistent(func(spenddag spenddag.ReadLockedSpendDAG[iotago.TransactionID, iotago.OutputID, vote.MockedRank]) error { - result = spenddag.LikedInstead(f.SpendIDs(conflictAliases...)) + _ = f.Instance.ReadConsistent(func(spendDAG spenddag.ReadLockedSpendDAG[iotago.TransactionID, iotago.OutputID, vote.MockedRank]) error { + result = spendDAG.LikedInstead(f.SpendIDs(conflictAliases...)) return nil }) @@ -86,7 +86,7 @@ func (f *Framework) CastVotes(nodeAlias string, voteRank int, conflictAliases .. return f.Instance.CastVotes(vote.NewVote[vote.MockedRank](seat, vote.MockedRank(voteRank)), f.SpendIDs(conflictAliases...)) } -// EvictConflict evicts given conflict from the spenddag. +// EvictConflict evicts given conflict from the SpendDAG. func (f *Framework) EvictSpend(conflictAlias string) { f.Instance.EvictSpend(f.SpendID(conflictAlias)) } diff --git a/pkg/protocol/engine/mempool/spenddag/tests/tests.go b/pkg/protocol/engine/mempool/spenddag/tests/tests.go index 38ad91774..59e97adfc 100644 --- a/pkg/protocol/engine/mempool/spenddag/tests/tests.go +++ b/pkg/protocol/engine/mempool/spenddag/tests/tests.go @@ -14,24 +14,24 @@ import ( func TestAll(t *testing.T, frameworkProvider func(*testing.T) *Framework) { for testName, testCase := range map[string]func(*testing.T, *Framework){ - "CreateConflict": CreateSpend, - "ExistingConflictJoinsConflictSets": ExistingConflictJoinsSpendSets, - "JoinConflictSetTwice": JoinConflictSetTwice, - "UpdateConflictParents": UpdateSpendParents, - "LikedInstead": LikedInstead, - "CreateConflictWithoutMembers": CreateConflictWithoutMembers, - "ConflictAcceptance": ConflictAcceptance, - "CastVotes": CastVotes, - "CastVotes_VoteRank": CastVotesVoteRank, - "CastVotesAcceptance": CastVotesAcceptance, - "EvictAcceptedConflict": EvictAcceptedConflict, - "EvictRejectedConflict": EvictRejectedConflict, + "CreateSpend": CreateSpend, + "ExistingSpendJoinsConflictSets": ExistingSpendJoinsConflictSets, + "JoinConflictSetTwice": JoinConflictSetTwice, + "UpdateSpendParents": UpdateSpendParents, + "LikedInstead": LikedInstead, + "CreateSpendWithoutMembers": CreateSpendWithoutMembers, + "SpendAcceptance": SpendAcceptance, + "CastVotes": CastVotes, + "CastVotes_VoteRank": CastVotesVoteRank, + "CastVotesAcceptance": CastVotesAcceptance, + "EvictAcceptedSpend": EvictAcceptedSpend, + "EvictRejectedSpend": EvictRejectedSpend, } { t.Run(testName, func(t *testing.T) { testCase(t, frameworkProvider(t)) }) } } -func ExistingConflictJoinsSpendSets(t *testing.T, tf *Framework) { +func ExistingSpendJoinsConflictSets(t *testing.T, tf *Framework) { require.NoError(t, tf.CreateOrUpdateConflict("conflict1", []string{"resource1"})) require.NoError(t, tf.CreateOrUpdateConflict("conflict2", []string{"resource1"})) tf.Assert.ConflictSetMembers("resource1", "conflict1", "conflict2") @@ -91,7 +91,7 @@ func CreateSpend(t *testing.T, tf *Framework) { tf.Assert.Parents("conflict4", "conflict1") } -func CreateConflictWithoutMembers(t *testing.T, tf *Framework) { +func CreateSpendWithoutMembers(t *testing.T, tf *Framework) { tf.Accounts.CreateID("nodeID1") tf.Accounts.CreateID("nodeID2") tf.Accounts.CreateID("nodeID3") @@ -151,7 +151,7 @@ func LikedInstead(t *testing.T, tf *Framework) { tf.Assert.LikedInstead([]string{"conflict1", "conflict2", "conflict3", "conflict4"}, "conflict1", "conflict4") } -func ConflictAcceptance(t *testing.T, tf *Framework) { +func SpendAcceptance(t *testing.T, tf *Framework) { tf.Accounts.CreateID("nodeID1") tf.Accounts.CreateID("nodeID2") tf.Accounts.CreateID("nodeID3") @@ -353,7 +353,7 @@ func JoinConflictSetTwice(t *testing.T, tf *Framework) { tf.Assert.ConflictSets("conflict1", "resource1", "resource2", "resource3", "resource4") } -func EvictAcceptedConflict(t *testing.T, tf *Framework) { +func EvictAcceptedSpend(t *testing.T, tf *Framework) { tf.Accounts.CreateID("nodeID1") tf.Accounts.CreateID("nodeID2") tf.Accounts.CreateID("nodeID3") @@ -414,7 +414,7 @@ func EvictAcceptedConflict(t *testing.T, tf *Framework) { tf.Assert.Parents("conflict6") } -func EvictRejectedConflict(t *testing.T, tf *Framework) { +func EvictRejectedSpend(t *testing.T, tf *Framework) { conflictEvictedEventCount := 0 tf.Instance.Events().SpendEvicted.Hook(func(id iotago.TransactionID) { conflictEvictedEventCount++ diff --git a/pkg/protocol/engine/mempool/tests/testframework.go b/pkg/protocol/engine/mempool/tests/testframework.go index 66f475268..d8e5de00a 100644 --- a/pkg/protocol/engine/mempool/tests/testframework.go +++ b/pkg/protocol/engine/mempool/tests/testframework.go @@ -20,7 +20,7 @@ import ( type TestFramework struct { Instance mempool.MemPool[vote.MockedRank] - spenddag spenddag.SpendDAG[iotago.TransactionID, mempool.StateID, vote.MockedRank] + SpendDAG spenddag.SpendDAG[iotago.TransactionID, mempool.StateID, vote.MockedRank] referencesByAlias map[string]mempool.StateReference stateIDByAlias map[string]mempool.StateID @@ -35,10 +35,10 @@ type TestFramework struct { mutex syncutils.RWMutex } -func NewTestFramework(test *testing.T, instance mempool.MemPool[vote.MockedRank], spenddag spenddag.SpendDAG[iotago.TransactionID, mempool.StateID, vote.MockedRank], ledgerState *ledgertests.MockStateResolver, workers *workerpool.Group) *TestFramework { +func NewTestFramework(test *testing.T, instance mempool.MemPool[vote.MockedRank], spendDAG spenddag.SpendDAG[iotago.TransactionID, mempool.StateID, vote.MockedRank], ledgerState *ledgertests.MockStateResolver, workers *workerpool.Group) *TestFramework { t := &TestFramework{ Instance: instance, - spenddag: spenddag, + SpendDAG: spendDAG, referencesByAlias: make(map[string]mempool.StateReference), stateIDByAlias: make(map[string]mempool.StateID), signedTransactionByAlias: make(map[string]mempool.SignedTransaction), diff --git a/pkg/protocol/engine/mempool/tests/tests.go b/pkg/protocol/engine/mempool/tests/tests.go index 721122605..785c9501a 100644 --- a/pkg/protocol/engine/mempool/tests/tests.go +++ b/pkg/protocol/engine/mempool/tests/tests.go @@ -113,12 +113,12 @@ func TestProcessTransactionWithReadOnlyInputs(t *testing.T, tf *TestFramework) { return nil }) - conflictSetsTx1, exists := tf.spenddag.ConflictSets(tf.TransactionID("tx1")) + conflictSetsTx1, exists := tf.SpendDAG.ConflictSets(tf.TransactionID("tx1")) require.True(t, exists) require.Equal(t, 1, conflictSetsTx1.Size()) require.True(t, conflictSetsTx1.Has(tf.StateID("genesis"))) - conflictSetsTx2, exists := tf.spenddag.ConflictSets(tf.TransactionID("tx2")) + conflictSetsTx2, exists := tf.SpendDAG.ConflictSets(tf.TransactionID("tx2")) require.True(t, exists) require.Equal(t, 1, conflictSetsTx2.Size()) require.True(t, conflictSetsTx2.Has(tf.StateID("tx1:0"))) @@ -300,9 +300,9 @@ func TestSetTxOrphanageMultipleAttachments(t *testing.T, tf *TestFramework) { require.False(t, lo.Return2(tx2Metadata.OrphanedSlot())) require.False(t, lo.Return2(tx3Metadata.OrphanedSlot())) - require.True(t, lo.Return2(tf.spenddag.ConflictSets(tf.TransactionID("tx1")))) - require.True(t, lo.Return2(tf.spenddag.ConflictSets(tf.TransactionID("tx2")))) - require.True(t, lo.Return2(tf.spenddag.ConflictSets(tf.TransactionID("tx3")))) + require.True(t, lo.Return2(tf.SpendDAG.ConflictSets(tf.TransactionID("tx1")))) + require.True(t, lo.Return2(tf.SpendDAG.ConflictSets(tf.TransactionID("tx2")))) + require.True(t, lo.Return2(tf.SpendDAG.ConflictSets(tf.TransactionID("tx3")))) tf.Instance.Evict(2) @@ -311,9 +311,9 @@ func TestSetTxOrphanageMultipleAttachments(t *testing.T, tf *TestFramework) { require.True(t, lo.Return2(tx3Metadata.OrphanedSlot())) // All conflicts still exist, as they are kept around until MCA - require.True(t, lo.Return2(tf.spenddag.ConflictSets(tf.TransactionID("tx1")))) - require.True(t, lo.Return2(tf.spenddag.ConflictSets(tf.TransactionID("tx2")))) - require.True(t, lo.Return2(tf.spenddag.ConflictSets(tf.TransactionID("tx3")))) + require.True(t, lo.Return2(tf.SpendDAG.ConflictSets(tf.TransactionID("tx1")))) + require.True(t, lo.Return2(tf.SpendDAG.ConflictSets(tf.TransactionID("tx2")))) + require.True(t, lo.Return2(tf.SpendDAG.ConflictSets(tf.TransactionID("tx3")))) tf.RequireTransactionsEvicted(map[string]bool{"tx1": false, "tx2": false, "tx3": false}) diff --git a/pkg/protocol/engine/mempool/v1/mempool.go b/pkg/protocol/engine/mempool/v1/mempool.go index 4b00091a5..0dc3d9d1a 100644 --- a/pkg/protocol/engine/mempool/v1/mempool.go +++ b/pkg/protocol/engine/mempool/v1/mempool.go @@ -53,8 +53,8 @@ type MemPool[VoteRank spenddag.VoteRankType[VoteRank]] struct { // invalidate blocks that try to spend them. delayedOutputStateEviction *shrinkingmap.ShrinkingMap[iotago.SlotIndex, *shrinkingmap.ShrinkingMap[iotago.Identifier, *StateMetadata]] - // spenddag is the DAG that is used to keep track of the conflicts between transactions. - spenddag spenddag.SpendDAG[iotago.TransactionID, mempool.StateID, VoteRank] + // spendDAG is the DAG that is used to keep track of the conflicts between transactions. + spendDAG spenddag.SpendDAG[iotago.TransactionID, mempool.StateID, VoteRank] apiProvider iotago.APIProvider @@ -80,7 +80,7 @@ func New[VoteRank spenddag.VoteRankType[VoteRank]]( stateResolver mempool.StateResolver, mutationsFunc func(iotago.SlotIndex) (kvstore.KVStore, error), workers *workerpool.Group, - spenddag spenddag.SpendDAG[iotago.TransactionID, mempool.StateID, VoteRank], + spendDAG spenddag.SpendDAG[iotago.TransactionID, mempool.StateID, VoteRank], apiProvider iotago.APIProvider, errorHandler func(error), opts ...options.Option[MemPool[VoteRank]], @@ -97,7 +97,7 @@ func New[VoteRank spenddag.VoteRankType[VoteRank]]( executionWorkers: workers.CreatePool("executionWorkers", workerpool.WithWorkerCount(1)), delayedTransactionEviction: shrinkingmap.New[iotago.SlotIndex, ds.Set[iotago.TransactionID]](), delayedOutputStateEviction: shrinkingmap.New[iotago.SlotIndex, *shrinkingmap.ShrinkingMap[iotago.Identifier, *StateMetadata]](), - spenddag: spenddag, + spendDAG: spendDAG, apiProvider: apiProvider, errorHandler: errorHandler, signedTransactionAttached: event.New1[mempool.SignedTransactionMetadata](), @@ -334,7 +334,7 @@ func (m *MemPool[VoteRank]) bookTransaction(transaction *TransactionMetadata) { func (m *MemPool[VoteRank]) forkTransaction(transactionMetadata *TransactionMetadata, resourceIDs ds.Set[mempool.StateID]) { transactionMetadata.conflicting.Trigger() - if err := m.spenddag.UpdateConflictingResources(transactionMetadata.ID(), resourceIDs); err != nil { + if err := m.spendDAG.UpdateConflictingResources(transactionMetadata.ID(), resourceIDs); err != nil { // this is a hack, as with a reactive.Variable we cannot set it to 0 and still check if it was orphaned. transactionMetadata.orphanedSlot.Set(1) @@ -426,7 +426,7 @@ func (m *MemPool[VoteRank]) updateStateDiffs(transaction *TransactionMetadata, p } func (m *MemPool[VoteRank]) setup() { - m.spenddag.Events().SpendAccepted.Hook(func(id iotago.TransactionID) { + m.spendDAG.Events().SpendAccepted.Hook(func(id iotago.TransactionID) { if transaction, exists := m.cachedTransactions.Get(id); exists { transaction.setConflictAccepted() } @@ -449,10 +449,10 @@ func (m *MemPool[VoteRank]) setupTransaction(transaction *TransactionMetadata) { }) transaction.OnConflicting(func() { - m.spenddag.CreateSpend(transaction.ID()) + m.spendDAG.CreateSpend(transaction.ID()) unsubscribe := transaction.parentSpendIDs.OnUpdate(func(appliedMutations ds.SetMutations[iotago.TransactionID]) { - if err := m.spenddag.UpdateSpendParents(transaction.ID(), appliedMutations.AddedElements(), appliedMutations.DeletedElements()); err != nil { + if err := m.spendDAG.UpdateSpendParents(transaction.ID(), appliedMutations.AddedElements(), appliedMutations.DeletedElements()); err != nil { panic(err) } }) @@ -460,7 +460,7 @@ func (m *MemPool[VoteRank]) setupTransaction(transaction *TransactionMetadata) { transaction.OnEvicted(func() { unsubscribe() - m.spenddag.EvictSpend(transaction.ID()) + m.spendDAG.EvictSpend(transaction.ID()) }) }) diff --git a/pkg/protocol/engine/mempool/v1/mempool_test.go b/pkg/protocol/engine/mempool/v1/mempool_test.go index fa95e3576..e11b1eab9 100644 --- a/pkg/protocol/engine/mempool/v1/mempool_test.go +++ b/pkg/protocol/engine/mempool/v1/mempool_test.go @@ -37,12 +37,12 @@ func TestMempoolV1_ResourceCleanup(t *testing.T) { } ledgerState := ledgertests.New(ledgertests.NewMockedState(iotago.EmptyTransactionID, 0)) - spenddag := spenddagv1.New[iotago.TransactionID, mempool.StateID, vote.MockedRank](func() int { return 0 }) + spendDAG := spenddagv1.New[iotago.TransactionID, mempool.StateID, vote.MockedRank](func() int { return 0 }) memPoolInstance := New[vote.MockedRank](new(mempooltests.VM), func(reference mempool.StateReference) *promise.Promise[mempool.State] { return ledgerState.ResolveOutputState(reference) - }, mutationsFunc, workers, spenddag, api.SingleVersionProvider(tpkg.TestAPI), func(error) {}) + }, mutationsFunc, workers, spendDAG, api.SingleVersionProvider(tpkg.TestAPI), func(error) {}) - tf := mempooltests.NewTestFramework(t, memPoolInstance, spenddag, ledgerState, workers) + tf := mempooltests.NewTestFramework(t, memPoolInstance, spendDAG, ledgerState, workers) issueTransactions := func(startIndex, transactionCount int, prevStateAlias string) (int, string) { index := startIndex @@ -141,7 +141,7 @@ func newTestFramework(t *testing.T) *mempooltests.TestFramework { workers := workerpool.NewGroup(t.Name()) ledgerState := ledgertests.New(ledgertests.NewMockedState(iotago.EmptyTransactionID, 0)) - spenddag := spenddagv1.New[iotago.TransactionID, mempool.StateID, vote.MockedRank](account.NewAccounts().SelectCommittee().SeatCount) + spendDAG := spenddagv1.New[iotago.TransactionID, mempool.StateID, vote.MockedRank](account.NewAccounts().SelectCommittee().SeatCount) mutationsFunc := func(index iotago.SlotIndex) (kvstore.KVStore, error) { return mapdb.NewMapDB(), nil @@ -149,5 +149,5 @@ func newTestFramework(t *testing.T) *mempooltests.TestFramework { return mempooltests.NewTestFramework(t, New[vote.MockedRank](new(mempooltests.VM), func(reference mempool.StateReference) *promise.Promise[mempool.State] { return ledgerState.ResolveOutputState(reference) - }, mutationsFunc, workers, spenddag, api.SingleVersionProvider(tpkg.TestAPI), func(error) {}), spenddag, ledgerState, workers) + }, mutationsFunc, workers, spendDAG, api.SingleVersionProvider(tpkg.TestAPI), func(error) {}), spendDAG, ledgerState, workers) } diff --git a/pkg/protocol/engine/tipselection/v1/tip_selection.go b/pkg/protocol/engine/tipselection/v1/tip_selection.go index fbc7ab391..4489f4fba 100644 --- a/pkg/protocol/engine/tipselection/v1/tip_selection.go +++ b/pkg/protocol/engine/tipselection/v1/tip_selection.go @@ -26,8 +26,8 @@ type TipSelection struct { // tipManager is the TipManager that is used to access the tip related metadata. tipManager tipmanager.TipManager - // conflictDAG is the ConflictDAG that is used to track conflicts. - conflictDAG spenddag.SpendDAG[iotago.TransactionID, mempool.StateID, ledger.BlockVoteRank] + // spendDAG is the SpendDAG that is used to track spends. + spendDAG spenddag.SpendDAG[iotago.TransactionID, mempool.StateID, ledger.BlockVoteRank] // rootBlocks is a function that returns the current root blocks. rootBlocks func() iotago.BlockIDs @@ -78,9 +78,9 @@ func New(opts ...options.Option[TipSelection]) *TipSelection { // // This method is separated from the constructor so the TipSelection can be initialized lazily after all dependencies // are available. -func (t *TipSelection) Construct(tipManager tipmanager.TipManager, conflictDAG spenddag.SpendDAG[iotago.TransactionID, mempool.StateID, ledger.BlockVoteRank], transactionMetadataRetriever func(iotago.TransactionID) (mempool.TransactionMetadata, bool), rootBlocksRetriever func() iotago.BlockIDs, livenessThresholdFunc func(tipmanager.TipMetadata) time.Duration) *TipSelection { +func (t *TipSelection) Construct(tipManager tipmanager.TipManager, spendDAG spenddag.SpendDAG[iotago.TransactionID, mempool.StateID, ledger.BlockVoteRank], transactionMetadataRetriever func(iotago.TransactionID) (mempool.TransactionMetadata, bool), rootBlocksRetriever func() iotago.BlockIDs, livenessThresholdFunc func(tipmanager.TipMetadata) time.Duration) *TipSelection { t.tipManager = tipManager - t.conflictDAG = conflictDAG + t.spendDAG = spendDAG t.transactionMetadata = transactionMetadataRetriever t.rootBlocks = rootBlocksRetriever t.livenessThreshold = livenessThresholdFunc @@ -103,7 +103,7 @@ func (t *TipSelection) SelectTips(amount int) (references model.ParentReferences references = make(model.ParentReferences) strongParents := ds.NewSet[iotago.BlockID]() shallowLikesParents := ds.NewSet[iotago.BlockID]() - _ = t.conflictDAG.ReadConsistent(func(_ spenddag.ReadLockedSpendDAG[iotago.TransactionID, mempool.StateID, ledger.BlockVoteRank]) error { + _ = t.spendDAG.ReadConsistent(func(_ spenddag.ReadLockedSpendDAG[iotago.TransactionID, mempool.StateID, ledger.BlockVoteRank]) error { previousLikedInsteadConflicts := ds.NewSet[iotago.TransactionID]() if t.collectReferences(references, iotago.StrongParentType, t.tipManager.StrongTips, func(tip tipmanager.TipMetadata) { @@ -177,7 +177,7 @@ func (t *TipSelection) classifyTip(tipMetadata tipmanager.TipMetadata) { // likedInsteadReferences returns the liked instead references that are required to be able to reference the given tip. func (t *TipSelection) likedInsteadReferences(likedConflicts ds.Set[iotago.TransactionID], tipMetadata tipmanager.TipMetadata) (references []iotago.BlockID, updatedLikedConflicts ds.Set[iotago.TransactionID], err error) { necessaryReferences := make(map[iotago.TransactionID]iotago.BlockID) - if err = t.conflictDAG.LikedInstead(tipMetadata.Block().SpendIDs()).ForEach(func(likedSpendID iotago.TransactionID) error { + if err = t.spendDAG.LikedInstead(tipMetadata.Block().SpendIDs()).ForEach(func(likedSpendID iotago.TransactionID) error { transactionMetadata, exists := t.transactionMetadata(likedSpendID) if !exists { return ierrors.Errorf("transaction required for liked instead reference (%s) not found in mem-pool", likedSpendID) @@ -233,12 +233,12 @@ func (t *TipSelection) collectReferences(references model.ParentReferences, pare // isValidStrongTip checks if the given block is a valid strong tip. func (t *TipSelection) isValidStrongTip(block *blocks.Block) bool { - return !t.conflictDAG.AcceptanceState(block.SpendIDs()).IsRejected() + return !t.spendDAG.AcceptanceState(block.SpendIDs()).IsRejected() } // isValidWeakTip checks if the given block is a valid weak tip. func (t *TipSelection) isValidWeakTip(block *blocks.Block) bool { - return t.conflictDAG.LikedInstead(block.PayloadSpendIDs()).Size() == 0 + return t.spendDAG.LikedInstead(block.PayloadSpendIDs()).Size() == 0 } // triggerLivenessThreshold triggers the liveness threshold for all tips that have reached the given threshold.