From ddf3f5683dabae984e6e06280dd9a4d307f8e1d6 Mon Sep 17 00:00:00 2001 From: schonex Date: Sun, 3 Sep 2023 12:04:25 -0400 Subject: [PATCH 1/2] add a wallet-name in leiu of a UUID for distributed wallets --- cmd/split/helpers.go | 5 +++++ utils/config.go | 1 + 2 files changed, 6 insertions(+) diff --git a/cmd/split/helpers.go b/cmd/split/helpers.go index 8131612..31693e8 100644 --- a/cmd/split/helpers.go +++ b/cmd/split/helpers.go @@ -22,6 +22,7 @@ type SplitRuntime struct { threshold uint32 walletsMap map[uint64]utils.DWallet peersIDs []uint64 + walletName string } type AccountExtends struct { @@ -64,6 +65,7 @@ func newSplitRuntime() (*SplitRuntime, error) { sr.dWalletsPath = dWalletConfig.Path sr.ndWalletsPath = ndWalletConfig.Path sr.threshold = dWalletConfig.Threshold + sr.walletName = dWalletConfig.WalletName utils.LogSplit.Debug().Msgf("getting input passwords from %s", ndWalletConfig.Passphrases) sr.passphrasesIn, err = utils.GetAccountsPasswords(ndWalletConfig.Passphrases) if err != nil { @@ -96,6 +98,9 @@ func (sr *SplitRuntime) validate() error { func (sr *SplitRuntime) createWallets() error { walletName := uuid.New().String() + if sr.walletName != "" { + walletName = sr.walletName + } for id, peer := range sr.peers { res, err := regexp.Compile(`:.*`) if err != nil { diff --git a/utils/config.go b/utils/config.go index fa32f92..da35530 100644 --- a/utils/config.go +++ b/utils/config.go @@ -17,6 +17,7 @@ type DWalletConfig struct { Passphrases string Peers Peers Threshold uint32 + WalletName string } func GetAccountsPasswords(path string) ([][]byte, error) { From 149396e882db8388e43de5ac40220c87bd834db9 Mon Sep 17 00:00:00 2001 From: schonex Date: Sun, 3 Sep 2023 12:07:38 -0400 Subject: [PATCH 2/2] updated README to reflect new configuration option --- README.MD | 1 + 1 file changed, 1 insertion(+) diff --git a/README.MD b/README.MD index b6067f3..7339069 100644 --- a/README.MD +++ b/README.MD @@ -49,6 +49,7 @@ distributed-wallets: #Distributed-wallets section path: ./wallet #Path to distributed wallet (Default: None) passphrases: ./passphrases.txt #Path to file containing passphrases for unlocking/locking accounts (Default: None) threshold: 2 #Threshlod value (Default: None) + walletname: myDKWallet peers: #Peers dict, number of peers must be greater than threshold value (Default: None) 10: old1:9091 20: old2:9091