This repository has been archived by the owner on Aug 2, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 110
Swap Bounced Cheque Verification Process #2134
Open
santicomp2014
wants to merge
13
commits into
master
Choose a base branch
from
swap-bounced-cheque
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
5dd7877
swap,contracts/swap: added bounced cheque verification, replace mock …
santicomp2014 0e36987
contracts/swap,swap,vendor: updates swap from [email protected] to go-sw3…
santicomp2014 c57f5cb
cmd/swarm,pss,swap: fixed linter errors S1038/S1039
santicomp2014 c0ee1e9
cmd/swarm: printf simplified
santicomp2014 df12915
contracts/swap,swap: added Bounced call to sc
santicomp2014 a5e942e
swap: refactored bounced cheque into peer
santicomp2014 7ae1bd2
swap: fixed broken swap tests
santicomp2014 2e05270
swap: moved bouncedCheque to addPeer, included tests for bounced cheques
santicomp2014 1ab8756
swap: TestSwapRPC added contract for testing
santicomp2014 4716f90
merge master
santicomp2014 a8a06ff
swap: changed FromUint64 to Uint256From
santicomp2014 bbdde40
swap: fixed TestBouncedCheque
santicomp2014 bde1927
contracts/swap,swap: cleanup of comments and variable naming in code
santicomp2014 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -72,6 +72,15 @@ func NewPeer(p *protocols.Peer, s *Swap, beneficiary common.Address, contractAdd | |
return nil, err | ||
} | ||
|
||
bouncedCheque := false | ||
bouncedCheque, err = peer.hasBouncedCheque() | ||
if err != nil { | ||
return nil, err | ||
} | ||
if bouncedCheque { | ||
return nil, ErrBouncedCheque | ||
} | ||
|
||
return peer, nil | ||
} | ||
|
||
|
@@ -221,3 +230,20 @@ func (p *Peer) sendCheque() error { | |
Cheque: cheque, | ||
}) | ||
} | ||
|
||
// hasBouncedCheque returns the boolean indicating if a cheque attempted to be cashed has been bounced it in the receiver peer | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. spare |
||
// Once its bounced, it will not change it's state again, unless re deployed. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same typo here |
||
func (p *Peer) hasBouncedCheque() (bool, error) { | ||
bouncedCheque := false | ||
var err error | ||
|
||
// if chequebook not defined don't call contract methods | ||
if p.swap.contract != nil { | ||
bouncedCheque, err = p.swap.contract.Bounced(nil) | ||
if err != nil { | ||
return false, err | ||
} | ||
} | ||
|
||
return bouncedCheque, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
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 have a spare
it
inhas been bounced it in the receiver