From 41dfd010b39480761983763a7b0b01dcf378b16f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Tue, 31 Aug 2021 12:51:13 +0200 Subject: [PATCH] gateway: check tipsets in ChainGetPath --- gateway/node.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/gateway/node.go b/gateway/node.go index 69a9d8731..37e7af411 100644 --- a/gateway/node.go +++ b/gateway/node.go @@ -3,6 +3,7 @@ package gateway import ( "context" "fmt" + "golang.org/x/xerrors" "time" "github.com/filecoin-project/go-address" @@ -218,6 +219,14 @@ func (gw *Node) ChainNotify(ctx context.Context) (<-chan []*api.HeadChange, erro } func (gw *Node) ChainGetPath(ctx context.Context, from, to types.TipSetKey) ([]*api.HeadChange, error) { + if err := gw.checkTipsetKey(ctx, from); err != nil { + return nil, xerrors.Errorf("gateway: checking 'from' tipset: %w", err) + } + + if err := gw.checkTipsetKey(ctx, to); err != nil { + return nil, xerrors.Errorf("gateway: checking 'to' tipset: %w", err) + } + return gw.target.ChainGetPath(ctx, from, to) }