2021-03-23 15:40:22 +00:00
|
|
|
package v0api
|
|
|
|
|
|
|
|
import (
|
2021-04-02 11:52:24 +00:00
|
|
|
"context"
|
|
|
|
|
|
|
|
"github.com/filecoin-project/lotus/chain/types"
|
|
|
|
|
|
|
|
"github.com/ipfs/go-cid"
|
|
|
|
|
|
|
|
"github.com/filecoin-project/go-state-types/abi"
|
|
|
|
|
|
|
|
"github.com/filecoin-project/lotus/api"
|
2021-03-23 15:40:22 +00:00
|
|
|
"github.com/filecoin-project/lotus/api/v1api"
|
2021-04-02 11:52:24 +00:00
|
|
|
"github.com/filecoin-project/lotus/chain/stmgr"
|
2021-03-23 15:40:22 +00:00
|
|
|
)
|
|
|
|
|
2021-03-23 16:20:56 +00:00
|
|
|
type WrapperV1Full struct {
|
2021-03-23 15:40:22 +00:00
|
|
|
v1api.FullNode
|
|
|
|
}
|
|
|
|
|
2021-04-02 11:52:24 +00:00
|
|
|
func (w *WrapperV1Full) StateSearchMsg(ctx context.Context, msg cid.Cid) (*api.MsgLookup, error) {
|
|
|
|
return w.FullNode.StateSearchMsg(ctx, types.EmptyTSK, msg, stmgr.LookbackNoLimit, true)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (w *WrapperV1Full) StateSearchMsgLimited(ctx context.Context, msg cid.Cid, limit abi.ChainEpoch) (*api.MsgLookup, error) {
|
|
|
|
return w.FullNode.StateSearchMsg(ctx, types.EmptyTSK, msg, limit, true)
|
|
|
|
}
|
2021-03-23 15:40:22 +00:00
|
|
|
|
2021-04-02 11:52:24 +00:00
|
|
|
func (w *WrapperV1Full) StateWaitMsg(ctx context.Context, msg cid.Cid, confidence uint64) (*api.MsgLookup, error) {
|
|
|
|
return w.FullNode.StateWaitMsg(ctx, msg, confidence, stmgr.LookbackNoLimit, true)
|
2021-03-23 15:40:22 +00:00
|
|
|
}
|
|
|
|
|
2021-04-02 11:52:24 +00:00
|
|
|
func (w *WrapperV1Full) StateWaitMsgLimited(ctx context.Context, msg cid.Cid, confidence uint64, limit abi.ChainEpoch) (*api.MsgLookup, error) {
|
|
|
|
return w.FullNode.StateWaitMsg(ctx, msg, confidence, limit, true)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (w *WrapperV1Full) StateGetReceipt(ctx context.Context, msg cid.Cid, from types.TipSetKey) (*types.MessageReceipt, error) {
|
|
|
|
ml, err := w.FullNode.StateSearchMsg(ctx, from, msg, stmgr.LookbackNoLimit, true)
|
2021-03-23 15:40:22 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
2021-04-02 11:52:24 +00:00
|
|
|
if ml == nil {
|
2021-03-23 15:40:22 +00:00
|
|
|
return nil, nil
|
|
|
|
}
|
|
|
|
|
2021-04-02 11:52:24 +00:00
|
|
|
return &ml.Receipt, nil
|
|
|
|
}
|
2021-03-23 15:40:22 +00:00
|
|
|
|
2021-03-23 16:20:56 +00:00
|
|
|
var _ FullNode = &WrapperV1Full{}
|