monero-project / monero

Monero: the secure, private, untraceable cryptocurrency
https://getmonero.org
Other
8.86k stars 3.09k forks source link

monero-wallet-cli asks for input when restoring deterministic password, when data is supplied in command invocation #1214

Open athanclark opened 7 years ago

athanclark commented 7 years ago

If you try something like the following:

$ monero-wallet-cli --wallet-file ~/.moneybit/wallets/foo --restore-deterministic-wallet --password="asdf" --electrum-seed="gypsy annoyed renting delayed object ostrich vinegar suffice enigma excess paradise five ruling ulcers upon gotten eskimos unquoted plotting cinema jamming bimonthly skulls sleepless delayed" --restore-height=0

monero-wallet-cli will still ask for input regarding what block height should be for restoration.

ghost commented 7 years ago

Hah. Interesting - it's because there's a comparison for !m_restore_height on line 1317 of simplewallet.cpp, meaning that any value other than 0 will result in the expected behaviour...

I guess we could add a test for zero but how often are people going to ask for restore height to be zero? Also...it's a little tricky because the restore height is an unsigned int meaning it's not possible to just pre-initialise it at -1 and wait for user input

ghost commented 7 years ago

@moneromooo-monero or @fluffypony do you know what the checks from line 1609-1616 in simplewallet.cpp are meant to accomplish?

It seems to read: If we're creating a new wallet, set refresh from block height 0 (done in a very convoluted way) But if we have a restore height, refresh from the height supplied

I don't like if/if-else statements where the two variables are independent and not all combinations are caught, and the entire purpose of the function is to create a new wallet, already abrogating the need for the first if

ghost commented 7 years ago

Also, see #759

dEBRUYNE-1 commented 6 years ago

+bug