-
Notifications
You must be signed in to change notification settings - Fork 0
/
node.go
56 lines (42 loc) · 1.25 KB
/
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package coinharness
type StartNodeArgs struct {
DebugOutput bool
MiningAddress Address
ExtraArguments map[string]interface{}
}
// Node wraps optional test node implementations for different test setups
type Node interface {
// Network returns current network of the node
Network() Network
// Start node process
Start(args *StartNodeArgs)
// Stop node process
Stop()
// Dispose releases all resources allocated by the node
// This action is final (irreversible)
Dispose() error
// CertFile returns file path of the .cert-file of the node
CertFile() string
// RPCConnectionConfig produces a new connection config instance for RPC client
RPCConnectionConfig() RPCConnectionConfig
// RPCClient returns node RPCConnection
RPCClient() *RPCConnection
// P2PAddress returns node p2p address
P2PAddress() string
}
// TestNodeFactory produces a new Node instance
type TestNodeFactory interface {
// NewNode is used by harness builder to setup a node component
NewNode(cfg *TestNodeConfig) Node
}
// TestNodeConfig bundles settings required to create a new node instance
type TestNodeConfig struct {
ActiveNet Network
WorkingDir string
P2PHost string
P2PPort int
NodeRPCHost string
NodeRPCPort int
NodeUser string
NodePassword string
}