[#346] adm: fix race in wallet generation #347
1 changed files with 4 additions and 2 deletions
|
@ -101,11 +101,13 @@ func initializeWallets(v *viper.Viper, walletDir string, size int) ([]string, er
|
||||||
bftCount := smartcontract.GetDefaultHonestNodeCount(size)
|
bftCount := smartcontract.GetDefaultHonestNodeCount(size)
|
||||||
for i := range wallets {
|
for i := range wallets {
|
||||||
i := i
|
i := i
|
||||||
|
ps := make(keys.PublicKeys, len(pubs))
|
||||||
|
copy(ps, pubs)
|
||||||
errG.Go(func() error {
|
errG.Go(func() error {
|
||||||
if err := addMultisigAccount(wallets[i], majCount, committeeAccountName, passwords[i], pubs); err != nil {
|
if err := addMultisigAccount(wallets[i], majCount, committeeAccountName, passwords[i], ps); err != nil {
|
||||||
return fmt.Errorf("can't create committee account: %w", err)
|
return fmt.Errorf("can't create committee account: %w", err)
|
||||||
}
|
}
|
||||||
if err := addMultisigAccount(wallets[i], bftCount, consensusAccountName, passwords[i], pubs); err != nil {
|
if err := addMultisigAccount(wallets[i], bftCount, consensusAccountName, passwords[i], ps); err != nil {
|
||||||
return fmt.Errorf("can't create consentus account: %w", err)
|
return fmt.Errorf("can't create consentus account: %w", err)
|
||||||
}
|
}
|
||||||
if err := wallets[i].SavePretty(); err != nil {
|
if err := wallets[i].SavePretty(); err != nil {
|
||||||
|
|
Loading…
Reference in a new issue