mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-06-06 22:29:05 -04:00
Merge #144
144: Test refactor r=da-kami a=da-kami This PR is pure refactoring, keeping the logic of the tests we had before. No production code is touched besides re-exports in early commits (no logic changes). In the follow ups improvements will be introduced, that touch the production code as well. All remaining tasks actioned since Friday: - [x] `happy_path_bob _restart` (trivial) - [x] add refund assertions to harnesses (trivial) - [x] convert all refund scenarios currently being tested (trivial) - [x] remove dead test init code once all old tests are converted - [ ] ~~(optional) move alice and bob harness code into separate files~~ -> might action this once re-using test code in production. Out of scope, follow up: - [x] https://github.com/comit-network/xmr-btc-swap/pull/145 - We can do exact assertions for Bob's redeem as well, but have to store Bob's `tx_lock` id in the respective final state. Make `tx_lock` available in `BtcRedeemed` and `BtcPunished` to have better assertions / harmonize test behaviour. - [ ] update the production code to use the `Alice` and `Bob` structs to bundle the params - update tests to use the production struct. - [ ] Re-use test swap setup in production (i.e. `Alice-/BobHarness::new`) to setup the swap. - [ ] add additional tests - [ ] re-try moving the tests from `test` to `src` (if the peer_id was the only problem this should be trivial now - but should be done after the refactor is finished) - [ ] creating new wallets upon restart - [ ] aborting the old event loop after restart Co-authored-by: rishflab <rishflab@hotmail.com> Co-authored-by: Daniel Karzel <daniel@comit.network>
This commit is contained in:
commit
a7f68e4aa1
11 changed files with 723 additions and 985 deletions
|
@ -88,12 +88,11 @@ pub async fn run_until(
|
|||
state: AliceState,
|
||||
is_target_state: fn(&AliceState) -> bool,
|
||||
mut event_loop_handle: EventLoopHandle,
|
||||
bitcoin_wallet: Arc<crate::bitcoin::Wallet>,
|
||||
monero_wallet: Arc<crate::monero::Wallet>,
|
||||
bitcoin_wallet: Arc<bitcoin::Wallet>,
|
||||
monero_wallet: Arc<monero::Wallet>,
|
||||
config: Config,
|
||||
swap_id: Uuid,
|
||||
db: Database,
|
||||
// TODO: Remove EventLoopHandle!
|
||||
) -> Result<AliceState> {
|
||||
info!("Current state:{}", state);
|
||||
if is_target_state(&state) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue