Commit graph

854 commits

Author SHA1 Message Date
Javed Khan
62c7167504 Remove early return on empty rescan 2015-03-05 11:39:15 -06:00
Dave Collins
c8bdd71074 waddrmgr: Make create/update logic more explicit.
This commit makes the creation and updating of the address manager more
explicit so it's easier to upgrade in the future.

In particular, rather than treating the initial creation as an upgrade by
relying on creating the initial buckets on the fly on each load, the code
now explicitly provides distinct create and upgrade paths that are invoked
from the Create and Open functions, respectively.

It also adds some commented out sample code to illustrate how upgrades
should be done and a check to ensure bumping the version number without
writing upgrade code results in a new error, ErrUpgrade, being returned.

Finally, a test has been added for the new functionality.
2015-03-04 14:12:47 -06:00
Dave Collins
c078ee72eb Update golang.org/x/crypto import paths to new location. 2015-03-03 21:13:05 -06:00
Josh Rickmar
955bd65349 Whitespace fix. 2015-03-03 12:43:37 -05:00
Josh Rickmar
ce89c84b18 Prepare for release 0.5.0. 2015-03-03 12:41:48 -05:00
Josh Rickmar
3c5d165261 Update README for recent changes. 2015-03-02 17:49:57 -05:00
Josh Rickmar
0a7b10d051 Rescan after btcd reconnect.
Otherwise, if the websocket connection to btcd is lost and
reestablished, there is no sync to the current best block, and btcd
will not notify wallet of new relevant transactions.
2015-03-02 16:04:26 -05:00
Josh Rickmar
5ad37374fb Use the correct synced block when calculating confs.
This was previously using the most recently notified (by the chain
package) block, but transaction processing from this block may not be
finished yet.  Using this block's height to calculate the number of
confirmations is therefore incorrect, and can result in every RPC
handler missing transactions or returning transactions from the wrong
block.
2015-03-02 13:30:42 -05:00
Josh Rickmar
c9d9b4b610 Implement several btcd RPCs in wallet as well.
Wallet should handle these so that wallet clients don't end up
creating requests to btcd about the latest processed block, which is
not the same as wallet's most recently processed block.

By providing wallet clients with this info, we avoid a race where the
client thinks wallet has processed N blocks, but in fact is still
synced to N-1 (and perhaps currently processing transactions from
block N).  This can cause unexpected results for many of the
bitcoind-compatible RPC APIs due to their reliance on number of
confirmations, rather than using absolute block heights.
2015-03-02 13:22:46 -05:00
Javed Khan
45a33353b0 Turn echo off when reading passwords 2015-03-02 11:56:45 -06:00
Dave Collins
b44f48882f Add conversion from legacy keystore if it exists. 2015-03-02 11:56:45 -06:00
Dave Collins
8f9f53a618 Switch to new waddrmgr package
This commit converts the wallet to use the new secure hierarchical
deterministic wallet address manager package as well as the walletdb
package.

The following is an overview of modified functionality:

- The wallet must now be created before starting the executable
- A new flag --create has been added to create the new wallet using wizard
  style question and answer prompts
- Starting the process without an existing wallet will instruct now
  display a message to run it with --create
- Providing the --create flag with an existing wallet will simply show an
  error and return

In addition the snacl package has been modified to return the memory after
performing scrypt operations to the OS.

Previously a runtime.GC was being invoked which forced it to release the
memory as far as the garbage collector is concerned, but the memory was
not released back to the OS immediatley.  This modification allows the
memory to be released immedately since it won't be needed again until the
next wallet unlock.
2015-03-02 11:55:42 -06:00
Dave Collins
130e44c761 Move keystore to legacy directory. 2015-03-02 12:21:44 -05:00
David Hill
f704c58114 Use txscript.StandardVerifyFlags
By using txscript.StandardVerifyFlags when creating and validating
transactions, we can ensure the transactions successfully created
won't be rejected due to script policy.
2015-02-26 18:41:59 -05:00
Josh Rickmar
dcf64e2957 Use rescan for initial tx notification registrations.
Requires btcsuite/btcd#310.
2015-02-23 23:52:31 -05:00
Josh Rickmar
d9e2443002 Fix build.
This fixes the build after btcsuite/btcd#302, which renamed the
txscript constant ScriptCanonicalSignatures constant to
ScriptVerifyDERSignatures.
2015-02-23 22:44:04 -05:00
Dave Collins
8b6c161cbc Update btcws path import paths to new location. 2015-02-19 13:09:16 -06:00
Dave Collins
58f7cedc0e Update btcjson path import paths to new location. 2015-02-19 12:01:41 -06:00
Dave Collins
a210a85113 waddrmgr: Update more documentation for walletdb. 2015-02-10 00:17:28 -06:00
Dave Collins
99e4a8f4b3 waddrmgr: Update documentation for walletdb.
This commit updates the documentation which discusses creating and opening
the manager to properly mention the wallet database namespace as well as
another typo.
2015-02-10 00:11:00 -06:00
Dave Collins
b2ebd20d75 Update btcec path import paths to new location. 2015-02-06 11:06:45 -06:00
Josh Rickmar
ad80e9f384 Address several issues pointed out by lint and vet.
This brings the entire tree closer to but not 100% goclean.sh clean.
2015-02-06 01:04:01 -05:00
Dave Collins
4a1067b6f1 Update btcnet path import paths to new location. 2015-02-05 23:58:46 -06:00
Josh Rickmar
642f5e0294 Use Travis' container-based infrastructure. 2015-02-05 18:08:03 -05:00
Josh Rickmar
a049908634 Fix Go versions for Travis. 2015-02-05 17:04:36 -05:00
Dave Collins
23c9dc423e Update btcwire path import paths to new location. 2015-02-05 15:41:38 -06:00
Josh Rickmar
1b7cd45029 Optimize unlocks for already unlocked addrmgrs.
This is performed by saving the SHA512(salt+passphrase) of the
waddrmgr.Manager private passphrase each time the manager is unlocked.
If another call to Unlock is performed before the next Lock, the hash
is applied to the new input.  If it matches, we know the passphrase is
(likely) equal, so return early and continue using the crypto keys
already in memory.  If it does not match, we know for certain the
passphrase is incorrect and the manager is locked.
2015-01-31 20:34:12 -05:00
Josh Rickmar
79b1839883 waddrmgr: Avoid unnecessarily rederiving keys on unlock.
The slice of keys which must have their private extended keys derived
on unlock was never being removed from and all of these keys were
being rederived unnecessarily on every unlock.  Fix this by re-slicing
the deriveOnUnlock slice to remove the just derived key if the
derivation was successful.
2015-01-31 18:47:08 -05:00
Dave Collins
175875c9bd Update btcchain import paths to new location. 2015-01-30 16:30:16 -06:00
Dave Collins
6d4889ffb0 Update btcscript import paths to new location. 2015-01-30 12:31:29 -06:00
Dave Collins
31149b88b9 Add prints when client and server TLS is disabled. 2015-01-23 16:11:13 -06:00
Dave Collins
ac94b3f331 Update btcd import paths to new location. 2015-01-17 01:03:11 -06:00
Dave Collins
f05ab25696 Update btcwallet import paths to new location. 2015-01-17 00:25:53 -06:00
Dave Collins
3c60626579 Update btcgui import paths to new location. 2015-01-17 00:19:00 -06:00
Dave Collins
06ed33b65a Update btcjson import paths to new location. 2015-01-16 23:58:53 -06:00
Dave Collins
3fc3ecc908 Update btcws import paths to new location. 2015-01-16 23:40:19 -06:00
Dave Collins
7276c1ca7d Update btcscript import paths to new location. 2015-01-16 19:38:15 -06:00
Dave Collins
b3ed4f9172 Update btcchain import paths to new location. 2015-01-16 18:48:31 -06:00
Dave Collins
7db8ff3f9a Update btcec import paths to new location. 2015-01-16 18:08:45 -06:00
Dave Collins
a26a65e2e0 Update btcnet import paths to new location. 2015-01-16 17:32:30 -06:00
Dave Collins
283aa28be5 Update btcwire import paths to new location. 2015-01-16 16:03:04 -06:00
Dave Collins
2f79c3176e Update btclog import paths to new location. 2015-01-16 11:43:34 -06:00
Dave Collins
04f692fbbb Update fastsha256 import paths to new location. 2015-01-16 09:11:25 -06:00
Dave Collins
f7b4b5e71d Update go-flags import paths to new location. 2015-01-16 01:01:04 -06:00
Dave Collins
caa82e9605 Update bolt import paths to new location. 2015-01-15 22:55:55 -06:00
Dave Collins
4f097d8e79 Update seelog import paths to new location. 2015-01-15 22:29:07 -06:00
Dave Collins
d71bc3193f Update btcrpcclient import paths to new location. 2015-01-15 21:28:09 -06:00
Dave Collins
f37b4e84eb Allow main waddrmgr test to run in parallel. 2015-01-15 20:36:09 -06:00
Dave Collins
174005d586 Update websocket import paths to new location. 2015-01-15 17:52:53 -06:00
Dave Collins
ea0d0ec280 Update for recent btcjson changes. 2015-01-15 17:52:12 -06:00