[#923] adm: Move netconfig merge to a separate function
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
61a3afbf9b
commit
d2d850786d
1 changed files with 21 additions and 14 deletions
|
@ -563,22 +563,9 @@ func (c *initializeContext) getContractDeployData(ctrName string, keysParam []an
|
|||
case netmapContract:
|
||||
md := getDefaultNetmapContractConfigMap()
|
||||
if method == updateMethodName {
|
||||
arr, err := c.getNetConfigFromNetmapContract()
|
||||
if err != nil {
|
||||
if err := c.mergeNetmapConfig(md); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
m, err := parseConfigFromNetmapContract(arr)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for k, v := range m {
|
||||
for _, key := range netmapConfigKeys {
|
||||
if k == key {
|
||||
md[k] = v
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var configParam []any
|
||||
|
@ -618,6 +605,26 @@ func (c *initializeContext) getNetConfigFromNetmapContract() ([]stackitem.Item,
|
|||
return arr, err
|
||||
}
|
||||
|
||||
func (c *initializeContext) mergeNetmapConfig(md map[string]any) error {
|
||||
arr, err := c.getNetConfigFromNetmapContract()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
m, err := parseConfigFromNetmapContract(arr)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for k, v := range m {
|
||||
for _, key := range netmapConfigKeys {
|
||||
if k == key {
|
||||
md[k] = v
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *initializeContext) getAlphabetDeployItems(i, n int) []any {
|
||||
items := make([]any, 5)
|
||||
items[0] = c.Contracts[netmapContract].Hash
|
||||
|
|
Loading…
Reference in a new issue