Skip to content
Snippets Groups Projects
Commit 2cf96a35 authored by Xavier Perret's avatar Xavier Perret
Browse files

added request

parent fe082039
No related branches found
No related tags found
1 merge request!2added file to separate client function from the server
...@@ -130,10 +130,42 @@ func SendVoteRequestToNode(clientConfig Config, transIDInt int64, address string ...@@ -130,10 +130,42 @@ func SendVoteRequestToNode(clientConfig Config, transIDInt int64, address string
// SendFakeRequestToNode is a function to send a fake request to a node, used strictly by client // SendFakeRequestToNode is a function to send a fake request to a node, used strictly by client
func SendFakeRequestToNode(clientConfig Config, transIDInt int64, address string) { func SendFakeRequestToNode(clientConfig Config, transIDInt int64, address string) {
fmt.Println()
fmt.Println("Trying to connect to ", address)
conn := manage_connection.CreateConnection(address)
mess := Message{
MessageType: "fakeRequest",
MessageBody: transIDInt,
}
fmt.Println("Sending vote request to node", mess)
encoder := json.NewEncoder(conn)
err := encoder.Encode(mess)
if err != nil {
fmt.Println("Error while encoding the transaction", err)
os.Exit(1)
}
conn.Close()
} }
// SendListTransactionsRequestToNode is a function to ask a node to locally list its transaction in its cli, used strictly by client // SendListTransactionsRequestToNode is a function to ask a node to locally list its transaction in its cli, used strictly by client
func SendListTransactionsRequestToNode(clientConfig Config, address string) { func SendListTransactionsRequestToNode(clientConfig Config, address string) {
fmt.Println()
fmt.Println("Trying to connect to ", address)
conn := manage_connection.CreateConnection(address)
mess := Message{
MessageType: "listTransactionsRequest",
MessageBody: "",
}
fmt.Println("Sending vote request to node", mess)
encoder := json.NewEncoder(conn)
err := encoder.Encode(mess)
if err != nil {
fmt.Println("Error while encoding the transaction", err)
os.Exit(1)
}
conn.Close()
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment