Use wrapped node

This commit is contained in:
Oskar Thoren 2021-06-10 22:43:12 +08:00
parent b35b1fede2
commit 41f7b176b4
No known key found for this signature in database
GPG Key ID: B2ECCFD3BC2EF77E
3 changed files with 16 additions and 5 deletions

2
.gitignore vendored
View File

@ -26,3 +26,5 @@ vendor/
.lock
build/
*.lock
examples/chat2/bin/

View File

@ -15,7 +15,7 @@ import (
"os"
"time"
"github.com/ethereum/go-ethereum/crypto"
//"github.com/ethereum/go-ethereum/crypto"
logging "github.com/ipfs/go-log"
"github.com/libp2p/go-libp2p-core/peer"
@ -60,16 +60,23 @@ func main() {
return
}
}
prvKey, err := crypto.HexToECDSA(nodekey)
//prvKey, err := crypto.HexToECDSA(nodekey)
log.Printf("NYI prvKey use", prvKey)
//log.Printf("NYI prvKey use", prvKey)
log.Printf("Starting node...")
nodeStopped := make(chan bool, 1)
// TODO Doesn't seem like SIGINT hook is hit here
go nwaku.StartNode(nodeStopped)
// NOTE: RPC server needs time to start, this can be improved
time.Sleep(2 * time.Second)
// TODO Start wrapper node
// Start wrapper here
// Assumes node started
client, _ := rpc.Dial("http://127.0.0.1:8545")
ctx := context.Background()
// TODO Replace with wrapper
// wakuNode, err := node.New(ctx,
// node.WithPrivateKey(prvKey),
// node.WithHostAddress([]net.Addr{hostAddr}),
@ -174,6 +181,9 @@ func main() {
if err = ui.Run(); err != nil {
printErr("error running text UI: %s", err)
}
<-nodeStopped
log.Printf("exiting main")
}
// Generates a random hex string with a length of n

View File

@ -13,7 +13,6 @@ func main() {
fmt.Println("Starting node...")
nodeStopped := make(chan bool, 1)
// TODO Doesn't seem like SIGINT hook is hit here
go nwaku.StartNode(nodeStopped)
// NOTE: RPC server needs time to start, this can be improved