Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision

Target

Select target project
  • xavier.perret/perso-distributed-systems
1 result
Select Git revision
Show changes
Commits on Source (2)
......@@ -164,10 +164,10 @@ func ClientUserInputLoop(clientConfig Config, isAlsoServer bool) {
break
case "2":
fmt.Println("You chose to rate a transaction")
fmt.Println("We will ask you for an index of a transaction to rate")
fmt.Println("We will ask you for an id of a transaction to rate")
fmt.Println("The given node will send a request to all its neighbours to rate the transaction")
fmt.Println("The node will then print the result of the rating")
fmt.Print("\nPlease enter the index of the transaction you want to rate:")
fmt.Print("\nPlease enter the id of the transaction you want to rate:")
var transID string
_, err := fmt.Scanln(&transID)
if err != nil {
......@@ -200,10 +200,10 @@ func ClientUserInputLoop(clientConfig Config, isAlsoServer bool) {
break
case "3":
fmt.Println("You chose to fake a transaction")
fmt.Println("We will ask you for an index of a transaction to fake")
fmt.Println("We will ask you for the id of a transaction to fake")
fmt.Println("and the node you want to ask to fake it")
fmt.Println("The node will receive the request and change the transaction with a fake one")
fmt.Print("\nPlease enter the index of the transaction you want to fake:")
fmt.Print("\nPlease enter the id of the transaction you want to fake:")
var transID string
_, err := fmt.Scanln(&transID)
if err != nil {
......
......@@ -114,9 +114,15 @@ func SendVoteRequestToNode(clientConfig Config, transIDInt int64, address string
conn := manage_connection.CreateConnection(address)
trans := Transaction{
Id: strconv.FormatInt(transIDInt, 10),
Sender: "",
Receiver: "",
Amount: "",
}
mess := Message{
MessageType: "voteRequest",
MessageBody: transIDInt,
MessageBody: trans,
}
fmt.Println("Sending vote request to node", mess)
encoder := json.NewEncoder(conn)
......@@ -135,10 +141,17 @@ func SendFakeRequestToNode(clientConfig Config, transIDInt int64, address string
conn := manage_connection.CreateConnection(address)
trans := Transaction{
Id: strconv.FormatInt(transIDInt, 10),
Sender: "",
Receiver: "",
Amount: "",
}
mess := Message{
MessageType: "fakeRequest",
MessageBody: transIDInt,
MessageBody: trans,
}
fmt.Println("Sending vote request to node", mess)
encoder := json.NewEncoder(conn)
err := encoder.Encode(mess)
......