diff --git a/chain/sync_test.go b/chain/sync_test.go index 1fe90a071..318f6d82f 100644 --- a/chain/sync_test.go +++ b/chain/sync_test.go @@ -222,7 +222,7 @@ func (tu *syncTestUtil) addSourceNode(gen int) { var out api.FullNode stop, err := node.New(tu.ctx, - node.FullAPI(&out, false), + node.FullAPI(&out), node.Online(), node.Repo(sourceRepo), node.MockHost(tu.mn), @@ -254,7 +254,7 @@ func (tu *syncTestUtil) addClientNode() int { var out api.FullNode stop, err := node.New(tu.ctx, - node.FullAPI(&out, false), + node.FullAPI(&out), node.Online(), node.Repo(repo.NewMemory(nil)), node.MockHost(tu.mn), diff --git a/cmd/lotus/daemon.go b/cmd/lotus/daemon.go index 298cb7a67..5964a2458 100644 --- a/cmd/lotus/daemon.go +++ b/cmd/lotus/daemon.go @@ -264,7 +264,7 @@ var DaemonCmd = &cli.Command{ var api api.FullNode stop, err := node.New(ctx, - node.FullAPI(&api, isLite), + node.FullAPI(&api, node.Lite(isLite)), node.Override(new(dtypes.Bootstrapper), isBootstrapper), node.Override(new(dtypes.ShutdownChan), shutdownChan), diff --git a/documentation/en/api-methods.md b/documentation/en/api-methods.md index 8a288a4bf..cc6d92e4f 100644 --- a/documentation/en/api-methods.md +++ b/documentation/en/api-methods.md @@ -167,6 +167,7 @@ * [StateVerifiedRegistryRootKey](#StateVerifiedRegistryRootKey) * [StateVerifierStatus](#StateVerifierStatus) * [StateWaitMsg](#StateWaitMsg) + * [StateWaitMsgLimited](#StateWaitMsgLimited) * [Sync](#Sync) * [SyncCheckBad](#SyncCheckBad) * [SyncCheckpoint](#SyncCheckpoint) @@ -4322,6 +4323,49 @@ Response: } ``` +### StateWaitMsgLimited +StateWaitMsgLimited looks back up to limit epochs in the chain for a message. +If not found, it blocks until the message arrives on chain, and gets to the +indicated confidence depth. + + +Perms: read + +Inputs: +```json +[ + { + "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" + }, + 42, + 10101 +] +``` + +Response: +```json +{ + "Message": { + "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" + }, + "Receipt": { + "ExitCode": 0, + "Return": "Ynl0ZSBhcnJheQ==", + "GasUsed": 9 + }, + "ReturnDec": {}, + "TipSet": [ + { + "/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4" + }, + { + "/": "bafy2bzacebp3shtrn43k7g3unredz7fxn4gj533d3o43tqn2p2ipxxhrvchve" + } + ], + "Height": 10101 +} +``` + ## Sync The Sync method group contains methods for interacting with and observing the lotus sync service. diff --git a/node/builder.go b/node/builder.go index 452104ba8..71295dbc8 100644 --- a/node/builder.go +++ b/node/builder.go @@ -531,13 +531,22 @@ func Repo(r repo.Repo) Option { } } -func FullAPI(out *api.FullNode, lite bool) Option { +type FullOption = Option + +func Lite(enable bool) FullOption { + return func(s *Settings) error { + s.Lite = enable + return nil + } +} + +func FullAPI(out *api.FullNode, fopts ...FullOption) Option { return Options( func(s *Settings) error { s.nodeType = repo.FullNode - s.Lite = lite return nil }, + Options(fopts...), func(s *Settings) error { resAPI := &impl.FullNodeAPI{} s.invokes[ExtractApiKey] = fx.Populate(resAPI) diff --git a/node/test/builder.go b/node/test/builder.go index 289fae841..4aa8a55ea 100644 --- a/node/test/builder.go +++ b/node/test/builder.go @@ -237,7 +237,7 @@ func mockBuilderOpts(t *testing.T, fullOpts []test.FullNodeOpts, storage []test. } stop, err := node.New(ctx, - node.FullAPI(&fulls[i].FullNode, fullOpts[i].Lite), + node.FullAPI(&fulls[i].FullNode, node.Lite(fullOpts[i].Lite)), node.Online(), node.Repo(repo.NewMemory(nil)), node.MockHost(mn), @@ -394,7 +394,7 @@ func mockSbBuilderOpts(t *testing.T, fullOpts []test.FullNodeOpts, storage []tes } stop, err := node.New(ctx, - node.FullAPI(&fulls[i].FullNode, fullOpts[i].Lite), + node.FullAPI(&fulls[i].FullNode, node.Lite(fullOpts[i].Lite)), node.Online(), node.Repo(repo.NewMemory(nil)), node.MockHost(mn),