Upgrade go-nitro and add support for remote Nitro node #258

Merged
ashwin merged 10 commits from deep-stack/ipld-eth-server:pm-external-nitro-node into payments 2023-10-18 08:15:36 +00:00
3 changed files with 7 additions and 14 deletions
Showing only changes of commit 8fbd7c8a3a - Show all commits

View File

@ -134,7 +134,9 @@ func serve() {
} else {
log.Info("Connecting to a remote Nitro node")
nitroRpcClient, err := initNitroRpcClient(&nitroConfig.RemoteNode)
// TODO: Read from config file
isSecure := false
nitroRpcClient, err := nitroRpc.NewHttpRpcClient(nitroConfig.RemoteNode.NitroEndpoint, isSecure)
if err != nil {
logWithCommand.Fatal(err)
}
@ -505,7 +507,7 @@ func initNitroRpcServer(node *nitroNode.Node, pm paymentsmanager.PaymentsManager
return nil, err
}
rpcServer, err := nitroRpc.NewRpcServer(pm, node, transport)
rpcServer, err := nitroRpc.NewRpcServer(node, pm, transport)
if err != nil {
return nil, err
}
@ -513,12 +515,3 @@ func initNitroRpcServer(node *nitroNode.Node, pm paymentsmanager.PaymentsManager
slog.Info("Completed Nitro RPC server initialization")
return rpcServer, nil
}
func initNitroRpcClient(config *s.RemoteNitroNodeConfig) (nitroRpc.RpcClientApi, error) {
clientConnection, err := nitroHttpTransport.NewHttpTransportAsClient(config.NitroEndpoint, 10*time.Millisecond)
if err != nil {
logWithCommand.Fatal(err)
}
return nitroRpc.NewRpcClient(clientConnection)
}

2
go.mod
View File

@ -302,4 +302,4 @@ replace (
github.com/cerc-io/ipfs-ethdb/v5 => github.com/cerc-io/ipfs-ethdb/v5 v5.0.1-alpha.0.20231013070931-0b1a36562a28
)
replace github.com/statechannels/go-nitro v0.1.1 => github.com/deep-stack/go-nitro v0.0.0-20231016095715-e033149edb71
replace github.com/statechannels/go-nitro v0.1.1 => github.com/deep-stack/go-nitro v0.0.0-20231017143751-3469db76815b

4
go.sum
View File

@ -184,8 +184,8 @@ github.com/decred/dcrd/crypto/blake256 v1.0.1 h1:7PltbUIQB7u/FfZ39+DGa/ShuMyJ5il
github.com/decred/dcrd/crypto/blake256 v1.0.1/go.mod h1:2OfgNZ5wDpcsFmHmCK5gZTPcCXqlm2ArzUIkw9czNJo=
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 h1:8UrgZ3GkP4i/CLijOJx79Yu+etlyjdBU4sfcs2WYQMs=
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0=
github.com/deep-stack/go-nitro v0.0.0-20231016095715-e033149edb71 h1:/AG4iXW0TO8iIRvGrdhOoh42zODMzJ/Zao/jXuJskS0=
github.com/deep-stack/go-nitro v0.0.0-20231016095715-e033149edb71/go.mod h1:YYQvj9es00ZfLTwxZLM1M0ihUrqz8+lU2c10G06My3A=
github.com/deep-stack/go-nitro v0.0.0-20231017143751-3469db76815b h1:CvaeDMfBN+d+8sKxjTDT9WjLAxYlo9HfmIT+8Z/+YTc=
github.com/deep-stack/go-nitro v0.0.0-20231017143751-3469db76815b/go.mod h1:YYQvj9es00ZfLTwxZLM1M0ihUrqz8+lU2c10G06My3A=
github.com/deepmap/oapi-codegen v1.6.0/go.mod h1:ryDa9AgbELGeB+YEXE1dR53yAjHwFvE9iAUlWl9Al3M=
github.com/deepmap/oapi-codegen v1.8.2 h1:SegyeYGcdi0jLLrpbCMoJxnUUn8GBXHsvr4rbzjuhfU=
github.com/deepmap/oapi-codegen v1.8.2/go.mod h1:YLgSKSDv/bZQB7N4ws6luhozi3cEdRktEqrX88CvjIw=