Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
perso-distributed-systems
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
xavier.perret
perso-distributed-systems
Compare revisions
dbab0779ec23a339a3dcdd1317dad89cac48d192 to ab01bb30ae6cf0a5f315e01b9e3b22877d2c0b6d
Compare revisions
Changes are shown as if the
source
revision was being merged into the
target
revision.
Learn more about comparing revisions.
Source
xavier.perret/perso-distributed-systems
Select target project
No results found
ab01bb30ae6cf0a5f315e01b9e3b22877d2c0b6d
Select Git revision
Swap
Target
xavier.perret/perso-distributed-systems
Select target project
xavier.perret/perso-distributed-systems
1 result
dbab0779ec23a339a3dcdd1317dad89cac48d192
Select Git revision
Show changes
Only incoming changes from source
Include changes to target since source was created
Compare
Commits on Source (2)
changed the print
· 05a2384a
Xavier Perret
authored
2 years ago
05a2384a
just sending a transaction
· ab01bb30
Xavier Perret
authored
2 years ago
ab01bb30
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/command-line/userinput.go
+4
-4
4 additions, 4 deletions
app/command-line/userinput.go
app/sender/sender.go
+15
-2
15 additions, 2 deletions
app/sender/sender.go
with
19 additions
and
6 deletions
app/command-line/userinput.go
View file @
ab01bb30
...
...
@@ -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 i
ndex
of a transaction to rate"
)
fmt
.
Println
(
"We will ask you for an i
d
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
(
"
\n
Please enter the i
ndex
of the transaction you want to rate:"
)
fmt
.
Print
(
"
\n
Please enter the i
d
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
(
"
\n
Please enter the i
ndex
of the transaction you want to fake:"
)
fmt
.
Print
(
"
\n
Please enter the i
d
of the transaction you want to fake:"
)
var
transID
string
_
,
err
:=
fmt
.
Scanln
(
&
transID
)
if
err
!=
nil
{
...
...
This diff is collapsed.
Click to expand it.
app/sender/sender.go
View file @
ab01bb30
...
...
@@ -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
:
trans
IDInt
,
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
:
trans
IDInt
,
MessageBody
:
trans
,
}
fmt
.
Println
(
"Sending vote request to node"
,
mess
)
encoder
:=
json
.
NewEncoder
(
conn
)
err
:=
encoder
.
Encode
(
mess
)
...
...
This diff is collapsed.
Click to expand it.