extract withApiEndpoint
This commit is contained in:
parent
b62878c260
commit
e3d2d2e7c1
@ -207,13 +207,7 @@ func prepareBootstrapper(t *TestEnvironment) (*Node, error) {
|
||||
node.Online(),
|
||||
node.Repo(repo.NewMemory(nil)),
|
||||
node.Override(new(modules.Genesis), modtest.MakeGenesisMem(&genesisBuffer, genesisTemplate)),
|
||||
node.Override(node.SetApiEndpointKey, func(lr repo.LockedRepo) error {
|
||||
apima, err := multiaddr.NewMultiaddr("/ip4/127.0.0.1/tcp/1234")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return lr.SetAPIEndpoint(apima)
|
||||
}),
|
||||
node.Override(node.SetApiEndpointKey, withApiEndpoint),
|
||||
withListenAddress(bootstrapperIP),
|
||||
withBootstrapper(nil),
|
||||
withPubsubConfig(true, pubsubTracer),
|
||||
@ -416,13 +410,7 @@ func prepareMiner(t *TestEnvironment) (*Node, error) {
|
||||
node.Online(),
|
||||
node.Repo(minerRepo),
|
||||
node.Override(new(api.FullNode), n.fullApi),
|
||||
node.Override(node.SetApiEndpointKey, func(lr repo.LockedRepo) error {
|
||||
apima, err := multiaddr.NewMultiaddr("/ip4/127.0.0.1/tcp/1234")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return lr.SetAPIEndpoint(apima)
|
||||
}),
|
||||
node.Override(node.SetApiEndpointKey, withApiEndpoint),
|
||||
withMinerListenAddress(minerIP),
|
||||
}
|
||||
|
||||
@ -856,3 +844,11 @@ func startClientAPIServer(repo *repo.MemRepo, api api.FullNode) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func withApiEndpoint(lr repo.LockedRepo) error {
|
||||
apima, err := multiaddr.NewMultiaddr("/ip4/127.0.0.1/tcp/1234")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return lr.SetAPIEndpoint(apima)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user