wip
This commit is contained in:
parent
666023f804
commit
222d718ccd
@ -6,9 +6,11 @@ require (
|
||||
github.com/drand/drand v0.9.2-0.20200616080806-a94e9c1636a4
|
||||
github.com/filecoin-project/go-address v0.0.2-0.20200504173055-8b6f2fb2b3ef
|
||||
github.com/filecoin-project/go-fil-markets v0.3.0
|
||||
github.com/filecoin-project/go-jsonrpc v0.1.1-0.20200602181149-522144ab4e24
|
||||
github.com/filecoin-project/go-storedcounter v0.0.0-20200421200003-1c99c62e8a5b
|
||||
github.com/filecoin-project/lotus v0.4.1-0.20200623211458-e8642442267b
|
||||
github.com/filecoin-project/specs-actors v0.6.2-0.20200617175406-de392ca14121
|
||||
github.com/gorilla/mux v1.7.4
|
||||
github.com/ipfs/go-cid v0.0.6
|
||||
github.com/ipfs/go-datastore v0.4.4
|
||||
github.com/ipfs/go-ipfs-files v0.0.8
|
||||
@ -21,6 +23,7 @@ require (
|
||||
github.com/libp2p/go-libp2p-core v0.6.0
|
||||
github.com/libp2p/go-libp2p-pubsub-tracer v0.0.0-20200626141350-e730b32bf1e6
|
||||
github.com/multiformats/go-multiaddr v0.2.2
|
||||
github.com/multiformats/go-multiaddr-net v0.1.5
|
||||
github.com/testground/sdk-go v0.2.3-0.20200626214218-7a87893cf56c
|
||||
)
|
||||
|
||||
|
@ -6,14 +6,18 @@ import (
|
||||
"crypto/rand"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"os"
|
||||
"sort"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-jsonrpc"
|
||||
"github.com/filecoin-project/go-jsonrpc/auth"
|
||||
"github.com/filecoin-project/go-storedcounter"
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/api/apistruct"
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/beacon"
|
||||
@ -25,12 +29,12 @@ import (
|
||||
"github.com/filecoin-project/lotus/miner"
|
||||
"github.com/filecoin-project/lotus/node"
|
||||
"github.com/filecoin-project/lotus/node/config"
|
||||
"github.com/filecoin-project/lotus/node/impl"
|
||||
"github.com/filecoin-project/lotus/node/modules"
|
||||
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
||||
"github.com/filecoin-project/lotus/node/modules/lp2p"
|
||||
modtest "github.com/filecoin-project/lotus/node/modules/testing"
|
||||
"github.com/filecoin-project/lotus/node/repo"
|
||||
|
||||
"github.com/filecoin-project/specs-actors/actors/abi"
|
||||
"github.com/filecoin-project/specs-actors/actors/abi/big"
|
||||
"github.com/filecoin-project/specs-actors/actors/builtin"
|
||||
@ -38,13 +42,13 @@ import (
|
||||
"github.com/filecoin-project/specs-actors/actors/builtin/power"
|
||||
"github.com/filecoin-project/specs-actors/actors/builtin/verifreg"
|
||||
"github.com/filecoin-project/specs-actors/actors/crypto"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
"github.com/ipfs/go-datastore"
|
||||
logging "github.com/ipfs/go-log/v2"
|
||||
libp2p_crypto "github.com/libp2p/go-libp2p-core/crypto"
|
||||
"github.com/libp2p/go-libp2p-core/peer"
|
||||
ma "github.com/multiformats/go-multiaddr"
|
||||
|
||||
manet "github.com/multiformats/go-multiaddr-net"
|
||||
"github.com/testground/sdk-go/run"
|
||||
"github.com/testground/sdk-go/runtime"
|
||||
"github.com/testground/sdk-go/sync"
|
||||
@ -416,6 +420,7 @@ func prepareMiner(t *TestEnvironment) (*Node, error) {
|
||||
return err1
|
||||
}
|
||||
|
||||
// Bootstrap with full node
|
||||
remoteAddrs, err := n.fullApi.NetAddrsListen(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
@ -435,6 +440,54 @@ func prepareMiner(t *TestEnvironment) (*Node, error) {
|
||||
}
|
||||
}
|
||||
|
||||
endpoint, err := minerRepo.APIEndpoint()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
lst, err := manet.Listen(endpoint)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not listen: %w", err)
|
||||
}
|
||||
|
||||
mux := mux.NewRouter()
|
||||
|
||||
rpcServer := jsonrpc.NewServer()
|
||||
rpcServer.Register("Filecoin", apistruct.PermissionedStorMinerAPI(n.minerApi))
|
||||
|
||||
mux.Handle("/rpc/v0", rpcServer)
|
||||
mux.PathPrefix("/remote").HandlerFunc(n.minerApi.(*impl.StorageMinerAPI).ServeRemote)
|
||||
mux.PathPrefix("/").Handler(http.DefaultServeMux) // pprof
|
||||
|
||||
ah := &auth.Handler{
|
||||
Verify: n.minerApi.AuthVerify,
|
||||
Next: mux.ServeHTTP,
|
||||
}
|
||||
|
||||
srv := &http.Server{Handler: ah}
|
||||
|
||||
//sigChan := make(chan os.Signal, 2)
|
||||
//go func() {
|
||||
//select {
|
||||
//case <-sigChan:
|
||||
//case <-shutdownChan:
|
||||
//}
|
||||
|
||||
//log.Warn("Shutting down...")
|
||||
//if err := stop(context.TODO()); err != nil {
|
||||
//log.Errorf("graceful shutting down failed: %s", err)
|
||||
//}
|
||||
//if err := srv.Shutdown(context.TODO()); err != nil {
|
||||
//log.Errorf("shutting down RPC server failed: %s", err)
|
||||
//}
|
||||
//log.Warn("Graceful shutdown successful")
|
||||
//}()
|
||||
//signal.Notify(sigChan, syscall.SIGTERM, syscall.SIGINT)
|
||||
|
||||
go func() {
|
||||
_ = srv.Serve(manet.NetListener(lst))
|
||||
}()
|
||||
|
||||
// add local storage for presealed sectors
|
||||
err = n.minerApi.StorageAddLocal(ctx, presealDir)
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user