Use EmptyTSK where appropriate
This commit is contained in:
parent
b23837a7d6
commit
d794b49df3
@ -47,7 +47,7 @@ func NewTipSetKey(cids ...cid.Cid) TipSetKey {
|
||||
func TipSetKeyFromBytes(encoded []byte) (TipSetKey, error) {
|
||||
_, err := decodeKey(encoded)
|
||||
if err != nil {
|
||||
return TipSetKey{}, err
|
||||
return EmptyTSK, err
|
||||
}
|
||||
return TipSetKey{string(encoded)}, nil
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ func TestTipSetKey(t *testing.T) {
|
||||
fmt.Println(len(c1.Bytes()))
|
||||
|
||||
t.Run("zero value", func(t *testing.T) {
|
||||
assert.Equal(t, TipSetKey{}, NewTipSetKey())
|
||||
assert.Equal(t, EmptyTSK, NewTipSetKey())
|
||||
})
|
||||
|
||||
t.Run("CID extraction", func(t *testing.T) {
|
||||
|
@ -254,7 +254,7 @@ var terminateSectorPenaltyEstimationCmd = &cli.Command{
|
||||
|
||||
//TODO: 4667 add an option to give a more precise estimation with pending termination penalty excluded
|
||||
|
||||
invocResult, err := nodeApi.StateCall(ctx, msg, types.TipSetKey{})
|
||||
invocResult, err := nodeApi.StateCall(ctx, msg, types.EmptyTSK)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("fail to state call: %w", err)
|
||||
}
|
||||
|
@ -324,7 +324,7 @@ func gasEstimateGasLimit(
|
||||
|
||||
func (m *GasModule) GasEstimateMessageGas(ctx context.Context, msg *types.Message, spec *api.MessageSendSpec, _ types.TipSetKey) (*types.Message, error) {
|
||||
if msg.GasLimit == 0 {
|
||||
gasLimit, err := m.GasEstimateGasLimit(ctx, msg, types.TipSetKey{})
|
||||
gasLimit, err := m.GasEstimateGasLimit(ctx, msg, types.EmptyTSK)
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("estimating gas used: %w", err)
|
||||
}
|
||||
@ -332,7 +332,7 @@ func (m *GasModule) GasEstimateMessageGas(ctx context.Context, msg *types.Messag
|
||||
}
|
||||
|
||||
if msg.GasPremium == types.EmptyInt || types.BigCmp(msg.GasPremium, types.NewInt(0)) == 0 {
|
||||
gasPremium, err := m.GasEstimateGasPremium(ctx, 10, msg.From, msg.GasLimit, types.TipSetKey{})
|
||||
gasPremium, err := m.GasEstimateGasPremium(ctx, 10, msg.From, msg.GasLimit, types.EmptyTSK)
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("estimating gas price: %w", err)
|
||||
}
|
||||
|
@ -821,7 +821,7 @@ func (s *WindowPoStScheduler) setSender(ctx context.Context, msg *types.Message,
|
||||
// estimate
|
||||
minGasFeeMsg := *msg
|
||||
|
||||
minGasFeeMsg.GasPremium, err = s.api.GasEstimateGasPremium(ctx, 5, msg.From, msg.GasLimit, types.TipSetKey{})
|
||||
minGasFeeMsg.GasPremium, err = s.api.GasEstimateGasPremium(ctx, 5, msg.From, msg.GasLimit, types.EmptyTSK)
|
||||
if err != nil {
|
||||
log.Errorf("failed to estimate minimum gas premium: %+v", err)
|
||||
minGasFeeMsg.GasPremium = msg.GasPremium
|
||||
|
Loading…
Reference in New Issue
Block a user