Merge pull request #1754 from filecoin-project/fix/initial-pledge

state: Calculate slightly larger initial pledge
This commit is contained in:
Łukasz Magiera 2020-05-15 20:15:36 +02:00 committed by GitHub
commit 9eb2399539
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -624,6 +624,9 @@ func (a *StateAPI) MsigGetAvailableBalance(ctx context.Context, addr address.Add
return types.BigSub(act.Balance, minBalance), nil
}
var initialPledgeNum = types.NewInt(103)
var initialPledgeDen = types.NewInt(100)
func (a *StateAPI) StateMinerInitialPledgeCollateral(ctx context.Context, maddr address.Address, snum abi.SectorNumber, tsk types.TipSetKey) (types.BigInt, error) {
ts, err := a.Chain.GetTipSetFromKey(tsk)
if err != nil {
@ -715,7 +718,7 @@ func (a *StateAPI) StateMinerInitialPledgeCollateral(ctx context.Context, maddr
}
}
return initialPledge, nil
return types.BigDiv(types.BigMul(initialPledge, initialPledgeNum), initialPledgeDen), nil
}
func (a *StateAPI) StateMinerAvailableBalance(ctx context.Context, maddr address.Address, tsk types.TipSetKey) (types.BigInt, error) {