Skip to content

Commit

Permalink
Merge pull request #609 from iotaledger/fix-main-engine-getter
Browse files Browse the repository at this point in the history
Update main engine getters
  • Loading branch information
PhilippGackstatter authored Dec 5, 2023
2 parents 6f6d502 + 60781ee commit b13c7de
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions pkg/testsuite/accounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@ func (t *TestSuite) AssertAccountStake(accountID iotago.AccountID, validatorStak
nodes ...*mock.Node) {
for _, node := range nodes {
t.Eventually(func() error {
actualAccountData, exists, err := node.Protocol.MainEngineInstance().Ledger.Account(accountID, node.Protocol.MainEngineInstance().SyncManager.LatestCommitment().Slot())

actualAccountData, exists, err := node.Protocol.Engines.Main.Get().Ledger.Account(accountID, node.Protocol.Engines.Main.Get().SyncManager.LatestCommitment().Slot())
if err != nil {
return ierrors.Wrap(err, "AssertAccountData: failed to load account data")
}
if !exists {
return ierrors.Errorf("AssertAccountData: %s: account %s does not exist with latest committed slot %d", node.Name, accountID, node.Protocol.MainEngineInstance().SyncManager.LatestCommitment().Slot())
return ierrors.Errorf("AssertAccountData: %s: account %s does not exist with latest committed slot %d", node.Name, accountID, node.Protocol.Engines.Main.Get().SyncManager.LatestCommitment().Slot())
}

if accountID != actualAccountData.ID {
Expand Down
4 changes: 2 additions & 2 deletions pkg/testsuite/mock/wallet_transactions.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func (w *Wallet) CreateDelegationFromInput(transactionName string, inputName str
}

func (w *Wallet) DelegationStartFromSlot(slot iotago.SlotIndex) iotago.EpochIndex {
latestCommitment := w.Node.Protocol.MainEngineInstance().Storage.Settings().LatestCommitment()
latestCommitment := w.Node.Protocol.Engines.Main.Get().Storage.Settings().LatestCommitment()
apiForSlot := w.Node.Protocol.APIForSlot(slot)

pastBoundedSlotIndex := latestCommitment.Slot() + apiForSlot.ProtocolParameters().MaxCommittableAge()
Expand All @@ -117,7 +117,7 @@ func (w *Wallet) DelegationStartFromSlot(slot iotago.SlotIndex) iotago.EpochInde
}

func (w *Wallet) DelegationEndFromSlot(slot iotago.SlotIndex) iotago.EpochIndex {
latestCommitment := w.Node.Protocol.MainEngineInstance().Storage.Settings().LatestCommitment()
latestCommitment := w.Node.Protocol.Engines.Main.Get().Storage.Settings().LatestCommitment()
apiForSlot := w.Node.Protocol.APIForSlot(slot)

futureBoundedSlotIndex := latestCommitment.Slot() + apiForSlot.ProtocolParameters().MinCommittableAge()
Expand Down

0 comments on commit b13c7de

Please sign in to comment.