-
Notifications
You must be signed in to change notification settings - Fork 110
contract, swap: refactor backend to commit on sendTransaction #2092
Conversation
639902e
to
f48be97
Compare
f48be97
to
6e02008
Compare
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.
Functionally equivalent. Refactor by putting the backend logic to a separate file.
From the PR description, it is not immediately clear how and why this modification was needed, but I assume a follow-up PR comes where the purpose of this refactor will become clear.
I added one comment about the Close function which is not implemented. Please address this one before merging.
@Eknir regarding the why this was needed:
|
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.
few more minor things but otherwise LGTM
This PR introduces the
chain.WaitMined
function which supersedes the globalcontract.WaitFunc
(which was used for testing and modified by thesetupContractTest
helper function) and thebind.WaitMined
function.During tests , the simulated backend is wrapped in a
chain.TestBackend
which commits after a successfulSendTransaction
. All backend specific stuff was moved from thecontracts/swap
package to the newswap/chain
package which will contain the transaction queue in a follow-up PR.bind.WaitMined
is no longer used as it required atypes.Transaction
which might not be available. Instead a slightly modified version thereof is included in thechain
package. ThesetupContractTest
is only used for the cash cheque function which will be removed in the next PR, afterwardssetupContractTest
will be dropped.