diff --git a/pkg/testsuite/mock/wallet_transactions.go b/pkg/testsuite/mock/wallet_transactions.go index 33b8daf58..e0d0afafd 100644 --- a/pkg/testsuite/mock/wallet_transactions.go +++ b/pkg/testsuite/mock/wallet_transactions.go @@ -428,6 +428,20 @@ func (w *Wallet) TransitionImplicitAccountToAccountOutput(transactionName string AccountID(implicitAccountID), opts).MustBuild() + commitment := w.GetNewBlockIssuanceResponse().LatestCommitment + commitmentSlot := commitment.Slot + // the slot of the commitment should be the same epoch of StartEpoch of the staking feature + oldStakingFeature := accountOutput.FeatureSet().Staking() + if oldStakingFeature != nil { + expectedStartEpoch := w.StakingStartEpochFromSlot(commitmentSlot) + if expectedStartEpoch != oldStakingFeature.StartEpoch { + expectedEndEpoch := expectedStartEpoch + w.Client.CommittedAPI().ProtocolParameters().StakingUnbondingPeriod() + 1 + accountOutput = builder.NewAccountOutputBuilderFromPrevious(accountOutput). + Staking(oldStakingFeature.StakedAmount, oldStakingFeature.FixedCost, expectedStartEpoch, expectedEndEpoch). + MustBuild() + } + } + signedTransaction := w.createSignedTransactionWithOptions( transactionName, []uint32{0}, @@ -435,7 +449,7 @@ func (w *Wallet) TransitionImplicitAccountToAccountOutput(transactionName string AccountID: implicitAccountID, }), WithCommitmentInput(&iotago.CommitmentInput{ - CommitmentID: w.GetNewBlockIssuanceResponse().LatestCommitment.MustID(), + CommitmentID: commitment.MustID(), }), WithInputs(inputs...), WithOutputs(accountOutput),