diff --git a/chain/messagepool/messagepool_test.go b/chain/messagepool/messagepool_test.go index 9709931a9..fb07120b0 100644 --- a/chain/messagepool/messagepool_test.go +++ b/chain/messagepool/messagepool_test.go @@ -87,7 +87,7 @@ func (tma *testMpoolAPI) PubSubPublish(string, []byte) error { func (tma *testMpoolAPI) StateGetActor(addr address.Address, ts *types.TipSet) (*types.Actor, error) { balance, ok := tma.balance[addr] if !ok { - balance = types.NewInt(90000000) + balance = types.NewInt(1000e6) tma.balance[addr] = balance } return &types.Actor{ diff --git a/chain/messagepool/selection.go b/chain/messagepool/selection.go index 030981409..6e8bf2f70 100644 --- a/chain/messagepool/selection.go +++ b/chain/messagepool/selection.go @@ -1,7 +1,6 @@ package messagepool import ( - "context" "math/big" "sort" "time" @@ -233,19 +232,7 @@ func (mp *MessagePool) getPendingMessages(curTs, ts *types.TipSet) (map[address. } func (mp *MessagePool) getGasReward(msg *types.SignedMessage, ts *types.TipSet) *big.Int { - al := func(ctx context.Context, addr address.Address, tsk types.TipSetKey) (*types.Actor, error) { - return mp.api.StateGetActor(addr, ts) - } - gasUsed, err := gasguess.GuessGasUsed(context.TODO(), types.EmptyTSK, msg, al) - if err != nil { - gasUsed = int64(gasguess.MaxGas) - if gasUsed > msg.Message.GasLimit/2 { - gasUsed = msg.Message.GasLimit / 2 - } - // if we start seeing this warning we may have a problem with spammers! - log.Warnf("Cannot guess gas usage for message: %s; using %d", err, gasUsed) - } - gasReward := abig.Mul(msg.Message.GasPrice, types.NewInt(uint64(gasUsed))) + gasReward := abig.Mul(msg.Message.GasPremium, types.NewInt(uint64(msg.Message.GasLimit))) return gasReward.Int } diff --git a/chain/messagepool/selection_test.go b/chain/messagepool/selection_test.go index 177da4531..5967ad649 100644 --- a/chain/messagepool/selection_test.go +++ b/chain/messagepool/selection_test.go @@ -20,13 +20,14 @@ import ( func makeTestMessage(w *wallet.Wallet, from, to address.Address, nonce uint64, gasLimit int64, gasPrice uint64) *types.SignedMessage { msg := &types.Message{ - From: from, - To: to, - Method: 2, - Value: types.FromFil(0), - Nonce: nonce, - GasLimit: gasLimit, - GasPrice: types.NewInt(gasPrice), + From: from, + To: to, + Method: 2, + Value: types.FromFil(0), + Nonce: nonce, + GasLimit: gasLimit, + GasFeeCap: types.NewInt(gasPrice + 100), + GasPremium: types.NewInt(gasPrice), } sig, err := w.Sign(context.TODO(), from, msg.Cid().Bytes()) if err != nil { diff --git a/chain/types/mock/chain.go b/chain/types/mock/chain.go index d818cb5ac..33b13d408 100644 --- a/chain/types/mock/chain.go +++ b/chain/types/mock/chain.go @@ -23,12 +23,13 @@ func Address(i uint64) address.Address { func MkMessage(from, to address.Address, nonce uint64, w *wallet.Wallet) *types.SignedMessage { msg := &types.Message{ - To: to, - From: from, - Value: types.NewInt(1), - Nonce: nonce, - GasLimit: 1000000, - GasPrice: types.NewInt(0), + To: to, + From: from, + Value: types.NewInt(1), + Nonce: nonce, + GasLimit: 1000000, + GasFeeCap: types.NewInt(100), + GasPremium: types.NewInt(1), } sig, err := w.Sign(context.TODO(), from, msg.Cid().Bytes())