diff --git a/main.go b/main.go index a64ccad..b84a1d2 100644 --- a/main.go +++ b/main.go @@ -710,6 +710,8 @@ func rpcMain() { if err != nil { fmt.Fprintf(os.Stderr, "failed to save host keystore: %v\n", err) } + + fmt.Printf("New host ID: %s\n", rpcRes.NewHostID) } if rpcNewNode != "" { @@ -741,10 +743,12 @@ func rpcMain() { } // deserialize keystore - _, err = crypto.LuxKeyStoreFromRpc(rpcRes.Keystore, rpcNewHost) + _, err = crypto.LuxKeyStoreFromRpc(rpcRes.Keystore, rpcNewNode) if err != nil { fmt.Fprintf(os.Stderr, "failed to save node keystore: %v\n", err) } + + fmt.Printf("New neighbor node ID: %s\n", rpcRes.NewNodeID) } if rpcQueryHost != "" || rpcQueryHostname != "" { diff --git a/node/lux_node.go b/node/lux_node.go index 7d15d83..66ca33d 100644 --- a/node/lux_node.go +++ b/node/lux_node.go @@ -343,7 +343,8 @@ func (node *LuxNode) Handle(request rpc.LuxRpcRequest, rpcType rpc.LuxRpcType) ( ksHost.Put(host) return rpc.LuxRpcResponse{ - Keystore: crypto.LuxKeyStoreIntoRpc(&ksHost), + Keystore: crypto.LuxKeyStoreIntoRpc(&ksHost), + NewHostID: host.Id.String(), }, rpc.LuxRpcError{}, true } else if request.Command == "new-node" { if rpcType != rpc.LuxRpcTypeRoot { @@ -364,7 +365,8 @@ func (node *LuxNode) Handle(request rpc.LuxRpcRequest, rpcType rpc.LuxRpcType) ( // yeah we just serialize our own keystore return rpc.LuxRpcResponse{ - Keystore: crypto.LuxKeyStoreIntoRpc(ks), + Keystore: crypto.LuxKeyStoreIntoRpc(ks), + NewNodeID: newNode.Id.String(), }, rpc.LuxRpcError{}, true } else if request.Command == "query" { // now we get host states either by ID or hostname diff --git a/rpc/lux_rpc_data.go b/rpc/lux_rpc_data.go index 3c94f47..5bcf2ae 100644 --- a/rpc/lux_rpc_data.go +++ b/rpc/lux_rpc_data.go @@ -119,6 +119,9 @@ type LuxRpcResponse struct { Keystore LuxRpcKeyStore `xml:"keystore"` Routes []LuxRpcRoute `xml:"route"` Hosts []LuxRpcHost `xml:"host"` + + NewHostID string `xml:"newHostId"` + NewNodeID string `xml:"newNodeId"` } type LuxRpcError struct {