This repository has been archived by the owner on Aug 2, 2021. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
swap: refactor lastReceivedCheque, lastSentCheque, balances to peer #1725
swap: refactor lastReceivedCheque, lastSentCheque, balances to peer #1725
Changes from all commits
f74adfc
c06b8b6
1ef4392
bfeef34
1656304
99081ea
0df68ff
1c58a7c
296863b
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if i understand our coding standards correctly, we could use named parameters here so as not to have to initialize these variables (as long as we don't use naked returns).
however, i don't know if this is still acceptable for relatively long functions like this one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you dont need this declarations, just put a comma after cheque on line 138
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would keep addPeer as it was and put the peer initialisation in the run function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to keep peer initialisation and adding it to the swaps peer mapping in one common function as creating a Peer without adding it to the map is always a mistake (this only happens at one place in the main code but would lead to a lot of duplicate code in the tests). I used to have this in a separate separate function but @holisticode recommended doing this in
addPeer
(see #1725 (comment)).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are we removing the
ok
check here? What if the peer is not in the map? Do you just want to force the caller to check fornil
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this was suggested here (#1725 (comment))