Skip to content

Commit

Permalink
Load wallet in monero-wallet-rpc on demand if necessary
Browse files Browse the repository at this point in the history
Previously, we relied on the wallet in the `monero-wallet-rpc` daemon
to be loaded as we do on startup. As a consequence of this expectation,
restarting `monero-wallet-rpc` to fix bugs like #652 resulted in the
ASB no longer operating correctly.

To fix this, we now load the wallet on-demand in case the daemon responds
with the error code -13.

Ideally, we would implement this behaviour generically using the proxy
pattern on the `MoneroWalletRpc` trait. Unfortunately, when attempting
to do so we uncover a limitation in the design of `jsonrpc_client`.
This limitation is tracked in thomaseizinger/rust-jsonrpc-client#47.
Once fixed, we can implement this logic in a more robust way that is not
tied to the `check_tx_key` RPC call but applies to any RPC call automatically.
  • Loading branch information
thomaseizinger committed Aug 26, 2021
1 parent c04d2dc commit a1db66e
Show file tree
Hide file tree
Showing 3 changed files with 236 additions and 83 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Expand Up @@ -13,6 +13,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
The CLI expects to be connected to the ASB throughout the entire swap and hence reconnects as soon as the connection is closed.
This resulted in a loop of connections being established but instantly closed again because the ASB deemed the connection to not be necessary.
See issue https://github.com/comit-network/xmr-btc-swap/issues/648.
- An issue where the ASB was unable to use the Monero wallet in case `monero-wallet-rpc` has been restarted.
In case no wallet is loaded when we try to interact with the `monero-wallet-rpc` daemon, we now load the correct wallet on-demand.
See issue https://github.com/comit-network/xmr-btc-swap/issues/652.

## [0.8.1] - 2021-08-16

Expand Down
2 changes: 2 additions & 0 deletions monero-rpc/src/lib.rs
Expand Up @@ -14,3 +14,5 @@

pub mod monerod;
pub mod wallet;

pub use jsonrpc_client as jsonrpc;

0 comments on commit a1db66e

Please sign in to comment.