Skip to content

Commit

Permalink
Change the default wallet initialization.
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrm50 committed Nov 8, 2023
1 parent 02c1f46 commit 0c1f4a0
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions pkg/testsuite/testsuite.go
Original file line number Diff line number Diff line change
Expand Up @@ -410,11 +410,7 @@ func (t *TestSuite) addWallet(name string, node *mock.Node, accountID iotago.Acc
}

func (t *TestSuite) DefaultWallet() *mock.Wallet {
if t.wallets.Has("default") {
return lo.Return1(t.wallets.Get("default"))
}

_, defaultWallet, exists := t.wallets.Head()
defaultWallet, exists := t.wallets.Get("default")
if !exists {
return nil
}
Expand All @@ -426,6 +422,16 @@ func (t *TestSuite) Run(failOnBlockFiltered bool, nodesOptions ...map[string][]o
t.mutex.Lock()
defer t.mutex.Unlock()

// Add default wallet by default when creating the first node.
if !t.wallets.Has("default") {
_, node, exists := t.nodes.Head()
if !exists {
panic("at least one node is needed to create a default wallet")
}

t.AddGenesisWallet("default", node)
}

// Create accounts for any block issuer nodes added before starting the network.
if t.optsAccounts != nil {
t.optsSnapshotOptions = append(t.optsSnapshotOptions, snapshotcreator.WithAccounts(lo.Map(t.optsAccounts, func(accountDetails snapshotcreator.AccountDetails) snapshotcreator.AccountDetails {
Expand Down

0 comments on commit 0c1f4a0

Please sign in to comment.