fixup
This commit is contained in:
parent
0a9af6ad5c
commit
46beab3cf1
@ -207,7 +207,7 @@ func prepareBootstrapper(t *TestEnvironment) (*Node, error) {
|
|||||||
node.Online(),
|
node.Online(),
|
||||||
node.Repo(repo.NewMemory(nil)),
|
node.Repo(repo.NewMemory(nil)),
|
||||||
node.Override(new(modules.Genesis), modtest.MakeGenesisMem(&genesisBuffer, genesisTemplate)),
|
node.Override(new(modules.Genesis), modtest.MakeGenesisMem(&genesisBuffer, genesisTemplate)),
|
||||||
node.Override(node.SetApiEndpointKey, withApiEndpoint),
|
withApiEndpoint("/ip4/127.0.0.1/tcp/1234"),
|
||||||
withListenAddress(bootstrapperIP),
|
withListenAddress(bootstrapperIP),
|
||||||
withBootstrapper(nil),
|
withBootstrapper(nil),
|
||||||
withPubsubConfig(true, pubsubTracer),
|
withPubsubConfig(true, pubsubTracer),
|
||||||
@ -410,7 +410,7 @@ func prepareMiner(t *TestEnvironment) (*Node, error) {
|
|||||||
node.Online(),
|
node.Online(),
|
||||||
node.Repo(minerRepo),
|
node.Repo(minerRepo),
|
||||||
node.Override(new(api.FullNode), n.fullApi),
|
node.Override(new(api.FullNode), n.fullApi),
|
||||||
node.Override(node.SetApiEndpointKey, withApiEndpoint),
|
withApiEndpoint("/ip4/127.0.0.1/tcp/1234"),
|
||||||
withMinerListenAddress(minerIP),
|
withMinerListenAddress(minerIP),
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -546,13 +546,7 @@ func prepareClient(t *TestEnvironment) (*Node, error) {
|
|||||||
node.FullAPI(&n.fullApi),
|
node.FullAPI(&n.fullApi),
|
||||||
node.Online(),
|
node.Online(),
|
||||||
node.Repo(nodeRepo),
|
node.Repo(nodeRepo),
|
||||||
node.Override(node.SetApiEndpointKey, func(lr repo.LockedRepo) error {
|
withApiEndpoint("/ip4/127.0.0.1/tcp/1234"),
|
||||||
apima, err := multiaddr.NewMultiaddr("/ip4/127.0.0.1/tcp/1234")
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return lr.SetAPIEndpoint(apima)
|
|
||||||
}),
|
|
||||||
withGenesis(genesisMsg.Genesis),
|
withGenesis(genesisMsg.Genesis),
|
||||||
withListenAddress(clientIP),
|
withListenAddress(clientIP),
|
||||||
withBootstrapper(genesisMsg.Bootstrapper),
|
withBootstrapper(genesisMsg.Bootstrapper),
|
||||||
@ -645,6 +639,16 @@ func withMinerListenAddress(ip string) node.Option {
|
|||||||
return node.Override(node.StartListeningKey, lp2p.StartListening(addrs))
|
return node.Override(node.StartListeningKey, lp2p.StartListening(addrs))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func withApiEndpoint(addr string) node.Option {
|
||||||
|
return node.Override(node.SetApiEndpointKey, func(lr repo.LockedRepo) error {
|
||||||
|
apima, err := multiaddr.NewMultiaddr(addr)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return lr.SetAPIEndpoint(apima)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
func waitForBalances(t *TestEnvironment, ctx context.Context, nodes int) ([]*InitialBalanceMsg, error) {
|
func waitForBalances(t *TestEnvironment, ctx context.Context, nodes int) ([]*InitialBalanceMsg, error) {
|
||||||
ch := make(chan *InitialBalanceMsg)
|
ch := make(chan *InitialBalanceMsg)
|
||||||
sub := t.SyncClient.MustSubscribe(ctx, balanceTopic, ch)
|
sub := t.SyncClient.MustSubscribe(ctx, balanceTopic, ch)
|
||||||
@ -817,14 +821,6 @@ func startClientAPIServer(repo *repo.MemRepo, api api.FullNode) error {
|
|||||||
return startServer(repo, srv)
|
return startServer(repo, srv)
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
|
||||||
}
|
|
||||||
|
|
||||||
func startServer(repo *repo.MemRepo, srv *http.Server) error {
|
func startServer(repo *repo.MemRepo, srv *http.Server) error {
|
||||||
endpoint, err := repo.APIEndpoint()
|
endpoint, err := repo.APIEndpoint()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user