From 3d6577838cabb095ad377938f97b1d128c5484a0 Mon Sep 17 00:00:00 2001 From: whyrusleeping Date: Wed, 11 Mar 2020 00:29:17 -0700 Subject: [PATCH] move power deduction out of the loop --- chain/gen/genesis/miners.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/chain/gen/genesis/miners.go b/chain/gen/genesis/miners.go index f8cec684c..7ac12b0d5 100644 --- a/chain/gen/genesis/miners.go +++ b/chain/gen/genesis/miners.go @@ -193,12 +193,6 @@ func SetupStorageMiners(ctx context.Context, cs *store.ChainStore, sroot cid.Cid } } - // TODO: to avoid division by zero, we set the initial power actor power to 1, this adjusts that back down so the accounting is accurate. - err = vm.MutateState(ctx, builtin.StoragePowerActorAddr, func(cst cbor.IpldStore, st *power.State) error { - st.TotalNetworkPower = big.Sub(st.TotalNetworkPower, big.NewInt(1)) - return nil - }) - // Put sectors to miner sector sets { newSectorInfo := &miner.SectorOnChainInfo{ @@ -257,6 +251,12 @@ func SetupStorageMiners(ctx context.Context, cs *store.ChainStore, sroot cid.Cid } + // TODO: to avoid division by zero, we set the initial power actor power to 1, this adjusts that back down so the accounting is accurate. + err = vm.MutateState(ctx, builtin.StoragePowerActorAddr, func(cst cbor.IpldStore, st *power.State) error { + st.TotalNetworkPower = big.Sub(st.TotalNetworkPower, big.NewInt(1)) + return nil + }) + c, err := vm.Flush(ctx) return c, err }