forked from tanitall/memo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
node.go
41 lines (38 loc) · 899 Bytes
/
node.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package cmd
import (
"fmt"
"github.com/memocash/memo/app/bitcoin/main-node"
"github.com/spf13/cobra"
"os"
"time"
)
var actionNodeCmd = &cobra.Command{
Use: "action-node",
RunE: func(c *cobra.Command, args []string) error {
var last time.Time
for last.IsZero() || time.Since(last) > time.Minute {
last = time.Now()
main_node.StartActionNode()
main_node.WaitForActionNodeDisconnect()
fmt.Println("Disconnected.")
main_node.ActionNode = main_node.Node{}
}
os.Exit(1)
return nil
},
}
var userNodeCmd = &cobra.Command{
Use: "user-node",
RunE: func(c *cobra.Command, args []string) error {
var last time.Time
for last.IsZero() || time.Since(last) > time.Minute {
last = time.Now()
main_node.StartUserNode()
main_node.WaitForUserNodeDisconnect()
fmt.Println("Disconnected.")
main_node.UserNode = main_node.Node{}
}
os.Exit(1)
return nil
},
}