refactor: change network upgrade NodeOption to node.Option

This commit is contained in:
Dirk McCormick 2021-06-15 13:53:41 +02:00
parent 4cd0964ab1
commit 5ce482b817
2 changed files with 5 additions and 10 deletions

View File

@ -35,7 +35,8 @@ func runTestCCUpgrade(t *testing.T, upgradeHeight abi.ChainEpoch) {
ctx := context.Background()
blockTime := 5 * time.Millisecond
client, miner, ens := kit2.EnsembleMinimal(t, kit2.MockProofs(), kit2.LatestActorsAt(upgradeHeight))
opts := kit2.ConstructorOpts(kit2.LatestActorsAt(upgradeHeight))
client, miner, ens := kit2.EnsembleMinimal(t, kit2.MockProofs(), opts)
ens.InterconnectAll().BeginMining(blockTime)
maddr, err := miner.ActorAddress(ctx)

View File

@ -7,12 +7,12 @@ import (
"github.com/filecoin-project/lotus/node"
)
func LatestActorsAt(upgradeHeight abi.ChainEpoch) NodeOpt {
func LatestActorsAt(upgradeHeight abi.ChainEpoch) node.Option {
// Attention: Update this when introducing new actor versions or your tests will be sad
return NetworkUpgradeAt(network.Version13, upgradeHeight)
}
func NetworkUpgradeAt(version network.Version, upgradeHeight abi.ChainEpoch) NodeOpt {
func NetworkUpgradeAt(version network.Version, upgradeHeight abi.ChainEpoch) node.Option {
fullSchedule := stmgr.UpgradeSchedule{{
// prepare for upgrade.
Network: network.Version9,
@ -45,13 +45,7 @@ func NetworkUpgradeAt(version network.Version, upgradeHeight abi.ChainEpoch) Nod
schedule[len(schedule)-1].Height = upgradeHeight
}
return func(opts *nodeOpts) error {
opts.extraNodeOpts = []node.Option{
node.Override(new(stmgr.UpgradeSchedule), schedule),
}
return nil
}
//return node.Override(new(stmgr.UpgradeSchedule), schedule)
return node.Override(new(stmgr.UpgradeSchedule), schedule)
}
func SDRUpgradeAt(calico, persian abi.ChainEpoch) node.Option {