fix: address expensive fork review
This commit is contained in:
parent
165735d01a
commit
e6902304d5
@ -211,11 +211,9 @@ func (sm *StateManager) handleStateForks(ctx context.Context, root cid.Cid, heig
|
|||||||
return retCid, nil
|
return retCid, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns true if executing the current tipset would trigger an expensive fork.
|
// Returns true executing tipsets between the specified heights would trigger an expensive
|
||||||
//
|
// migration. NOTE: migrations occuring _at_ the target height are not included, as they're executed
|
||||||
// - If the tipset is the genesis, this function always returns false.
|
// _after_ the target height.
|
||||||
// - If inclusive is true, this function will also return true if applying a message on-top-of the
|
|
||||||
// tipset would trigger a fork.
|
|
||||||
func (sm *StateManager) hasExpensiveForkBetween(parent, height abi.ChainEpoch) bool {
|
func (sm *StateManager) hasExpensiveForkBetween(parent, height abi.ChainEpoch) bool {
|
||||||
for h := parent; h < height; h++ {
|
for h := parent; h < height; h++ {
|
||||||
if _, ok := sm.expensiveUpgrades[h]; ok {
|
if _, ok := sm.expensiveUpgrades[h]; ok {
|
||||||
|
@ -310,7 +310,7 @@ func testForkRefuseCall(t *testing.T, nullsBefore, nullsAfter int) {
|
|||||||
nullStart := abi.ChainEpoch(testForkHeight - nullsBefore)
|
nullStart := abi.ChainEpoch(testForkHeight - nullsBefore)
|
||||||
nullLength := abi.ChainEpoch(nullsBefore + nullsAfter)
|
nullLength := abi.ChainEpoch(nullsBefore + nullsAfter)
|
||||||
|
|
||||||
for i := 0; i < 50; i++ {
|
for i := 0; i < testForkHeight*2; i++ {
|
||||||
pts := cg.CurTipset.TipSet()
|
pts := cg.CurTipset.TipSet()
|
||||||
skip := abi.ChainEpoch(0)
|
skip := abi.ChainEpoch(0)
|
||||||
if pts.Height() == nullStart {
|
if pts.Height() == nullStart {
|
||||||
|
Loading…
Reference in New Issue
Block a user