add StateGetNetworkParams api

This commit is contained in:
simlecode
2022-05-05 14:16:30 +08:00
parent d8f1380ec9
commit 962e37e893
20 changed files with 306 additions and 39 deletions
+37
View File
@@ -19,6 +19,7 @@ import (
"github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/go-state-types/dline"
"github.com/filecoin-project/go-state-types/network"
"github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper"
"github.com/filecoin-project/lotus/api"
@@ -1438,3 +1439,39 @@ func (a *StateAPI) StateGetRandomnessFromBeacon(ctx context.Context, personaliza
return a.StateManager.GetRandomnessFromBeacon(ctx, personalization, randEpoch, entropy, tsk)
}
func (a *StateAPI) StateGetNetworkParams(ctx context.Context) (*api.NetworkParams, error) {
networkName, err := a.StateNetworkName(ctx)
if err != nil {
return nil, err
}
return &api.NetworkParams{
NetworkName: networkName,
BlockDelaySecs: build.BlockDelaySecs,
ConsensusMinerMinPower: build.ConsensusMinerMinPower,
SupportedProofTypes: build.SupportedProofTypes,
PreCommitChallengeDelay: build.PreCommitChallengeDelay,
ForkUpgradeParams: api.ForkUpgradeParams{
UpgradeSmokeHeight: build.UpgradeSmokeHeight,
UpgradeBreezeHeight: build.UpgradeBreezeHeight,
UpgradeIgnitionHeight: build.UpgradeIgnitionHeight,
UpgradeLiftoffHeight: build.UpgradeLiftoffHeight,
UpgradeAssemblyHeight: build.UpgradeAssemblyHeight,
UpgradeRefuelHeight: build.UpgradeRefuelHeight,
UpgradeTapeHeight: build.UpgradeTapeHeight,
UpgradeKumquatHeight: build.UpgradeKumquatHeight,
BreezeGasTampingDuration: build.BreezeGasTampingDuration,
UpgradeCalicoHeight: build.UpgradeCalicoHeight,
UpgradePersianHeight: build.UpgradePersianHeight,
UpgradeOrangeHeight: build.UpgradeOrangeHeight,
UpgradeClausHeight: build.UpgradeClausHeight,
UpgradeTrustHeight: build.UpgradeTrustHeight,
UpgradeNorwegianHeight: build.UpgradeNorwegianHeight,
UpgradeTurboHeight: build.UpgradeTurboHeight,
UpgradeHyperdriveHeight: build.UpgradeHyperdriveHeight,
UpgradeChocolateHeight: build.UpgradeChocolateHeight,
UpgradeOhSnapHeight: build.UpgradeOhSnapHeight,
},
}, nil
}