|
|
@ -3,7 +3,6 @@ package main |
|
|
|
import ( |
|
|
|
import ( |
|
|
|
"flag" |
|
|
|
"flag" |
|
|
|
"fmt" |
|
|
|
"fmt" |
|
|
|
"github.com/harmony-one/harmony/utils" |
|
|
|
|
|
|
|
"os" |
|
|
|
"os" |
|
|
|
"path" |
|
|
|
"path" |
|
|
|
"runtime" |
|
|
|
"runtime" |
|
|
@ -21,6 +20,7 @@ import ( |
|
|
|
"github.com/harmony-one/harmony/node" |
|
|
|
"github.com/harmony-one/harmony/node" |
|
|
|
"github.com/harmony-one/harmony/p2p" |
|
|
|
"github.com/harmony-one/harmony/p2p" |
|
|
|
proto_node "github.com/harmony-one/harmony/proto/node" |
|
|
|
proto_node "github.com/harmony-one/harmony/proto/node" |
|
|
|
|
|
|
|
"github.com/harmony-one/harmony/utils" |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
var ( |
|
|
|
var ( |
|
|
@ -89,11 +89,12 @@ func main() { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Client/txgenerator server node setup
|
|
|
|
// Client/txgenerator server node setup
|
|
|
|
|
|
|
|
if clientPeer == nil { |
|
|
|
|
|
|
|
panic("Client Peer is nil!") |
|
|
|
|
|
|
|
} |
|
|
|
consensusObj := consensus.New(*clientPeer, "0", nil, p2p.Peer{}) |
|
|
|
consensusObj := consensus.New(*clientPeer, "0", nil, p2p.Peer{}) |
|
|
|
clientNode := node.New(consensusObj, nil, *clientPeer) |
|
|
|
clientNode := node.New(consensusObj, nil, *clientPeer) |
|
|
|
|
|
|
|
|
|
|
|
if clientPeer != nil { |
|
|
|
|
|
|
|
//p2pv2.InitHost(clientPeer.IP, clientPeer.Port) // TODO: this should be moved into client node.
|
|
|
|
|
|
|
|
clientNode.Client = client.NewClient(&shardIDLeaderMap) |
|
|
|
clientNode.Client = client.NewClient(&shardIDLeaderMap) |
|
|
|
|
|
|
|
|
|
|
|
// This func is used to update the client's utxopool when new blocks are received from the leaders
|
|
|
|
// This func is used to update the client's utxopool when new blocks are received from the leaders
|
|
|
@ -135,10 +136,8 @@ func main() { |
|
|
|
clientNode.Client.UpdateBlocks = updateBlocksFunc |
|
|
|
clientNode.Client.UpdateBlocks = updateBlocksFunc |
|
|
|
|
|
|
|
|
|
|
|
// Start the client server to listen to leader's message
|
|
|
|
// Start the client server to listen to leader's message
|
|
|
|
go func() { |
|
|
|
go clientNode.StartServer() |
|
|
|
clientNode.StartServer(clientPeer.Port) |
|
|
|
|
|
|
|
}() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// Transaction generation process
|
|
|
|
// Transaction generation process
|
|
|
|
time.Sleep(10 * time.Second) // wait for nodes to be ready
|
|
|
|
time.Sleep(10 * time.Second) // wait for nodes to be ready
|
|
|
|
start := time.Now() |
|
|
|
start := time.Now() |
|
|
|