blacknet-ninja / blackcoin-old

The old BlackCoin wallet
https://bitcointalk.org/index.php?topic=469640.0
MIT License
103 stars 122 forks source link

importprivkey broken on both Mac OS X and Windows #42

Closed jprichardson closed 9 years ago

jprichardson commented 9 years ago

importprivkey seems to be broken from either the debug console or RPC. I have tested this on Mac OS X (Yosemite) client version v1.1.1.0 and the latest Windows build from https://github.com/rat4/blackcoin/issues/40.

You can test yourself:

uncompressed: (BTD9fr1KghJdByTJjxEPRj24TwgfAeuaXt)

importprivkey 69UKv8ib5CNNr9DPjiPCkAHMLeoZMkFi13j9wGPThiDBSwodyQX

compressed: (BTD9fr1KghJdByTJjxEPRj24TwgfAeuaXt)

importprivkey PiPcVX4ZPXBMRuFhMXezqVyAmjrVpZuuyD34SWv8rgtm7TGzqxfp

Via RPC, I get a timeout error (from my client). Via the QT client, the interface locks up. Can you confirm this same behavior?

jprichardson commented 9 years ago

It works in the console if I add a label. If I do it via RPC, it still times out (with or without the label), but if I kill the BlackCoin-qt process and reopen it, it ultimately added it. However, the RPC is still broken :(

bearsylla commented 9 years ago

After importprivkey, the wallet will trigger rescan, which will scan the entire blockchain, and the process will take 5 - 15 minutes and even more depending on your processing power.

However you can disable the rescan by importprivkey <blackcoinprivkey> rescan=false

FYI: The syntax for importprivkey is

importprivkey <blackcoinprivkey> [label] [rescan=true]
bearsylla commented 9 years ago

The wallet will not respond to the RPC until the rescan is complete, that's why it cause timeout

bearsylla commented 9 years ago

rescan is needed if there is fund in the address corresponded to the privkey prior to the import.

However, if the privkey is newly generated, then there is no reason to rescan it. For example, rescan is set to false in the blackshare project. https://github.com/doetsch/blackshares/blob/master/src/wallet.cpp#L2675

bearsylla commented 9 years ago

more information here: https://github.com/bitcoin/bitcoin/issues/1085

jprichardson commented 9 years ago

That makes sense. But does the Mac OS X version support setting the rescan to false? I just get this response: importprivkey <blackcoinprivkey> [label]. If I try either importprivkey 69UKv8ib5CNNr9DPjiPCkAHMLeoZMkFi13j9wGPThiDBSwodyQX afafa rescan=false or importprivkey 69UKv8ib5CNNr9DPjiPCkAHMLeoZMkFi13j9wGPThiDBSwodyQX afafa false.

jprichardson commented 9 years ago

Hmmm, looks like it does... https://github.com/rat4/blackcoin/blob/d7b2fa94ae48812fb7d747f7e48e956996e5b3e5/src/rpcdump.cpp#L110

ghost commented 9 years ago

It does, however the rescan flag was added in v1.1.2

jprichardson commented 9 years ago

The wallet will not respond to the RPC until the rescan is complete, that's why it cause timeout

Actually, the fact that this does this is pretty poor design. I assume this is a relic of an older Bitcoin-qt design?

  1. Why does the UI lock up if no label is passed?
  2. @rat4 Can you post the v1.1.2 Mac OS X client?

Thanks, this functionality is needed for an app I'm writing.

ghost commented 9 years ago
  1. Why does the UI lock up if no label is passed?

I've tested this on latest codebase and haven't noticed a difference if the label is passed or not.

  1. @rat4 https://github.com/rat4 Can you post the |v1.1.2| Mac OS X client?

Mac build was provided by a community member, but he's no longer active.

  1. How long is it expected for the rescan to take?

The bigger (already synchronized part of the) blockchain the longer rescan takes.

jprichardson commented 9 years ago

Mac build was provided by a community member, but he's no longer active.

Does this mean that Mac builds will no longer be provided? i.e. Is Mac no longer supported by BlackCoin?

blockcorporation commented 9 years ago

I'm working on building the mac client but been working on it on the weekends. So not all hope is lost on mac builds. Any help would be wondervol.

bearsylla commented 9 years ago

@jprichardson If you just need the blackcoind, it can be eassily compiled using macports. https://github.com/rat4/blackcoin/issues/39 However, it seems that there is some bugs in macports that prevent the building of QT wallet