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

moving wallet from one node to another loses some UTXOs #2901

Closed
aleqx opened this issue Jun 18, 2019 · 6 comments

Comments

@aleqx
Copy link

commented Jun 18, 2019

I have two 1.0.2 nodes on two separate machines. On each node I also have a wallet (using the same grin binary as the node). Both wallets work fine. I wanted to move the 2nd wallet onto the 1st machine, and connect to the 1st node, running the 2nd wallet from there. Both nodes are sync'ed to the current block height.

Before doing anything, this is what the 2nd wallet is saying (all correct):

Password:

____ Wallet Summary Info - Account 'default' as of height 220962 ____

 Total                            | 148.688604240
 Awaiting Confirmation (< 10)     | 0.000000000
 Locked by previous transaction   | 0.000000000
 -------------------------------- | -------------
 Currently Spendable              | 148.688604240

Command 'info' completed successfully
# grin wallet outputs
Password:

Wallet Outputs - Account 'default' - Block Height: 220971
--------------------------------------------------------------------------------------------------------------------------------------------------------------
 Output Commitment                                                   MMR Index  Block Height  Locked Until  Status   Coinbase?  # Confirms  Value          Tx
==============================================================================================================================================================
 08125d30931519b1cfea53e1eea02a9456430e9d0ab6d4619189a4e39b7692a77d  2595594    220891        220891        Unspent  false      81          100.000000000  29
--------------------------------------------------------------------------------------------------------------------------------------------------------------
 0891b6369e6c837491bfda5827edb91c5bfd100f9a1a10b5b498f2349316005bac  2595629    220897        220897        Unspent  false      75          48.688604240   30
--------------------------------------------------------------------------------------------------------------------------------------------------------------

Command 'outputs' completed successfully

I created a new user grin2 on the 1st machine, and then copied the wallet_data folder from the 2nd machine as well as grin-wallet.toml (making sure to amend all paths inside to point to the new path). Then I replicated the 1st node's .api_secret so I can talk to the local node. Now both wallets are on the 1st machine.

So far so good, the wallet seems to work, and I can query grin wallet info which showed 0 balance. So I did a grin wallet check to get back the UTXOs.

$ grin wallet check
Password:
20190618 19:27:11.022 WARN grin_wallet::command - Starting wallet check...
20190618 19:27:11.022 WARN grin_wallet::command - Updating all wallet outputs, please wait ...
20190618 19:27:11.173 WARN grin_wallet::libwallet::internal::restore - Starting wallet check.
20190618 19:27:11.874 WARN grin_wallet::libwallet::internal::restore - Checking 1000 outputs, up to index 1298051. (Highest index: 24716)
20190618 19:27:11.874 WARN grin_wallet::libwallet::internal::restore - Scanning 1000 outputs in the current Grin utxo set
20190618 19:27:13.043 WARN grin_wallet::libwallet::internal::restore - Checking 1000 outputs, up to index 1298051. (Highest index: 55255)
20190618 19:27:13.047 WARN grin_wallet::libwallet::internal::restore - Scanning 1000 outputs in the current Grin utxo set
20190618 19:27:14.364 WARN grin_wallet::libwallet::internal::restore - Checking 1000 outputs, up to index 1298051. (Highest index: 112946)
...
...
...
20190618 19:28:02.397 WARN grin_wallet::libwallet::internal::restore - Scanning 1000 outputs in the current Grin utxo set
20190618 19:28:03.518 WARN grin_wallet::libwallet::internal::restore - Checking 1000 outputs, up to index 1298052. (Highest index: 1297655)
20190618 19:28:03.518 WARN grin_wallet::libwallet::internal::restore - Scanning 1000 outputs in the current Grin utxo set
20190618 19:28:04.257 WARN grin_wallet::libwallet::internal::restore - Checking 299 outputs, up to index 1298052. (Highest index: 1298052)
20190618 19:28:04.257 WARN grin_wallet::libwallet::internal::restore - Scanning 299 outputs in the current Grin utxo set
20190618 19:28:04.413 WARN grin_wallet::libwallet::internal::restore - Identified 2 wallet_outputs as belonging to this wallet
20190618 19:28:04.414 WARN grin_wallet::libwallet::internal::restore - Confirmed output for 100000000000 with ID 0300000000000000000000000000000000 (Commitment(08125d30931519b1cfea53e1eea02a9456430e9d0ab6d4619189a4e39b7692a77d)) exists in UTXO set but not in wallet. Restoring.
20190618 19:28:04.423 WARN grin_wallet::libwallet::internal::restore - Confirmed output for 48688604240 with ID 0300000000000000000000008300000000 (Commitment(0891b6369e6c837491bfda5827edb91c5bfd100f9a1a10b5b498f2349316005bac)) exists in UTXO set but not in wallet. Restoring.
20190618 19:28:04.435 WARN grin_wallet::command - Wallet check complete
Command 'check' completed successfully

All right ... 2 UTXOs seemingly restored, with correct amounts for each. But then:

$ grin wallet info
Password:

____ Wallet Summary Info - Account 'default' as of height 220954 ____

 Total                            | 100.000000000
 Awaiting Confirmation (< 10)     | 0.000000000
 Locked by previous transaction   | 0.000000000
 -------------------------------- | -------------
 Currently Spendable              | 100.000000000

Command 'info' completed successfully

What?

$ grin wallet outputs
Password:

Wallet Outputs - Account 'default' - Block Height: 220971
---------------------------------------------------------------------------------------------------------------------------------------------------------------
 Output Commitment                                                   MMR Index  Block Height  Locked Until  Status   Coinbase?  # Confirms  Value          Tx
===============================================================================================================================================================
 08125d30931519b1cfea53e1eea02a9456430e9d0ab6d4619189a4e39b7692a77d  2595594    220891        220891        Unspent  false      81          100.000000000  158
---------------------------------------------------------------------------------------------------------------------------------------------------------------

Command 'outputs' completed successfully

It doesn't restore the 2nd UTXO ... am I missing anything or is this a bug?

@aleqx

This comment has been minimized.

Copy link
Author

commented Jun 18, 2019

Deleting the db folder then doing a grin wallet restore works.

It does the same check, with the same check result at the end (stating Identified 2 wallet_outputs as belonging to this wallet) but now they are actually both recovered. grin wallet outputs shows both of them.

Bug?

@hashmap

This comment has been minimized.

Copy link
Member

commented Jul 3, 2019

I'm closing this issue here, let's open it in the wallet repo if it's still reproducible

@hashmap hashmap closed this Jul 3, 2019

@aleqx

This comment has been minimized.

Copy link
Author

commented Jul 5, 2019

I'm closing this issue here, let's open it in the wallet repo if it's still reproducible

That doesn't really sound sensible. You guys decided to move the wallet code (that's fine) but then should also move the associated issues. You shouldn't just close a reported bug with fully reproducible steps, and require the reporter to do it all again for you, just because you moved the code to a different repo.

@lehnberg

This comment has been minimized.

Copy link
Collaborator

commented Jul 5, 2019

@aleqx I agree, unfortunately I don't have privileges to move the issue, so I took he liberty to copy/paste your report: mimblewimble/grin-wallet#178

@hashmap

This comment has been minimized.

Copy link
Member

commented Jul 5, 2019

Sorry I wasn't clear, I closed it because there is no point in fixing 1.0.2 now

@aleqx

This comment has been minimized.

Copy link
Author

commented Jul 5, 2019

I can confirm the same happened with 1.0.3 and 1.1.0. I didn't try the maneuver on 2.0.0 but from the changelog it doesn't look that you guys changed any code which would affect the reported bug. Would be worth checking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.