Commit Graph

22 Commits (8d76607343bfbbab24dda4bf7d8cf17e6906f77c)

Author SHA1 Message Date
Thomas Eizinger 8d76607343
Refactor monero-harness containers
1. Split up image::Monero into Monerod and MoneroWalletRpc
2. Don't use `bash` to run the internal command. Instead we disable
the entrypoint script as per https://github.com/XMRto/monero#raw-commands
3. Remove the start up delay by listening for the correct log message.
To make this more resilient, we make the log level NOT configurable and
instead always log verbosely.
3 years ago
Thomas Eizinger dc840e1562
Take wallet names by reference
We are always passing constants here. Make that more ergonomic.
3 years ago
Thomas Eizinger 6d06db3259
Use macro-based JSON-RPC client 3 years ago
Daniel Karzel c976358c37
Multiple swaps with the same peer
- Swap-id is exchanged during execution setup. CLI (Bob) sends the swap-id to be used in his first message.
- Transfer poof and encryption signature messages include the swap-id so it can be properly associated with the correct swap.
- ASB: Encryption signatures are associated with swaps by swap-id, not peer-id.
- ASB: Transfer proofs are still associated to peer-ids (because they have to be sent to the respective peer), but the ASB can buffer multiple
- CLI: Incoming transfer proofs are checked for matching swap-id. If a transfer proof with a different swap-id than the current executing swap is received it will be ignored. We can change this to saving into the database.

Includes concurrent swap tests with the same Bob.

- One test that pauses and starts an additional swap after the transfer proof was received. Results in both swaps being redeemed after resuming the first swap.
- One test that pauses and starts an additional swap before the transfer proof is sent (just after BTC locked). Results in the second swap redeeming and the first swap being refunded (because the transfer proof on Bob's side is lost). Once we store transfer proofs that we receive during executing a different swap into the database both swaps should redeem.

Note that the monero harness was adapted to allow creating wallets with multiple outputs, which is needed for Alice.
3 years ago
Thomas Eizinger 908dae3442
Inline tracing initialization
This code snippet is so short, it might as well be inlined to give
the test more control over what it wants to log.
3 years ago
Daniel Karzel 2bb1c1e177 No prefix for wallets in monero harness
Prefixing docker-containers and -networks is a necessity to be able to spin up multiple containers and networks.
However, there is no reason to prefix the wallet names that live inside a container. One cannot add a wallet with
the same name twice, so the prefixing of wallets does not bring any advantage. When re-opening a wallet by name
the wallet name prefix is cumbersome and was thus removed.
3 years ago
Daniel Karzel 31c23a24ac use tokio::time::sleep instead of std:🧵:sleep 3 years ago
Daniel Karzel 96115da039 Wait for wallet to catch up instead of block generation
The monero harness wallet always starts a miner that mines new blocks every second.
This can conflict with additionally triggering block generation  and cause this error:

```
monero_rpc::rpc::monerod: generate blocks response: {
  "error": {
    "code": -7,
    "message": "Block not accepted"
  },
  "id": "1",
  "jsonrpc": "2.0"
}
```

Since the miner is generating blocks anyway we can wait for the wallet to catch up.
Refresh is done upon querying the balance, thus the refresh calls were removed.
3 years ago
Daniel Karzel bfc388d264 Enable tracing in monero-harness 3 years ago
rishflab fcec465bdb Revert "No need to send Monero transfer proof from Alice to Bob" 4 years ago
Lucas Soriano del Pino 7371dfb055 Test that a watch only wallet can be loaded from address + view key 4 years ago
Philipp Hoenisch 1a38bf57f2
Rename inner to client 4 years ago
Philipp Hoenisch f0fbe785c8
Remove Alice and Bob from utility struct 4 years ago
Philipp Hoenisch 306176b3e6
PR feedback:
Removed network prefix and use the same for container and network.
Add sentence explaining prefix
4 years ago
Philipp Hoenisch 0b9e8c145e
Update xmr-btc lib to use new monero-harness 4 years ago
Philipp Hoenisch 3cc32002b0
Refactor out some helper functions to generate blocks after funding 4 years ago
Philipp Hoenisch 3a34800311
Refactor into monero helper struct 4 years ago
Philipp Hoenisch 738c67a421
Simple fund and send in test 4 years ago
Philipp Hoenisch f5643a4ea4
Miner working 4 years ago
Philipp Hoenisch c0109d12cd
Use lib to ensure ports are free 4 years ago
Lucas Soriano del Pino 50ed74319f Simplify xmr-btc/tests Monero wallet
- Make it the same for Alice and Bob.
- Make it contain a wallet client instead of the `Monero` struct.

Also:

Remove `Container` from inside `Monero` struct. The caller of `new`
can simply ensure that `Container` is not dropped to keep the
container alive.

This makes the `Monero` struct easier to work with, as it just holds
the data necessary to create the different clients created during
`init`, and does not have any lifetime restrictions.
4 years ago
Lucas Soriano del Pino 1f99cf001c Swap Monero for Bitcoin
Co-authored-by: rishflab <rishflab@hotmail.com>
Co-authored-by: Philipp Hoenisch <philipp@hoenisch.at>
Co-authored-by: Tobin C. Harding <tobin@coblox.tech>
4 years ago