Commit graph

578 commits

Author SHA1 Message Date
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
Dave Collins afeb509c45 Update btcutil import paths to new location. 2015-01-15 10:48:58 -06:00
Dave Collins dada05fbb6 goimports -w . 2015-01-15 10:47:32 -06:00
John C. Vernaleo a702473c57 Check for nil to prevent panic.
ok jrick@
2015-01-14 09:57:28 -05:00
John C. Vernaleo 88e28a26a8 Compile again after btcjson changes. 2015-01-13 11:26:25 -05:00
Javed Khan edaddb0d95 Allow disabling RPC client TLS for localhost only.
This commit introduces a new flag, --noclienttls, which can be used to disable
TLS for the RPC client.  However, the flag can only be used when the RPC
client is connecting to localhost interfaces.  This is intended to prevent
accidentally leaking sensitive data when switching between local and
remote servers.
2015-01-09 21:36:48 +05:30
Javed Khan 469a6f86eb Allow disabling RPC server TLS for localhost only.
This commit introduces a new flag, --noservertls, which can be used to disable
TLS for the RPC server.  However, the flag can only be used when the RPC
server is bound to localhost interfaces.  This is intended to prevent the
situation where someone decides they want to expose the RPC server to the
web for remote management/access, but forgot they have TLS disabled.
2015-01-09 15:07:06 +05:30
Josh Rickmar 44fbd30e22 Buffer another result channel. 2015-01-05 20:02:51 -05:00
Josh Rickmar 807379661c Buffer a result channel.
This will allow the worker goroutine to return even if one of the
other workers has already errored, preventing these goroutines from
lingering forever blocking on a channel send.
2015-01-05 19:54:06 -05:00
Josh Rickmar 596a3154c1 Avoid duplicating blocks and txs on privkey imports.
When detaching the tail end of a slice of blocks or transactions and
appending the newly inserted middle block, and the previous tail, the
capacity of the slice head must be limited to prevent overwriting the
newly inserted block/tx in the same memory as the tail slice.

Bug discovered by @mably while working on the peercoin port of
btcwallet and reported on IRC.
2014-12-17 09:26:35 -05:00
Josh Rickmar b55a9ed7ca Drop default tx fee/kB to 0.00001 BTC.
This matches the recent change made to bitcoin core wallet, and
follows roughly a year after the minimum mempool relay fee/kB was
dropped to the same value.
2014-12-15 21:36:38 -05:00
Josh Rickmar df3779f780 Require TLS 1.2 minimum.
This prevents a downgrade attack to the vulnerable SSLv3.  While here,
go ahead and require at least TLS 1.2 since TLS 1.0 and 1.1 have their
own set of issues and it's only a matter of time before those would
need to be completely avoided as well.
2014-12-15 13:18:28 -06:00
Dave Collins 6eabd7c014 Remove Go 1.2 and add release to TravisCI builds.
Our policy is to only ensure the code compiles for the latest Go release
minus one version.  Since Go 1.4 has now been released, this commit
updates TravisCI to remove Go 1.2 from the build matrix.  While here, add
release to the matrix which should have been there before anyways.
2014-12-11 10:28:46 -06:00
Josh Rickmar e5ccefae56 Switch to new subrepo import paths. 2014-12-11 10:09:12 -05:00
Guilherme Salgado 24dcd206d2 Implement the deposit side of Voting Pools
This contains the APIs to create and retrieve Voting Pools and Series (with
public/private keys) from a walletdb namespace, plus the generation of deposit
addresses (using m-of-n multi-sig P2SH scripts according to the series
configuration).
2014-11-12 11:41:44 -06:00
Dave Collins 454d290b68 Convert waddrmgr to new walletdb package.
This commit converts the waddrmgr package to use the new walletdb package
semantics.

Since waddrmgr no longer controls the database, it is unable to make a
copy of the database and return it as the old ExportWatchingOnly function
required.  As a result, it has been renamed to ConvertToWatchingOnly and
it now modifies the namespace provided to it.  The idea is that the caller
which does control the database can now make a copy of the database, get
the waddrmgr namespace in the database copy and invoke the new function
to modify it.  This also works well with other packages that might also
need to make modifications for watching-only mode.

In addition, the following changes are made:

- All places that worked with database paths now work with the
  walletdb.Namespace interface
- The managerTx code is replaced to use the walletdb.Tx interface
- The code which checks if the manager already exists is updated to work
  with the walletdb.Namespace interface
- The LatestDbVersion constant is now LatestMgrVersion since it no longer
  controls the database
2014-11-11 15:07:16 -06:00
Dave Collins cdba2f858c Finish comment in walletdb namespace example. 2014-11-10 22:30:07 -06:00
Dave Collins c9ee57d53d Correct walletdb README.md example link. 2014-11-10 22:12:59 -06:00
Dave Collins 3cd0aa011d Cleanup recent encrypt/decrypt test additions.
This commit cleans up the recent test addition for testing the positive
and negative error paths of the Encrypt and Decrypt functions.

In particular:

- Add comments to all new functions
- Close the manager before trying to delete the file which is otherwise in
  use
- Rename the temp prefix since these are not pool tests
- Rename setUp to setupManager to make it a bit more explicit what it's
  doing
2014-11-10 21:39:57 -06:00
Lars Hesel Christensen b4214fc93c Add tests for new encryption API on the manager
100% coverage on selectCryptoKey, Encrypt, Decrypt.
2014-11-10 21:11:23 -06:00
Dave Collins 349931dae9 Add README.md for walletdb and bdb driver. 2014-11-10 16:01:48 -06:00
Dave Collins 15fa0a523c Add examples for walletdb usage. 2014-11-10 16:01:47 -06:00
Dave Collins d7c00f48d7 Add full test coverage suite for walletdb package. 2014-11-10 16:01:46 -06:00
Dave Collins e8b4de9379 Implement new namespaced db package named walletdb.
This commit implements a new namespaced db package which  is intended to
be used be wallet and any sub-packages as its data storage mechanism.

- Key/value store
- Namespace support
- Allows multiple packages to have their own area in the database without
  worrying about conflicts
- Read-only and read-write transactions with both manual and managed modes
- Nested buckets
- Supports registration of backend databases
- Comprehensive test coverage
2014-11-10 16:01:45 -06:00
Javed Khan 9225863706 Updated VerifyMessage to not use the keystore 2014-11-07 10:28:25 +05:30
Dave Collins e3769bcec6 Add the new ErrInvalidKeyType to the stringer map.
Also add it to the stringer test.
2014-10-31 10:20:58 -05:00
Dave Collins 732ffe4ed1 Address a couple of nits with recent En(De)crypt.
This commit adds comments about the specific crypto key types, moves the
selectCryptoKey function before the Encrypt/Decrypt functions that call it
to be more consistent with the rest of the code base, and slightly
modifies the verbiage of the comment.
2014-10-31 10:09:44 -05:00