fix: miner balance is not enough, so that ProveCommitAggregate msg exec failed

This commit is contained in:
Jerry 2021-06-29 14:06:41 +08:00 committed by Łukasz Magiera
parent af1dd7d2ed
commit a4f65bed41

View File

@ -309,14 +309,16 @@ func (b *CommitBatcher) processBatch(cfg sealiface.Config) ([]sealiface.CommitBa
aggFee := policy.AggregateNetworkFee(nv, len(infos), bf) aggFee := policy.AggregateNetworkFee(nv, len(infos), bf)
goodFunds := big.Add(maxFee, big.Add(collateral, aggFee)) needFunds := big.Add(collateral, aggFee)
from, _, err := b.addrSel(b.mctx, mi, api.CommitAddr, goodFunds, collateral) goodFunds := big.Add(maxFee, needFunds)
from, _, err := b.addrSel(b.mctx, mi, api.CommitAddr, goodFunds, needFunds)
if err != nil { if err != nil {
return []sealiface.CommitBatchRes{res}, xerrors.Errorf("no good address found: %w", err) return []sealiface.CommitBatchRes{res}, xerrors.Errorf("no good address found: %w", err)
} }
mcid, err := b.api.SendMsg(b.mctx, from, b.maddr, miner.Methods.ProveCommitAggregate, collateral, maxFee, enc.Bytes()) mcid, err := b.api.SendMsg(b.mctx, from, b.maddr, miner.Methods.ProveCommitAggregate, needFunds, maxFee, enc.Bytes())
if err != nil { if err != nil {
return []sealiface.CommitBatchRes{res}, xerrors.Errorf("sending message failed: %w", err) return []sealiface.CommitBatchRes{res}, xerrors.Errorf("sending message failed: %w", err)
} }