Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Funds Lost - JSON-RPC request failed with code -4: No unlocked balance in the specified account #848

Closed
AlaattinK02 opened this issue Nov 21, 2021 · 8 comments

Comments

@AlaattinK02
Copy link

AlaattinK02 commented Nov 21, 2021

Describe the bug
Swap is on "btc is redeemed" state but i cant resume the transaction and get my funds back, when i try to it says:

Failed to generate monero wallet from keys: Failed to generate new wallet from keys: JSON-RPC request failed with code -1: Wallet already exists.: JSON-RPC request failed with code -1: Wallet already exists.
Falling back to trying to open the the wallet if it already exists wallet_file_name=
Connected to Alice at /ip4/
Error: JSON-RPC request failed with code -4: No unlocked balance in the specified account

Caused by:
    JSON-RPC request failed with code -4: No unlocked balance in the specified account

Lost/trapped Funds
Yes

Debug logs

Nov 19 02:20:52.073  INFO Attempting to migrate old data to the new sqlite database...
Nov 19 02:20:52.073 DEBUG Opening database at /Users/User/Library/Application Support/xmr-btc-swap/cli/mainnet/database
Nov 19 02:20:52.147  INFO Sucessfully migrated data to sqlite! Using sqlite.
Nov 19 02:20:52.167 DEBUG Reading in seed from /Users/User/Library/Application Support/xmr-btc-swap/cli/mainnet/seed.pem
Nov 19 02:20:54.415 DEBUG Starting monero-wallet-rpc port=52136
Nov 19 02:20:58.881 DEBUG Opened Monero wallet monero_wallet_name=swap-tool-blockchain-monitoring-wallet
Nov 19 02:21:15.038 DEBUG Network layer initialized peer_id=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Nov 19 02:21:15.038 DEBUG Requesting quote
Nov 19 02:21:15.325  INFO Connected to Alice at /ip4/xxxxxxx/xxxxxx/xxx/xx/xxxxxxxxxxxxxxx
Nov 19 02:21:15.397  INFO Received quote price=xxxxxx minimum_amount=xxxxxxxx maximum_amount=xxxxxxxxx BTC
Nov 19 02:21:15.413  INFO Waiting for Bitcoin deposit deposit_address=xxxxxxxxxxxxxxxxxxxxxxxxxxxx max_giveable=0.00000000 BTC minimum_amount=xxxxxxxx maximum_amount=xxxxxxxxx BTC
Nov 19 02:22:43.846  INFO Received Bitcoin new_balance=xxxxxxxxx BTC max_giveable=xxxxxxxxxx BTC
Nov 19 02:22:43.847  INFO Determined swap amount amount=xxxxxxxxxx BTC fees=xxxxxxxxx BTC
Nov 19 02:22:43.849 DEBUG Advancing state state=quote has been requested
Nov 19 02:22:44.182 DEBUG Estimated fee for transaction weight=xxx fee_rate=xxx sats_per_vbyte=xxx
Nov 19 02:22:44.182  WARN Estimated fee of xxx is smaller than the min relay fee, defaulting to min relay fee 1000
Nov 19 02:22:44.516 DEBUG Estimated fee for transaction weight=xxx fee_rate=xxx sats_per_vbyte=xxx
Nov 19 02:22:44.516  WARN Estimated fee of xxx is smaller than the min relay fee, defaulting to min relay fee 1000
Nov 19 02:22:46.721  INFO Starting new swap swap_id=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx
Nov 19 02:22:46.724 DEBUG Advancing state state=execution setup done
Nov 19 02:22:46.900  INFO Published Bitcoin transaction txid=xxxxxxxxxxxxxxxxxxxxxxxxxxxx kind=lock
Nov 19 02:22:46.903 DEBUG Advancing state state=btc is locked
Nov 19 02:22:47.261  INFO Waiting for Alice to lock Monero
Nov 19 02:22:51.729 DEBUG Found relevant Bitcoin transaction txid=xxxxxxxxxxxxxxxxxxxxxxxxxxxx status=in mempool
Nov 19 02:32:17.370 DEBUG Got notification for new block block_height=xxxxxx
Nov 19 02:32:17.550 DEBUG Bitcoin transaction status changed txid=xxxxxxxxxxxxxxxxxxxxxxxxxxxx new_status=confirmed with 1 blocks old_status=in mempool
Nov 19 02:35:31.074  WARN Failed to get status of script: Failed to subscribe to header notifications: Made one or multiple attempts, all errored:
	- CloseNotify alert received
 txid=xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Nov 19 02:50:58.665 DEBUG Using existing sqlite database.
Nov 19 02:50:58.670 DEBUG Reading in seed from /Users/User/Library/Application Support/xmr-btc-swap/cli/mainnet/seed.pem
Nov 19 02:51:01.829 DEBUG Starting monero-wallet-rpc port=52453
Nov 19 02:51:04.814 DEBUG Opened Monero wallet monero_wallet_name=swap-tool-blockchain-monitoring-wallet
Nov 19 02:51:19.850 DEBUG Network layer initialized peer_id=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Nov 19 02:51:19.851 DEBUG Advancing state state=btc is locked
Nov 19 02:51:19.856  INFO Waiting for Alice to lock Monero
Nov 19 02:51:20.172  INFO Connected to Alice at /ip4/xxxxxxx/xxxxxx/xxx/xx/xxxxxxxxxxxxxxx
Nov 19 02:51:20.265  INFO Alice locked Monero txid=xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Nov 19 02:51:20.267 DEBUG Advancing state state=XMR lock transaction transfer proof received
Nov 19 02:51:20.268  INFO Waiting for Monero transaction finality txid=xxxxxxxxxxxxxxxxxxxxxxxxxxxx target_confirmations=10
Nov 19 02:51:20.490  INFO Received new confirmation for Monero lock tx txid=xxxxxxxxxxxxxxxxxxxxxxxxxxxx seen_confirmations=3 needed_confirmations=10
Nov 19 02:51:24.857 DEBUG Found relevant Bitcoin transaction txid=xxxxxxxxxxxxxxxxxxxxxxxxxxxx status=unseen
Nov 19 02:52:07.857 DEBUG Bitcoin transaction status changed txid=xxxxxxxxxxxxxxxxxxxxxxxxxxxx new_status=confirmed with 3 blocks old_status=unseen
Nov 19 02:53:32.474  INFO Received new confirmation for Monero lock tx txid=xxxxxxxxxxxxxxxxxxxxxxxxxxxx seen_confirmations=4 needed_confirmations=10
Nov 19 02:56:20.453  INFO Received new confirmation for Monero lock tx txid=xxxxxxxxxxxxxxxxxxxxxxxxxxxx seen_confirmations=5 needed_confirmations=10
Nov 19 02:58:23.041 DEBUG Got notification for new block block_height=xxxxxx
Nov 19 02:58:23.225 DEBUG Bitcoin transaction status changed txid=xxxxxxxxxxxxxxxxxxxxxxxxxxxx new_status=confirmed with 4 blocks old_status=confirmed with 3 blocks
Nov 19 03:01:44.446  INFO Received new confirmation for Monero lock tx txid=xxxxxxxxxxxxxxxxxxxxxxxxxxxx seen_confirmations=6 needed_confirmations=10
Nov 19 03:03:08.471  INFO Received new confirmation for Monero lock tx txid=xxxxxxxxxxxxxxxxxxxxxxxxxxxx seen_confirmations=7 needed_confirmations=10
Nov 19 03:03:44.549  INFO Received new confirmation for Monero lock tx txid=xxxxxxxxxxxxxxxxxxxxxxxxxxxx seen_confirmations=8 needed_confirmations=10
Nov 19 03:04:08.451  INFO Received new confirmation for Monero lock tx txid=xxxxxxxxxxxxxxxxxxxxxxxxxxxx seen_confirmations=9 needed_confirmations=10
Nov 19 03:05:59.272  WARN `monero-wallet-rpc` failed to fetch transaction, may need to be restarted txid=xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Nov 19 03:06:11.266  INFO Received new confirmation for Monero lock tx txid=xxxxxxxxxxxxxxxxxxxxxxxxxxxx seen_confirmations=10 needed_confirmations=10
Nov 19 03:06:11.271 DEBUG Advancing state state=xmr is locked
Nov 19 03:06:11.272 DEBUG Constructed Bitcoin spending transaction fee=1000
Nov 19 03:06:11.422 DEBUG Advancing state state=encrypted signature is sent
Nov 19 03:06:11.423 DEBUG Constructed Bitcoin spending transaction fee=1000
Nov 19 03:06:16.429 DEBUG Found relevant Bitcoin transaction txid=xxxxxxxxxxxxxxxxxxxxxxxxxxxx status=unseen
Nov 19 03:06:41.874 DEBUG Bitcoin transaction status changed txid=xxxxxxxxxxxxxxxxxxxxxxxxxxxx new_status=in mempool old_status=unseen
Nov 19 03:06:44.666 DEBUG Advancing state state=btc is redeemed
Nov 19 03:07:51.073 DEBUG Using existing sqlite database.
Nov 19 03:07:51.079 DEBUG Reading in seed from /Users/User/Library/Application Support/xmr-btc-swap/cli/mainnet/seed.pem
Nov 19 03:07:53.431 DEBUG Starting monero-wallet-rpc port=52570
Nov 19 03:07:56.298 DEBUG Opened Monero wallet monero_wallet_name=swap-tool-blockchain-monitoring-wallet
Nov 19 03:07:56.302 DEBUG Network layer initialized peer_id=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Nov 19 03:07:56.302 DEBUG Advancing state state=btc is redeemed
Nov 19 03:07:56.305  WARN Failed to generate monero wallet from keys: Failed to generate new wallet from keys: JSON-RPC request failed with code -1: Wallet already exists.: JSON-RPC request failed with code -1: Wallet already exists.
Nov 19 03:07:56.305  INFO Falling back to trying to open the the wallet if it already exists wallet_file_name=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx
Nov 19 03:07:56.567  INFO Connected to Alice at /ip4/xxxxxxx/xxxxxx/xxx/xx/xxxxxxxxxxxxxxx
Nov 19 03:08:36.743 DEBUG Using existing sqlite database.
Nov 19 03:08:36.747 DEBUG Reading in seed from /Users/User/Library/Application Support/xmr-btc-swap/cli/mainnet/seed.pem
Nov 19 03:08:39.110 DEBUG Starting monero-wallet-rpc port=52584
Nov 19 03:08:41.432 DEBUG Opened Monero wallet monero_wallet_name=swap-tool-blockchain-monitoring-wallet
Nov 19 03:08:41.435 DEBUG Network layer initialized peer_id=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Nov 19 03:08:41.436 DEBUG Advancing state state=btc is redeemed
Nov 19 03:08:41.438  WARN Failed to generate monero wallet from keys: Failed to generate new wallet from keys: JSON-RPC request failed with code -1: Wallet already exists.: JSON-RPC request failed with code -1: Wallet already exists.
Nov 19 03:08:41.438  INFO Falling back to trying to open the the wallet if it already exists wallet_file_name=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx
Nov 19 03:08:41.696  INFO Connected to Alice at /ip4/xxxxxxx/xxxxxx/xxx/xx/xxxxxxxxxxxxxxx
Nov 19 03:10:55.814 DEBUG Using existing sqlite database.
Nov 19 03:10:55.837 DEBUG Reading in seed from /Users/User/Library/Application Support/xmr-btc-swap/cli/mainnet/seed.pem
Nov 19 03:10:58.121 DEBUG Starting monero-wallet-rpc port=52630
Nov 19 03:11:01.766 DEBUG Opened Monero wallet monero_wallet_name=swap-tool-blockchain-monitoring-wallet
Nov 19 03:11:17.732 DEBUG Network layer initialized peer_id=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Nov 19 03:11:17.732 DEBUG Advancing state state=btc is redeemed
Nov 19 03:11:17.736  WARN Failed to generate monero wallet from keys: Failed to generate new wallet from keys: JSON-RPC request failed with code -1: Wallet already exists.: JSON-RPC request failed with code -1: Wallet already exists.
Nov 19 03:11:17.736  INFO Falling back to trying to open the the wallet if it already exists wallet_file_name=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx
Nov 19 03:11:17.993  INFO Connected to Alice at /ip4/xxxxxxx/xxxxxx/xxx/xx/xxxxxxxxxxxxxxx
Nov 19 03:13:44.142 DEBUG Using existing sqlite database.
Nov 19 03:13:44.156 DEBUG Reading in seed from /Users/User/Library/Application Support/xmr-btc-swap/cli/mainnet/seed.pem
Nov 19 03:13:46.573 DEBUG Starting monero-wallet-rpc port=52740
Nov 19 03:13:51.285 DEBUG Opened Monero wallet monero_wallet_name=swap-tool-blockchain-monitoring-wallet
Nov 19 03:14:06.165 DEBUG Network layer initialized peer_id=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Nov 19 03:14:06.171 DEBUG Advancing state state=btc is redeemed
Nov 19 03:14:06.178  WARN Failed to generate monero wallet from keys: Failed to generate new wallet from keys: JSON-RPC request failed with code -1: Wallet already exists.: JSON-RPC request failed with code -1: Wallet already exists.
Nov 19 03:14:06.178  INFO Falling back to trying to open the the wallet if it already exists wallet_file_name=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx
Nov 19 03:14:06.438  INFO Connected to Alice at /ip4/xxxxxxx/xxxxxx/xxx/xx/xxxxxxxxxxxxxxx
Nov 19 03:15:57.471 DEBUG Using existing sqlite database.
Nov 19 03:15:57.484 DEBUG Reading in seed from /Users/User/Library/Application Support/xmr-btc-swap/cli/mainnet/seed.pem
Nov 19 03:15:59.786 DEBUG Starting monero-wallet-rpc port=52830
Nov 19 03:16:04.204 DEBUG Opened Monero wallet monero_wallet_name=swap-tool-blockchain-monitoring-wallet
Nov 19 03:16:19.601 DEBUG Network layer initialized peer_id=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Nov 19 03:16:19.606 DEBUG Advancing state state=btc is redeemed
Nov 19 03:16:19.610  WARN Failed to generate monero wallet from keys: Failed to generate new wallet from keys: JSON-RPC request failed with code -1: Wallet already exists.: JSON-RPC request failed with code -1: Wallet already exists.
Nov 19 03:16:19.610  INFO Falling back to trying to open the the wallet if it already exists wallet_file_name=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx
Nov 19 03:16:19.869  INFO Connected to Alice at /ip4/xxxxxxx/xxxxxx/xxx/xx/xxxxxxxxxxxxxxx
Nov 19 03:17:31.490 DEBUG Using existing sqlite database.
Nov 19 03:17:31.511 DEBUG Reading in seed from /Users/User/Library/Application Support/xmr-btc-swap/cli/mainnet/seed.pem
Nov 19 03:17:34.099 DEBUG Starting monero-wallet-rpc port=52919
Nov 19 03:17:39.461 DEBUG Opened Monero wallet monero_wallet_name=swap-tool-blockchain-monitoring-wallet
Nov 19 03:17:55.131 DEBUG Network layer initialized peer_id=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Nov 19 03:17:55.136 DEBUG Advancing state state=btc is redeemed
Nov 19 03:17:55.140  WARN Failed to generate monero wallet from keys: Failed to generate new wallet from keys: JSON-RPC request failed with code -1: Wallet already exists.: JSON-RPC request failed with code -1: Wallet already exists.
Nov 19 03:17:55.141  INFO Falling back to trying to open the the wallet if it already exists wallet_file_name=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx
Nov 19 03:17:55.396  INFO Connected to Alice at /ip4/xxxxxxx/xxxxxx/xxx/xx/xxxxxxxxxxxxxxx
Nov 19 03:20:42.443 DEBUG Using existing sqlite database.
Nov 19 03:20:42.456 DEBUG Reading in seed from /Users/User/Library/Application Support/xmr-btc-swap/cli/mainnet/seed.pem
Nov 19 03:20:44.756 DEBUG Starting monero-wallet-rpc port=53010
Nov 19 03:20:49.564 DEBUG Opened Monero wallet monero_wallet_name=swap-tool-blockchain-monitoring-wallet
Nov 19 03:21:04.700 DEBUG Network layer initialized peer_id=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Nov 19 03:21:04.704 DEBUG Advancing state state=btc is redeemed
Nov 19 03:21:04.708  WARN Failed to generate monero wallet from keys: Failed to generate new wallet from keys: JSON-RPC request failed with code -1: Wallet already exists.: JSON-RPC request failed with code -1: Wallet already exists.
Nov 19 03:21:04.708  INFO Falling back to trying to open the the wallet if it already exists wallet_file_name=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx
Nov 19 03:21:04.967  INFO Connected to Alice at /ip4/xxxxxxx/xxxxxx/xxx/xx/xxxxxxxxxxxxxxx
Nov 19 03:21:53.096 DEBUG Using existing sqlite database.
Nov 19 03:21:53.100 DEBUG Reading in seed from /Users/User/Library/Application Support/xmr-btc-swap/cli/mainnet/seed.pem
Nov 19 03:22:11.287 DEBUG Using existing sqlite database.
Nov 19 03:22:11.292 DEBUG Reading in seed from /Users/User/Library/Application Support/xmr-btc-swap/cli/mainnet/seed.pem
Nov 19 03:22:20.237 DEBUG Using existing sqlite database.
Nov 19 03:22:20.261 DEBUG Reading in seed from /Users/User/Library/Application Support/xmr-btc-swap/cli/mainnet/seed.pem
Nov 19 03:23:27.721 DEBUG Using existing sqlite database.
Nov 19 03:23:27.734 DEBUG Reading in seed from /Users/User/Library/Application Support/xmr-btc-swap/cli/mainnet/seed.pem
Nov 19 03:23:29.845 DEBUG Starting monero-wallet-rpc port=53062
Nov 19 03:23:33.322 DEBUG Opened Monero wallet monero_wallet_name=swap-tool-blockchain-monitoring-wallet
Nov 19 03:23:47.502 DEBUG Network layer initialized peer_id=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Nov 19 03:23:47.507 DEBUG Advancing state state=btc is redeemed
Nov 19 03:23:47.511  WARN Failed to generate monero wallet from keys: Failed to generate new wallet from keys: JSON-RPC request failed with code -1: Wallet already exists.: JSON-RPC request failed with code -1: Wallet already exists.
Nov 19 03:23:47.511  INFO Falling back to trying to open the the wallet if it already exists wallet_file_name=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx
Nov 19 03:23:47.771  INFO Connected to Alice at /ip4/xxxxxxx/xxxxxx/xxx/xx/xxxxxxxxxxxxxxx
Nov 19 03:25:01.123 DEBUG Using existing sqlite database.
Nov 19 03:25:01.136 DEBUG Reading in seed from /Users/User/Library/Application Support/xmr-btc-swap/cli/mainnet/seed.pem
Nov 19 03:25:03.589 DEBUG Starting monero-wallet-rpc port=53091
Nov 19 03:25:07.756 DEBUG Opened Monero wallet monero_wallet_name=swap-tool-blockchain-monitoring-wallet
Nov 19 03:25:22.354 DEBUG Network layer initialized peer_id=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Nov 19 03:25:22.358 DEBUG Advancing state state=btc is redeemed
Nov 19 03:25:22.363  WARN Failed to generate monero wallet from keys: Failed to generate new wallet from keys: JSON-RPC request failed with code -1: Wallet already exists.: JSON-RPC request failed with code -1: Wallet already exists.
Nov 19 03:25:22.363  INFO Falling back to trying to open the the wallet if it already exists wallet_file_name=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx
Nov 19 03:25:22.620  INFO Connected to Alice at /ip4/xxxxxxx/xxxxxx/xxx/xx/xxxxxxxxxxxxxxx
Nov 19 03:29:18.153 DEBUG Using existing sqlite database.
Nov 19 03:29:18.172 DEBUG Reading in seed from /Users/User/Library/Application Support/xmr-btc-swap/cli/mainnet/seed.pem
Nov 19 03:29:21.014 DEBUG Starting monero-wallet-rpc port=49621
Nov 19 03:29:23.879 DEBUG Opened Monero wallet monero_wallet_name=swap-tool-blockchain-monitoring-wallet
Nov 19 03:29:38.372 DEBUG Network layer initialized peer_id=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Nov 19 03:29:38.380 DEBUG Advancing state state=btc is redeemed
Nov 19 03:29:38.393  WARN Failed to generate monero wallet from keys: Failed to generate new wallet from keys: JSON-RPC request failed with code -1: Wallet already exists.: JSON-RPC request failed with code -1: Wallet already exists.
Nov 19 03:29:38.394  INFO Falling back to trying to open the the wallet if it already exists wallet_file_name=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx
Nov 19 03:29:38.697  INFO Connected to Alice at /ip4/xxxxxxx/xxxxxx/xxx/xx/xxxxxxxxxxxxxxx
Nov 19 03:41:28.854 DEBUG Using existing sqlite database.
Nov 19 03:41:28.858 DEBUG Reading in seed from /Users/User/Library/Application Support/xmr-btc-swap/cli/mainnet/seed.pem
Nov 19 03:41:31.228 DEBUG Starting monero-wallet-rpc port=50091
Nov 19 03:41:34.783 DEBUG Opened Monero wallet monero_wallet_name=swap-tool-blockchain-monitoring-wallet
Nov 19 03:41:53.678 DEBUG Network layer initialized peer_id=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Nov 19 03:41:53.679 DEBUG Advancing state state=btc is redeemed
Nov 19 03:41:53.688  WARN Failed to generate monero wallet from keys: Failed to generate new wallet from keys: JSON-RPC request failed with code -1: Wallet already exists.: JSON-RPC request failed with code -1: Wallet already exists.
Nov 19 03:41:53.688  INFO Falling back to trying to open the the wallet if it already exists wallet_file_name=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx
Nov 19 03:41:53.949  INFO Connected to Alice at /ip4/xxxxxxx/xxxxxx/xxx/xx/xxxxxxxxxxxxxxx
Nov 19 03:56:36.599 DEBUG Using existing sqlite database.
Nov 19 03:56:36.603 DEBUG Reading in seed from /Users/User/Library/Application Support/xmr-btc-swap/cli/mainnet/seed.pem
Nov 19 03:56:39.078 DEBUG Starting monero-wallet-rpc port=50226
Nov 19 03:56:44.214 DEBUG Opened Monero wallet monero_wallet_name=swap-tool-blockchain-monitoring-wallet
Nov 19 03:56:59.439 DEBUG Network layer initialized peer_id=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Nov 19 03:56:59.440 DEBUG Advancing state state=btc is redeemed
Nov 19 03:56:59.444  WARN Failed to generate monero wallet from keys: Failed to generate new wallet from keys: JSON-RPC request failed with code -1: Wallet already exists.: JSON-RPC request failed with code -1: Wallet already exists.
Nov 19 03:56:59.445  INFO Falling back to trying to open the the wallet if it already exists wallet_file_name=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx
Nov 19 03:56:59.708  INFO Connected to Alice at /ip4/xxxxxxx/xxxxxx/xxx/xx/xxxxxxxxxxxxxxx
Nov 19 04:01:56.010 DEBUG Using existing sqlite database.
Nov 19 04:01:56.022 DEBUG Reading in seed from /Users/User/Library/Application Support/xmr-btc-swap/cli/mainnet/seed.pem
Nov 19 04:01:58.337 DEBUG Starting monero-wallet-rpc port=50293
Nov 19 04:02:02.665 DEBUG Opened Monero wallet monero_wallet_name=swap-tool-blockchain-monitoring-wallet
Nov 19 04:02:20.911 DEBUG Network layer initialized peer_id=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Nov 19 04:02:20.914 DEBUG Advancing state state=btc is redeemed
Nov 19 04:02:20.935  WARN Failed to generate monero wallet from keys: Failed to generate new wallet from keys: JSON-RPC request failed with code -1: Wallet already exists.: JSON-RPC request failed with code -1: Wallet already exists.
Nov 19 04:02:20.935  INFO Falling back to trying to open the the wallet if it already exists wallet_file_name=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx
Nov 19 04:02:21.174  INFO Connected to Alice at /ip4/xxxxxxx/xxxxxx/xxx/xx/xxxxxxxxxxxxxxx
Nov 19 04:02:59.897 DEBUG Using existing sqlite database.
Nov 19 04:02:59.900 DEBUG Reading in seed from /Users/User/Library/Application Support/xmr-btc-swap/cli/mainnet/seed.pem
Nov 19 04:03:02.205 DEBUG Starting monero-wallet-rpc port=50324
Nov 19 04:03:05.542 DEBUG Opened Monero wallet monero_wallet_name=swap-tool-blockchain-monitoring-wallet
Nov 19 04:03:22.504 DEBUG Network layer initialized peer_id=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Nov 19 04:03:22.505 DEBUG Advancing state state=btc is redeemed
Nov 19 04:03:22.511  WARN Failed to generate monero wallet from keys: Failed to generate new wallet from keys: JSON-RPC request failed with code -1: Wallet already exists.: JSON-RPC request failed with code -1: Wallet already exists.
Nov 19 04:03:22.511  INFO Falling back to trying to open the the wallet if it already exists wallet_file_name=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx
Nov 19 04:03:22.776  INFO Connected to Alice at /ip4/xxxxxxx/xxxxxx/xxx/xx/xxxxxxxxxxxxxxx
Nov 19 04:06:01.127 DEBUG Using existing sqlite database.
Nov 19 04:06:01.130 DEBUG Reading in seed from /Users/User/Library/Application Support/xmr-btc-swap/cli/mainnet/seed.pem
Nov 19 04:10:40.325 DEBUG Opening database at /Users/User/Library/Application Support/xmr-btc-swap/cli/mainnet/database
Nov 19 04:10:40.356 DEBUG Reading in seed from /Users/User/Library/Application Support/xmr-btc-swap/cli/mainnet/seed.pem
Nov 19 04:10:43.191 DEBUG Starting monero-wallet-rpc port=50438
Nov 19 04:10:48.032 DEBUG Opened Monero wallet monero_wallet_name=swap-tool-blockchain-monitoring-wallet
Nov 19 04:13:38.502 DEBUG Using existing sqlite database.
Nov 19 04:13:38.506 DEBUG Reading in seed from /Users/User/Library/Application Support/xmr-btc-swap/cli/mainnet/seed.pem
Nov 19 04:13:41.070 DEBUG Starting monero-wallet-rpc port=50469
Nov 19 04:13:45.504 DEBUG Opened Monero wallet monero_wallet_name=swap-tool-blockchain-monitoring-wallet
Nov 19 04:14:03.116 DEBUG Network layer initialized peer_id=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Nov 19 04:14:03.117 DEBUG Advancing state state=btc is redeemed
Nov 19 04:14:03.119  WARN Failed to generate monero wallet from keys: Failed to generate new wallet from keys: JSON-RPC request failed with code -1: Wallet already exists.: JSON-RPC request failed with code -1: Wallet already exists.
Nov 19 04:14:03.119  INFO Falling back to trying to open the the wallet if it already exists wallet_file_name=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx
Nov 19 04:14:03.401  INFO Connected to Alice at /ip4/xxxxxxx/xxxxxx/xxx/xx/xxxxxxxxxxxxxxx

Platform (please complete the following information):

  • CLI or ASB: CLI
  • Software Version: 0.9.0
  • Operating System: MacOS 12.0.1
@AlaattinK02 AlaattinK02 changed the title JSON-RPC request failed with code -4: No unlocked balance in the specified account Funds Lost - JSON-RPC request failed with code -4: No unlocked balance in the specified account Nov 21, 2021
@4eMaLo
Copy link

4eMaLo commented Dec 3, 2021

This may be of help #767 (comment)

@AlaattinK02
Copy link
Author

AlaattinK02 commented Dec 3, 2021

It worked @4eMaLo
Thank you so much, i have tried to open it with Monero GUI but didn't think there was a problem with the restore height.

@4eMaLo
Copy link

4eMaLo commented Dec 3, 2021

Glad to hear! This may be because I interrupted the swap. <speculation>I assume once the XMR transaction is signed the wallet is created but the restore height is set to the current height. If the transaction happens to be confirmed before the wallet is created, the wallet-software won't see the transaction</speculation>

This may be solved if we store the current block height before doing anything, then using this height to create the wallet.

@binarybaron
Copy link
Collaborator

binarybaron commented Dec 5, 2021

I think you are correct. It's definitely related to the restore height. This just happened to me as well. In my case the restore height was 979530 and the transaction as included in block 979527

BobState::BtcLocked(state3) => {
let tx_lock_status = bitcoin_wallet.subscribe_to(state3.tx_lock.clone()).await;
if let ExpiredTimelocks::None = state3.current_epoch(bitcoin_wallet).await? {
let transfer_proof_watcher = event_loop_handle.recv_transfer_proof();
let cancel_timelock_expires =
tx_lock_status.wait_until_confirmed_with(state3.cancel_timelock);
// Record the current monero wallet block height so we don't have to scan from
// block 0 once we create the redeem wallet.
let monero_wallet_restore_blockheight = monero_wallet.block_height().await?;
tracing::info!("Waiting for Alice to lock Monero");

This code is executed every time the swap is resumed and the last action of the cli was that Bob locked his bitcoin. This is a problem when Bob locks his bitcoin and then goes offline. Alice then locks her Monero while he is offline. When Bob comes back online, he uses the current Monero block height to create the Monero redeem wallet. When he then tries to redeem the Monero, an error is thrown because the monero-wallet-rpc instance can't detect the lock transaction and therefore can't spend its outputs.

{"timestamp ":"2021-12-05 17:56:53","level":"DEBUG","fields":{"message":"Creating and using new sqlite database."}}
{"timestamp":"2021-12-05 17:56:55","level":"DEBUG","fields":{"message":"Starting monero-wallet-rpc","port":"55818"}}
{"timestamp":"2021-12-05 17:56:58","level":"DEBUG","fields":{"message":"Opened Monero wallet","monero_wallet_name":"swap-tool-blockchain-monitoring-wallet"}}
{"timestamp":"2021-12-05 17:57:01","level":"DEBUG","fields":{"message":"Network layer initialized","peer_id":"12D3KooWCCJ5LZKgZFq3konPNVSQ73vJuUNdstHtMwHh1kegjVMX"}}
{"timestamp":"2021-12-05 17:57:01","level":"DEBUG","fields":{"message":"Requesting quote"}}
{"timestamp":"2021-12-05 17:57:01","level":"INFO","fields":{"message":"Connected to Alice at /dnsaddr/unstoppableswap.net/p2p/12D3KooWLHbHtkK53WoBA82Yht3PCCx6KXYxoJ6QqgXg1rSNtWhR"}}
{"timestamp":"2021-12-05 17:57:02","level":"INFO","fields":{"message":"Received quote","price":"0.00404600 BTC","minimum_amount":"0.00010000 BTC","maximum_amount":"0.10000000 BTC"}}
{"timestamp":"2021-12-05 17:57:02","level":"INFO","fields":{"message":"Waiting for Bitcoin deposit","deposit_address":"tb1qewxx28n6yrv8dtq5yw4vzrll35g6vlq3dy3uzf","max_giveable":"0.00000000 BTC","minimum_amount":"0.00010000 BTC","maximum_amount":"0.10000000 BTC"}}
{"timestamp":"2021-12-05 17:57:54","level":"INFO","fields":{"message":"Received Bitcoin","new_balance":"0.00012000 BTC","max_giveable":"0.00011878 BTC"}}
{"timestamp":"2021-12-05 17:57:54","level":"INFO","fields":{"message":"Determined swap amount","amount":"0.00011878 BTC","fees":"0.00000122 BTC"}}
{"timestamp":"2021-12-05 17:57:54","level":"DEBUG","fields":{"message":"Advancing state","state":"quote has been requested"}}
{"timestamp":"2021-12-05 17:57:54","level":"DEBUG","fields":{"message":"Estimated fee for transaction","weight":"548","fee_rate":"1","sats_per_vbyte":"137.0"}}
{"timestamp":"2021-12-05 17:57:54","level":"WARN","fields":{"message":"Estimated fee of 137.0 is smaller than the min relay fee, defaulting to min relay fee 1000"}}
{"timestamp":"2021-12-05 17:57:54","level":"DEBUG","fields":{"message":"Estimated fee for transaction","weight":"596","fee_rate":"1","sats_per_vbyte":"149.0"}}
{"timestamp":"2021-12-05 17:57:54","level":"WARN","fields":{"message":"Estimated fee of 149.0 is smaller than the min relay fee, defaulting to min relay fee 1000"}}
{"timestamp":"2021-12-05 17:57:57","level":"INFO","fields":{"message":"Starting new swap","swap_id":"7d83bdc9-5e9c-4d69-96cd-22d735b93597"}}
{"timestamp":"2021-12-05 17:57:57","level":"DEBUG","fields":{"message":"Advancing state","state":"execution setup done"}}
{"timestamp":"2021-12-05 17:56:53","level":"DEBUG","fields":{"message":"Creating and using new sqlite database."}}
{"timestamp":"2021-12-05 17:56:53","level":"DEBUG","fields":{"message":"Reading in seed from /Users/anon/Library/Application Support/xmr-btc-swap/cli/testnet/seed.pem"}}
{"timestamp":"2021-12-05 17:56:55","level":"DEBUG","fields":{"message":"Starting monero-wallet-rpc","port":"55818"}}
{"timestamp":"2021-12-05 17:56:58","level":"DEBUG","fields":{"message":"Opened Monero wallet","monero_wallet_name":"swap-tool-blockchain-monitoring-wallet"}}
{"timestamp":"2021-12-05 17:57:01","level":"DEBUG","fields":{"message":"Network layer initialized","peer_id":"12D3KooWCCJ5LZKgZFq3konPNVSQ73vJuUNdstHtMwHh1kegjVMX"}}
{"timestamp":"2021-12-05 17:57:01","level":"DEBUG","fields":{"message":"Requesting quote"}}
{"timestamp":"2021-12-05 17:57:01","level":"INFO","fields":{"message":"Connected to Alice at /dnsaddr/unstoppableswap.net/p2p/12D3KooWLHbHtkK53WoBA82Yht3PCCx6KXYxoJ6QqgXg1rSNtWhR"}}
{"timestamp":"2021-12-05 17:57:02","level":"INFO","fields":{"message":"Received quote","price":"0.00404600 BTC","minimum_amount":"0.00010000 BTC","maximum_amount":"0.10000000 BTC"}}
{"timestamp":"2021-12-05 17:57:02","level":"INFO","fields":{"message":"Waiting for Bitcoin deposit","deposit_address":"tb1qewxx28n6yrv8dtq5yw4vzrll35g6vlq3dy3uzf","max_giveable":"0.00000000 BTC","minimum_amount":"0.00010000 BTC","maximum_amount":"0.10000000 BTC"}}
{"timestamp":"2021-12-05 17:57:54","level":"INFO","fields":{"message":"Received Bitcoin","new_balance":"0.00012000 BTC","max_giveable":"0.00011878 BTC"}}
{"timestamp":"2021-12-05 17:57:54","level":"INFO","fields":{"message":"Determined swap amount","amount":"0.00011878 BTC","fees":"0.00000122 BTC"}}
{"timestamp":"2021-12-05 17:57:54","level":"DEBUG","fields":{"message":"Advancing state","state":"quote has been requested"}}
{"timestamp":"2021-12-05 17:57:54","level":"DEBUG","fields":{"message":"Estimated fee for transaction","weight":"548","fee_rate":"1","sats_per_vbyte":"137.0"}}
{"timestamp":"2021-12-05 17:57:54","level":"WARN","fields":{"message":"Estimated fee of 137.0 is smaller than the min relay fee, defaulting to min relay fee 1000"}}
{"timestamp":"2021-12-05 17:57:54","level":"DEBUG","fields":{"message":"Estimated fee for transaction","weight":"596","fee_rate":"1","sats_per_vbyte":"149.0"}}
{"timestamp":"2021-12-05 17:57:54","level":"WARN","fields":{"message":"Estimated fee of 149.0 is smaller than the min relay fee, defaulting to min relay fee 1000"}}
{"timestamp":"2021-12-05 17:57:57","level":"INFO","fields":{"message":"Starting new swap","swap_id":"7d83bdc9-5e9c-4d69-96cd-22d735b93597"}}
{"timestamp":"2021-12-05 17:57:57","level":"DEBUG","fields":{"message":"Advancing state","state":"execution setup done"}}
{"timestamp":"2021-12-05 17:57:58","level":"INFO","fields":{"message":"Published Bitcoin transaction","txid":"abbe8844611e87e4160ef7ae6e947fdaabe87545255385ec92c7444cb677f81c","kind":"lock"}}
{"timestamp":"2021-12-05 17:57:58","level":"DEBUG","fields":{"message":"Advancing state","state":"btc is locked"}}
{"timestamp":"2021-12-05 17:57:58","level":"INFO","fields":{"message":"Waiting for Alice to lock Monero"}}
{"timestamp":"2021-12-05 17:58:02","level":"DEBUG","fields":{"message":"Found relevant Bitcoin transaction","txid":"abbe8844611e87e4160ef7ae6e947fdaabe87545255385ec92c7444cb677f81c","status":"unseen"}}
{"timestamp":"2021-12-05 17:58:33","level":"DEBUG","fields":{"message":"Using existing sqlite database."}}
{"timestamp":"2021-12-05 17:58:33","level":"DEBUG","fields":{"message":"Reading in seed from /Users/anon/Library/Application Support/xmr-btc-swap/cli/testnet/seed.pem"}}
{"timestamp":"2021-12-05 17:58:35","level":"DEBUG","fields":{"message":"Starting monero-wallet-rpc","port":"55919"}}
{"timestamp":"2021-12-05 18:00:20","level":"DEBUG","fields":{"message":"Using existing sqlite database."}}
{"timestamp":"2021-12-05 18:00:20","level":"DEBUG","fields":{"message":"Reading in seed from /Users/anon/Library/Application Support/xmr-btc-swap/cli/testnet/seed.pem"}}
{"timestamp":"2021-12-05 18:00:21","level":"DEBUG","fields":{"message":"Starting monero-wallet-rpc","port":"55951"}}
{"timestamp":"2021-12-05 18:01:18","level":"DEBUG","fields":{"message":"Using existing sqlite database."}}
{"timestamp":"2021-12-05 18:01:18","level":"DEBUG","fields":{"message":"Reading in seed from /Users/anon/Library/Application Support/xmr-btc-swap/cli/testnet/seed.pem"}}
{"timestamp":"2021-12-05 18:01:19","level":"DEBUG","fields":{"message":"Starting monero-wallet-rpc","port":"55975"}}
{"timestamp":"2021-12-05 18:01:57","level":"DEBUG","fields":{"message":"Using existing sqlite database."}}
{"timestamp":"2021-12-05 18:01:57","level":"DEBUG","fields":{"message":"Reading in seed from /Users/anon/Library/Application Support/xmr-btc-swap/cli/testnet/seed.pem"}}
{"timestamp":"2021-12-05 18:01:59","level":"DEBUG","fields":{"message":"Starting monero-wallet-rpc","port":"55987"}}
{"timestamp":"2021-12-05 18:02:03","level":"DEBUG","fields":{"message":"Opened Monero wallet","monero_wallet_name":"swap-tool-blockchain-monitoring-wallet"}}
{"timestamp":"2021-12-05 18:02:03","level":"DEBUG","fields":{"message":"Advancing state","state":"btc is locked"}}
{"timestamp":"2021-12-05 18:02:03","level":"DEBUG","fields":{"message":"Network layer initialized","peer_id":"12D3KooWCCJ5LZKgZFq3konPNVSQ73vJuUNdstHtMwHh1kegjVMX"}}
{"timestamp":"2021-12-05 18:02:03","level":"INFO","fields":{"message":"Waiting for Alice to lock Monero"}}
{"timestamp":"2021-12-05 18:02:04","level":"INFO","fields":{"message":"Connected to Alice at /dnsaddr/unstoppableswap.net/p2p/12D3KooWLHbHtkK53WoBA82Yht3PCCx6KXYxoJ6QqgXg1rSNtWhR"}}
{"timestamp":"2021-12-05 18:02:08","level":"DEBUG","fields":{"message":"Found relevant Bitcoin transaction","txid":"abbe8844611e87e4160ef7ae6e947fdaabe87545255385ec92c7444cb677f81c","status":"unseen"}}
{"timestamp":"2021-12-05 18:03:06","level":"DEBUG","fields":{"message":"Bitcoin transaction status changed","txid":"abbe8844611e87e4160ef7ae6e947fdaabe87545255385ec92c7444cb677f81c","new_status":"in mempool","old_status":"unseen"}}
{"timestamp":"2021-12-05 18:05:40","level":"DEBUG","fields":{"message":"Using existing sqlite database."}}
{"timestamp":"2021-12-05 18:05:40","level":"DEBUG","fields":{"message":"Reading in seed from /Users/anon/Library/Application Support/xmr-btc-swap/cli/testnet/seed.pem"}}
{"timestamp":"2021-12-05 18:05:42","level":"DEBUG","fields":{"message":"Starting monero-wallet-rpc","port":"56089"}}
{"timestamp":"2021-12-05 18:05:44","level":"DEBUG","fields":{"message":"Opened Monero wallet","monero_wallet_name":"swap-tool-blockchain-monitoring-wallet"}}
{"timestamp":"2021-12-05 18:05:45","level":"DEBUG","fields":{"message":"Network layer initialized","peer_id":"12D3KooWCCJ5LZKgZFq3konPNVSQ73vJuUNdstHtMwHh1kegjVMX"}}
{"timestamp":"2021-12-05 18:05:45","level":"DEBUG","fields":{"message":"Advancing state","state":"btc is locked"}}
{"timestamp":"2021-12-05 18:05:45","level":"INFO","fields":{"message":"Waiting for Alice to lock Monero"}}
{"timestamp":"2021-12-05 18:05:45","level":"INFO","fields":{"message":"Connected to Alice at /dnsaddr/unstoppableswap.net/p2p/12D3KooWLHbHtkK53WoBA82Yht3PCCx6KXYxoJ6QqgXg1rSNtWhR"}}
{"timestamp":"2021-12-05 18:05:50","level":"DEBUG","fields":{"message":"Found relevant Bitcoin transaction","txid":"abbe8844611e87e4160ef7ae6e947fdaabe87545255385ec92c7444cb677f81c","status":"unseen"}}
{"timestamp":"2021-12-05 18:06:47","level":"DEBUG","fields":{"message":"Bitcoin transaction status changed","txid":"abbe8844611e87e4160ef7ae6e947fdaabe87545255385ec92c7444cb677f81c","new_status":"in mempool","old_status":"unseen"}}
{"timestamp":"2021-12-05 18:11:00","level":"DEBUG","fields":{"message":"Using existing sqlite database."}}
{"timestamp":"2021-12-05 18:11:00","level":"DEBUG","fields":{"message":"Reading in seed from /Users/anon/Library/Application Support/xmr-btc-swap/cli/testnet/seed.pem"}}
{"timestamp":"2021-12-05 18:11:02","level":"DEBUG","fields":{"message":"Starting monero-wallet-rpc","port":"56242"}}
{"timestamp":"2021-12-05 18:44:24","level":"DEBUG","fields":{"message":"Using existing sqlite database."}}
{"timestamp":"2021-12-05 18:44:24","level":"DEBUG","fields":{"message":"Reading in seed from /Users/anon/Library/Application Support/xmr-btc-swap/cli/testnet/seed.pem"}}
{"timestamp":"2021-12-05 18:44:26","level":"DEBUG","fields":{"message":"Starting monero-wallet-rpc","port":"56329"}}
{"timestamp":"2021-12-05 18:44:29","level":"DEBUG","fields":{"message":"Opened Monero wallet","monero_wallet_name":"swap-tool-blockchain-monitoring-wallet"}}
{"timestamp":"2021-12-05 18:44:30","level":"DEBUG","fields":{"message":"Network layer initialized","peer_id":"12D3KooWCCJ5LZKgZFq3konPNVSQ73vJuUNdstHtMwHh1kegjVMX"}}
{"timestamp":"2021-12-05 18:44:30","level":"DEBUG","fields":{"message":"Advancing state","state":"btc is locked"}}
{"timestamp":"2021-12-05 18:44:30","level":"INFO","fields":{"message":"Waiting for Alice to lock Monero"}}
{"timestamp":"2021-12-05 18:44:30","level":"INFO","fields":{"message":"Connected to Alice at /dnsaddr/unstoppableswap.net/p2p/12D3KooWLHbHtkK53WoBA82Yht3PCCx6KXYxoJ6QqgXg1rSNtWhR"}}
{"timestamp":"2021-12-05 18:44:30","level":"DEBUG","fields":{"message":"Advancing state","state":"XMR lock transaction transfer proof received"}}
{"timestamp":"2021-12-05 18:44:30","level":"INFO","fields":{"message":"Waiting for Monero transaction finality","txid":"45b5b547eb81f237ab4879a65cd1f8c3247e3b5a0a6439522162caf3d91bdba1","target_confirmations":"10"}}
{"timestamp":"2021-12-05 18:44:30","level":"INFO","fields":{"message":"Alice locked Monero","txid":"45b5b547eb81f237ab4879a65cd1f8c3247e3b5a0a6439522162caf3d91bdba1"}}
{"timestamp":"2021-12-05 18:44:30","level":"INFO","fields":{"message":"Received new confirmation for Monero lock tx","txid":"45b5b547eb81f237ab4879a65cd1f8c3247e3b5a0a6439522162caf3d91bdba1","seen_confirmations":"3","needed_confirmations":"10"}}
{"timestamp":"2021-12-05 18:44:35","level":"DEBUG","fields":{"message":"Found relevant Bitcoin transaction","txid":"abbe8844611e87e4160ef7ae6e947fdaabe87545255385ec92c7444cb677f81c","status":"unseen"}}
{"timestamp":"2021-12-05 18:45:17","level":"DEBUG","fields":{"message":"Using existing sqlite database."}}
{"timestamp":"2021-12-05 18:45:17","level":"DEBUG","fields":{"message":"Reading in seed from /Users/anon/Library/Application Support/xmr-btc-swap/cli/testnet/seed.pem"}}
{"timestamp":"2021-12-05 18:45:19","level":"DEBUG","fields":{"message":"Starting monero-wallet-rpc","port":"56388"}}
{"timestamp":"2021-12-05 18:45:22","level":"DEBUG","fields":{"message":"Opened Monero wallet","monero_wallet_name":"swap-tool-blockchain-monitoring-wallet"}}
{"timestamp":"2021-12-05 18:45:23","level":"DEBUG","fields":{"message":"Network layer initialized","peer_id":"12D3KooWCCJ5LZKgZFq3konPNVSQ73vJuUNdstHtMwHh1kegjVMX"}}
{"timestamp":"2021-12-05 18:45:23","level":"DEBUG","fields":{"message":"Advancing state","state":"XMR lock transaction transfer proof received"}}
{"timestamp":"2021-12-05 18:45:23","level":"INFO","fields":{"message":"Waiting for Monero transaction finality","txid":"45b5b547eb81f237ab4879a65cd1f8c3247e3b5a0a6439522162caf3d91bdba1","target_confirmations":"10"}}
{"timestamp":"2021-12-05 18:45:23","level":"INFO","fields":{"message":"Received new confirmation for Monero lock tx","txid":"45b5b547eb81f237ab4879a65cd1f8c3247e3b5a0a6439522162caf3d91bdba1","seen_confirmations":"4","needed_confirmations":"10"}}
{"timestamp":"2021-12-05 18:45:23","level":"INFO","fields":{"message":"Connected to Alice at /dnsaddr/unstoppableswap.net/p2p/12D3KooWLHbHtkK53WoBA82Yht3PCCx6KXYxoJ6QqgXg1rSNtWhR"}}
{"timestamp":"2021-12-05 18:45:28","level":"DEBUG","fields":{"message":"Found relevant Bitcoin transaction","txid":"abbe8844611e87e4160ef7ae6e947fdaabe87545255385ec92c7444cb677f81c","status":"unseen"}}
{"timestamp":"2021-12-05 18:45:47","level":"INFO","fields":{"message":"Received new confirmation for Monero lock tx","txid":"45b5b547eb81f237ab4879a65cd1f8c3247e3b5a0a6439522162caf3d91bdba1","seen_confirmations":"5","needed_confirmations":"10"}}
{"timestamp":"2021-12-05 18:46:26","level":"DEBUG","fields":{"message":"Bitcoin transaction status changed","txid":"abbe8844611e87e4160ef7ae6e947fdaabe87545255385ec92c7444cb677f81c","new_status":"confirmed with 2 blocks","old_status":"unseen"}}
{"timestamp":"2021-12-05 18:46:47","level":"INFO","fields":{"message":"Received new confirmation for Monero lock tx","txid":"45b5b547eb81f237ab4879a65cd1f8c3247e3b5a0a6439522162caf3d91bdba1","seen_confirmations":"6","needed_confirmations":"10"}}
{"timestamp":"2021-12-05 18:49:38","level":"DEBUG","fields":{"message":"Using existing sqlite database."}}
{"timestamp":"2021-12-05 18:49:38","level":"DEBUG","fields":{"message":"Reading in seed from /Users/anon/Library/Application Support/xmr-btc-swap/cli/testnet/seed.pem"}}
{"timestamp":"2021-12-05 18:49:39","level":"DEBUG","fields":{"message":"Starting monero-wallet-rpc","port":"56466"}}
{"timestamp":"2021-12-05 18:49:43","level":"DEBUG","fields":{"message":"Opened Monero wallet","monero_wallet_name":"swap-tool-blockchain-monitoring-wallet"}}
{"timestamp":"2021-12-05 18:49:43","level":"DEBUG","fields":{"message":"Network layer initialized","peer_id":"12D3KooWCCJ5LZKgZFq3konPNVSQ73vJuUNdstHtMwHh1kegjVMX"}}
{"timestamp":"2021-12-05 18:49:43","level":"DEBUG","fields":{"message":"Advancing state","state":"XMR lock transaction transfer proof received"}}
{"timestamp":"2021-12-05 18:49:43","level":"INFO","fields":{"message":"Waiting for Monero transaction finality","txid":"45b5b547eb81f237ab4879a65cd1f8c3247e3b5a0a6439522162caf3d91bdba1","target_confirmations":"10"}}
{"timestamp":"2021-12-05 18:49:43","level":"INFO","fields":{"message":"Received new confirmation for Monero lock tx","txid":"45b5b547eb81f237ab4879a65cd1f8c3247e3b5a0a6439522162caf3d91bdba1","seen_confirmations":"7","needed_confirmations":"10"}}
{"timestamp":"2021-12-05 18:49:46","level":"INFO","fields":{"message":"Connected to Alice at /dnsaddr/unstoppableswap.net/p2p/12D3KooWLHbHtkK53WoBA82Yht3PCCx6KXYxoJ6QqgXg1rSNtWhR"}}
{"timestamp":"2021-12-05 18:49:48","level":"DEBUG","fields":{"message":"Found relevant Bitcoin transaction","txid":"abbe8844611e87e4160ef7ae6e947fdaabe87545255385ec92c7444cb677f81c","status":"unseen"}}
{"timestamp":"2021-12-05 18:50:52","level":"DEBUG","fields":{"message":"Using existing sqlite database."}}
{"timestamp":"2021-12-05 18:50:52","level":"DEBUG","fields":{"message":"Reading in seed from /Users/anon/Library/Application Support/xmr-btc-swap/cli/testnet/seed.pem"}}
{"timestamp":"2021-12-05 18:50:54","level":"DEBUG","fields":{"message":"Starting monero-wallet-rpc","port":"56500"}}
{"timestamp":"2021-12-05 18:50:58","level":"DEBUG","fields":{"message":"Opened Monero wallet","monero_wallet_name":"swap-tool-blockchain-monitoring-wallet"}}
{"timestamp":"2021-12-05 18:50:59","level":"DEBUG","fields":{"message":"Network layer initialized","peer_id":"12D3KooWCCJ5LZKgZFq3konPNVSQ73vJuUNdstHtMwHh1kegjVMX"}}
{"timestamp":"2021-12-05 18:50:59","level":"DEBUG","fields":{"message":"Advancing state","state":"XMR lock transaction transfer proof received"}}
{"timestamp":"2021-12-05 18:50:59","level":"INFO","fields":{"message":"Waiting for Monero transaction finality","txid":"45b5b547eb81f237ab4879a65cd1f8c3247e3b5a0a6439522162caf3d91bdba1","target_confirmations":"10"}}
{"timestamp":"2021-12-05 18:50:59","level":"INFO","fields":{"message":"Received new confirmation for Monero lock tx","txid":"45b5b547eb81f237ab4879a65cd1f8c3247e3b5a0a6439522162caf3d91bdba1","seen_confirmations":"7","needed_confirmations":"10"}}
{"timestamp":"2021-12-05 18:50:59","level":"INFO","fields":{"message":"Connected to Alice at /dnsaddr/unstoppableswap.net/p2p/12D3KooWLHbHtkK53WoBA82Yht3PCCx6KXYxoJ6QqgXg1rSNtWhR"}}
{"timestamp":"2021-12-05 18:51:04","level":"DEBUG","fields":{"message":"Found relevant Bitcoin transaction","txid":"abbe8844611e87e4160ef7ae6e947fdaabe87545255385ec92c7444cb677f81c","status":"unseen"}}
{"timestamp":"2021-12-05 18:51:23","level":"INFO","fields":{"message":"Received new confirmation for Monero lock tx","txid":"45b5b547eb81f237ab4879a65cd1f8c3247e3b5a0a6439522162caf3d91bdba1","seen_confirmations":"8","needed_confirmations":"10"}}
{"timestamp":"2021-12-05 18:51:47","level":"INFO","fields":{"message":"Received new confirmation for Monero lock tx","txid":"45b5b547eb81f237ab4879a65cd1f8c3247e3b5a0a6439522162caf3d91bdba1","seen_confirmations":"9","needed_confirmations":"10"}}
{"timestamp":"2021-12-05 18:51:57","level":"DEBUG","fields":{"message":"Bitcoin transaction status changed","txid":"abbe8844611e87e4160ef7ae6e947fdaabe87545255385ec92c7444cb677f81c","new_status":"confirmed with 2 blocks","old_status":"unseen"}}
{"timestamp":"2021-12-05 18:52:11","level":"INFO","fields":{"message":"Received new confirmation for Monero lock tx","txid":"45b5b547eb81f237ab4879a65cd1f8c3247e3b5a0a6439522162caf3d91bdba1","seen_confirmations":"10","needed_confirmations":"10"}}
{"timestamp":"2021-12-05 18:52:11","level":"DEBUG","fields":{"message":"Advancing state","state":"xmr is locked"}}
{"timestamp":"2021-12-05 18:52:11","level":"DEBUG","fields":{"message":"Constructed Bitcoin spending transaction","fee":"1000"}}
{"timestamp":"2021-12-05 18:52:11","level":"DEBUG","fields":{"message":"Constructed Bitcoin spending transaction","fee":"1000"}}
{"timestamp":"2021-12-05 18:52:11","level":"DEBUG","fields":{"message":"Advancing state","state":"encrypted signature is sent"}}
{"timestamp":"2021-12-05 18:52:16","level":"DEBUG","fields":{"message":"Found relevant Bitcoin transaction","txid":"b6e144efdcf59db3463735a3071f7e491a339fccd9ba74df5a476c015b9c887e","status":"unseen"}}
{"timestamp":"2021-12-05 18:52:56","level":"DEBUG","fields":{"message":"Got notification for new block","block_height":2106330}}
{"timestamp":"2021-12-05 18:52:56","level":"DEBUG","fields":{"message":"Bitcoin transaction status changed","txid":"b6e144efdcf59db3463735a3071f7e491a339fccd9ba74df5a476c015b9c887e","new_status":"in mempool","old_status":"unseen"}}
{"timestamp":"2021-12-05 18:52:57","level":"DEBUG","fields":{"message":"Bitcoin transaction status changed","txid":"abbe8844611e87e4160ef7ae6e947fdaabe87545255385ec92c7444cb677f81c","new_status":"confirmed with 3 blocks","old_status":"confirmed with 2 blocks"}}
{"timestamp":"2021-12-05 18:52:59","level":"DEBUG","fields":{"message":"Advancing state","state":"btc is redeemed"}}
Error: JSON-RPC request failed with code -4: No unlocked balance in the specified account

Caused by:
    JSON-RPC request failed with code -4: No unlocked balance in the specified account
{"timestamp":"2021-12-05 18:55:46","level":"DEBUG","fields":{"message":"Using existing sqlite database."}}
{"timestamp":"2021-12-05 18:55:46","level":"DEBUG","fields":{"message":"Reading in seed from /Users/anon/Library/Application Support/xmr-btc-swap/cli/testnet/seed.pem"}}
{"timestamp":"2021-12-05 18:55:48","level":"DEBUG","fields":{"message":"Starting monero-wallet-rpc","port":"56601"}}
{"timestamp":"2021-12-05 18:55:52","level":"DEBUG","fields":{"message":"Opened Monero wallet","monero_wallet_name":"swap-tool-blockchain-monitoring-wallet"}}
{"timestamp":"2021-12-05 18:55:53","level":"DEBUG","fields":{"message":"Network layer initialized","peer_id":"12D3KooWCCJ5LZKgZFq3konPNVSQ73vJuUNdstHtMwHh1kegjVMX"}}
{"timestamp":"2021-12-05 18:55:53","level":"DEBUG","fields":{"message":"Advancing state","state":"btc is redeemed"}}
{"timestamp":"2021-12-05 18:55:53","level":"WARN","fields":{"message":"Failed to generate monero wallet from keys: Failed to generate new wallet from keys: JSON-RPC request failed with code -1: Wallet already exists.: JSON-RPC request failed with code -1: Wallet already exists."}}
{"timestamp":"2021-12-05 18:55:53","level":"INFO","fields":{"message":"Falling back to trying to open the the wallet if it already exists","wallet_file_name":"7d83bdc9-5e9c-4d69-96cd-22d735b93597"}}
{"timestamp":"2021-12-05 18:55:53","level":"INFO","fields":{"message":"Connected to Alice at /dnsaddr/unstoppableswap.net/p2p/12D3KooWLHbHtkK53WoBA82Yht3PCCx6KXYxoJ6QqgXg1rSNtWhR"}}
Error: JSON-RPC request failed with code -4: No unlocked balance in the specified account

Caused by:
    JSON-RPC request failed with code -4: No unlocked balance in the specified account

@binarybaron
Copy link
Collaborator

@AlaattinK02 / @rishflab would you mind reopening this issue? I think this bug is still an issue

@AlaattinK02 AlaattinK02 reopened this Dec 13, 2021
@da-kami
Copy link
Member

da-kami commented Dec 20, 2021

I think this is another instance of #537
I put up #880 to allow manual recovery. Unfortunately cannot do much else at the moment.

@da-kami
Copy link
Member

da-kami commented Dec 20, 2021

I think you are correct. It's definitely related to the restore height. This just happened to me as well. In my case the restore height was 979530 and the transaction as included in block 979527

BobState::BtcLocked(state3) => {
let tx_lock_status = bitcoin_wallet.subscribe_to(state3.tx_lock.clone()).await;
if let ExpiredTimelocks::None = state3.current_epoch(bitcoin_wallet).await? {
let transfer_proof_watcher = event_loop_handle.recv_transfer_proof();
let cancel_timelock_expires =
tx_lock_status.wait_until_confirmed_with(state3.cancel_timelock);
// Record the current monero wallet block height so we don't have to scan from
// block 0 once we create the redeem wallet.
let monero_wallet_restore_blockheight = monero_wallet.block_height().await?;
tracing::info!("Waiting for Alice to lock Monero");

This code is executed every time the swap is resumed and the last action of the cli was that Bob locked his bitcoin. This is a problem when Bob locks his bitcoin and then goes offline. Alice then locks her Monero while he is offline. When Bob comes back online, he uses the current Monero block height to create the Monero redeem wallet. When he then tries to redeem the Monero, an error is thrown because the monero-wallet-rpc instance can't detect the lock transaction and therefore can't spend its outputs.

[snip]

I just had a look and can confirm that it can be a problem if Bob goes offline before the Bitcoin are confirmed. (Because then the height might be incorrect). I will see to put another PR up that moves this to an earlier point. This is somewhat less efficient when generating the wallet, but it should not be noticeable from a UX point of view.

@da-kami
Copy link
Member

da-kami commented Dec 20, 2021

see: #881

Sidenote: The CLI was designed under the impression that one would wait for confirmations (and resume in case of failures) and not just turn it off. But that is not immediately obvious, so the above fix should add more resilience - but is a bit less efficient when generating the monero wallet, because we will scan more blocks. Should be negligible though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants
@da-kami @4eMaLo @AlaattinK02 @binarybaron and others