forked from TrueCloudLab/frostfs-node
[#338] adm: Drop notaryless code
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
cf8531ccd7
commit
03ab0ca30f
1 changed files with 14 additions and 37 deletions
|
@ -37,11 +37,6 @@ const (
|
||||||
dumpBalancesAlphabetFlag = "alphabet"
|
dumpBalancesAlphabetFlag = "alphabet"
|
||||||
dumpBalancesProxyFlag = "proxy"
|
dumpBalancesProxyFlag = "proxy"
|
||||||
dumpBalancesUseScriptHashFlag = "script-hash"
|
dumpBalancesUseScriptHashFlag = "script-hash"
|
||||||
|
|
||||||
// notaryEnabled signifies whether contracts were deployed in a notary-enabled environment.
|
|
||||||
// The setting is here to simplify testing and building the command for testnet (notary currently disabled).
|
|
||||||
// It will be removed eventually.
|
|
||||||
notaryEnabled = true
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func dumpBalances(cmd *cobra.Command, _ []string) error {
|
func dumpBalances(cmd *cobra.Command, _ []string) error {
|
||||||
|
@ -60,7 +55,7 @@ func dumpBalances(cmd *cobra.Command, _ []string) error {
|
||||||
|
|
||||||
inv := invoker.New(c, nil)
|
inv := invoker.New(c, nil)
|
||||||
|
|
||||||
if !notaryEnabled || dumpStorage || dumpAlphabet || dumpProxy {
|
if dumpStorage || dumpAlphabet || dumpProxy {
|
||||||
nnsCs, err = c.GetContractStateByID(1)
|
nnsCs, err = c.GetContractStateByID(1)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("can't get NNS contract info: %w", err)
|
return fmt.Errorf("can't get NNS contract info: %w", err)
|
||||||
|
@ -72,7 +67,7 @@ func dumpBalances(cmd *cobra.Command, _ []string) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
irList, err := fetchIRNodes(c, nmHash, rolemgmt.Hash)
|
irList, err := fetchIRNodes(c, rolemgmt.Hash)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -187,12 +182,9 @@ func printAlphabetContractBalances(cmd *cobra.Command, c Client, inv *invoker.In
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func fetchIRNodes(c Client, nmHash, desigHash util.Uint160) ([]accBalancePair, error) {
|
func fetchIRNodes(c Client, desigHash util.Uint160) ([]accBalancePair, error) {
|
||||||
var irList []accBalancePair
|
|
||||||
|
|
||||||
inv := invoker.New(c, nil)
|
inv := invoker.New(c, nil)
|
||||||
|
|
||||||
if notaryEnabled {
|
|
||||||
height, err := c.GetBlockCount()
|
height, err := c.GetBlockCount()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("can't get block height: %w", err)
|
return nil, fmt.Errorf("can't get block height: %w", err)
|
||||||
|
@ -203,25 +195,10 @@ func fetchIRNodes(c Client, nmHash, desigHash util.Uint160) ([]accBalancePair, e
|
||||||
return nil, errors.New("can't fetch list of IR nodes from the netmap contract")
|
return nil, errors.New("can't fetch list of IR nodes from the netmap contract")
|
||||||
}
|
}
|
||||||
|
|
||||||
irList = make([]accBalancePair, len(arr))
|
irList := make([]accBalancePair, len(arr))
|
||||||
for i := range arr {
|
for i := range arr {
|
||||||
irList[i].scriptHash = arr[i].GetScriptHash()
|
irList[i].scriptHash = arr[i].GetScriptHash()
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
arr, err := unwrap.ArrayOfBytes(inv.Call(nmHash, "innerRingList"))
|
|
||||||
if err != nil {
|
|
||||||
return nil, errors.New("can't fetch list of IR nodes from the netmap contract")
|
|
||||||
}
|
|
||||||
|
|
||||||
irList = make([]accBalancePair, len(arr))
|
|
||||||
for i := range arr {
|
|
||||||
pub, err := keys.NewPublicKeyFromBytes(arr[i], elliptic.P256())
|
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("can't parse IR node public key: %w", err)
|
|
||||||
}
|
|
||||||
irList[i].scriptHash = pub.GetScriptHash()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return irList, nil
|
return irList, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue