forked from TrueCloudLab/frostfs-node
[#1654] adm: Make 'morph-init' idempotent
Signed-off-by: Alexander Chuprov <a.chuprov@yadro.com>
This commit is contained in:
parent
003d568ae2
commit
37972a91c1
1 changed files with 7 additions and 4 deletions
|
@ -83,11 +83,14 @@ func transferFunds(c *helper.InitializeContext) error {
|
||||||
// transferFundsFinished checks balances of accounts we transfer GAS to.
|
// transferFundsFinished checks balances of accounts we transfer GAS to.
|
||||||
// The stage is considered finished if the balance is greater than the half of what we need to transfer.
|
// The stage is considered finished if the balance is greater than the half of what we need to transfer.
|
||||||
func transferFundsFinished(c *helper.InitializeContext) (bool, error) {
|
func transferFundsFinished(c *helper.InitializeContext) (bool, error) {
|
||||||
acc := c.Accounts[0]
|
|
||||||
|
|
||||||
r := nep17.NewReader(c.ReadOnlyInvoker, gas.Hash)
|
r := nep17.NewReader(c.ReadOnlyInvoker, gas.Hash)
|
||||||
res, err := r.BalanceOf(acc.Contract.ScriptHash())
|
res, err := r.BalanceOf(c.ConsensusAcc.ScriptHash())
|
||||||
if err != nil || res.Cmp(big.NewInt(initialAlphabetGASAmount/2)) != 1 {
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
version, err := c.Client.GetVersion()
|
||||||
|
if err != nil || res.Cmp(big.NewInt(int64(version.Protocol.InitialGasDistribution))) != -1 {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue