forked from TrueCloudLab/frostfs-node
[#128] innerring: Add GAS pouring mechanism for a configurable list of wallets
Signed-off-by: Artem Tataurov <a.tataurov@yadro.com>
This commit is contained in:
parent
abd21f8099
commit
db3ccd2762
7 changed files with 83 additions and 1 deletions
|
@ -49,7 +49,9 @@ import (
|
|||
"github.com/nspcc-dev/neo-go/pkg/core/block"
|
||||
"github.com/nspcc-dev/neo-go/pkg/core/transaction"
|
||||
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
|
||||
"github.com/nspcc-dev/neo-go/pkg/encoding/address"
|
||||
"github.com/nspcc-dev/neo-go/pkg/encoding/fixedn"
|
||||
"github.com/nspcc-dev/neo-go/pkg/util"
|
||||
"github.com/panjf2000/ants/v2"
|
||||
"github.com/spf13/viper"
|
||||
"go.uber.org/atomic"
|
||||
|
@ -803,8 +805,14 @@ func New(ctx context.Context, log *logger.Logger, cfg *viper.Viper, errChan chan
|
|||
}
|
||||
}
|
||||
|
||||
parsedWallets, err := parseWalletAddressesFromStrings(cfg.GetStringSlice("emit.extra_wallets"))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// create alphabet processor
|
||||
alphabetProcessor, err := alphabet.New(&alphabet.Params{
|
||||
ParsedWallets: parsedWallets,
|
||||
Log: log,
|
||||
PoolSize: cfg.GetInt("workers.alphabet"),
|
||||
AlphabetContracts: server.contracts.alphabet,
|
||||
|
@ -1034,6 +1042,24 @@ func ParsePublicKeysFromStrings(pubKeys []string) (keys.PublicKeys, error) {
|
|||
return publicKeys, nil
|
||||
}
|
||||
|
||||
// parseWalletAddressesFromStrings returns a slice of util.Uint160 from a slice
|
||||
// of strings.
|
||||
func parseWalletAddressesFromStrings(wallets []string) ([]util.Uint160, error) {
|
||||
if len(wallets) == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
var err error
|
||||
extraWallets := make([]util.Uint160, len(wallets))
|
||||
for i := range wallets {
|
||||
extraWallets[i], err = address.StringToUint160(wallets[i])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return extraWallets, nil
|
||||
}
|
||||
|
||||
func (s *Server) initConfigFromBlockchain() error {
|
||||
// get current epoch
|
||||
epoch, err := s.netmapClient.Epoch()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue