-
Notifications
You must be signed in to change notification settings - Fork 112
swap: query cheque information through RPC calls #1842
Conversation
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.
exemplary PR.
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.
The TestReceivedCheque
and TestSentCheque
tests seem overly complex considering what they are supposed to verify. We already have tests that check that if a cheque is sent the correct fields are updated (e.g. the test this was copied from). Instead of actually sending cheques you could just use the setter function on peer or the save functions on swap similar to how you are already doing it in the TestAllCheques
function.
Also I don't think you're testing the code path for non-added peers. For that you should call the swap.save*
functions directly (see TestPeerBalance
for reference).
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.
Looks good to me!
…/ReceivedCheque fixed missing memory address in store.get
agree completely. @santicomp2014 and i have addressed these changes, and re-written both of these tests. thank you for pointing this out, as these new tests allowed us to squash a bug when retrieving cheques from the store for the RPC call. |
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.
The TestAllCheques
test is still missing cheques from disconnected peers. Here it's even more important than in the other tests because the logic for them is a lot more complex.
thanks @ralph-pichler, addressed. |
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.
LGTM
This PR implements functions + RPC calls for querying:
nil
as a valid answer)nil
as a valid answer)and also removes the unneeded
api
field from theSwap
struct.