better handling of gas guess errors
don't swallow them, the failed gas guess is too high.
This commit is contained in:
parent
6e1bfaffd7
commit
9f7deff512
@ -19,6 +19,7 @@ const failedGasGuessRatio = 0.5
|
|||||||
const failedGasGuessMax = 25_000_000
|
const failedGasGuessMax = 25_000_000
|
||||||
|
|
||||||
const MinGas = 1298450
|
const MinGas = 1298450
|
||||||
|
const MaxGas = 1600271356
|
||||||
|
|
||||||
type CostKey struct {
|
type CostKey struct {
|
||||||
Code cid.Cid
|
Code cid.Cid
|
||||||
|
@ -122,7 +122,12 @@ func (mp *MessagePool) getGasReward(msg *types.SignedMessage, ts *types.TipSet)
|
|||||||
al := func(ctx context.Context, addr address.Address, tsk types.TipSetKey) (*types.Actor, error) {
|
al := func(ctx context.Context, addr address.Address, tsk types.TipSetKey) (*types.Actor, error) {
|
||||||
return mp.api.StateGetActor(addr, ts)
|
return mp.api.StateGetActor(addr, ts)
|
||||||
}
|
}
|
||||||
gasUsed, _ := gasguess.GuessGasUsed(context.TODO(), types.EmptyTSK, msg, al)
|
gasUsed, err := gasguess.GuessGasUsed(context.TODO(), types.EmptyTSK, msg, al)
|
||||||
|
if err != nil {
|
||||||
|
// if we start seeing this warning we may have a problem with spammers!
|
||||||
|
log.Warnf("Cannot guess gas usage for message: %s; using MaxGas=%d", err, gasguess.MaxGas)
|
||||||
|
gasUsed = int64(gasguess.MaxGas)
|
||||||
|
}
|
||||||
gasReward := abig.Mul(msg.Message.GasPrice, types.NewInt(uint64(gasUsed)))
|
gasReward := abig.Mul(msg.Message.GasPrice, types.NewInt(uint64(gasUsed)))
|
||||||
return gasReward.Int
|
return gasReward.Int
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user