Commit graph

381 commits

Author SHA1 Message Date
Josh Rickmar
378af40329 Remove some fmt.Printf debugging. 2013-12-03 12:45:27 -05:00
Josh Rickmar
c54af23849 Perform signature verifiction when generating addresses.
This change adds an additional check when creating a new wallet or
extending the keypool.  All public and private keypairs are parsed
from their serialized forms, and an ecdsa signature is created and
verified using the keypairs.  If the verifiction fails at any point,
the wallet creation or keypool extension is aborted to prevent any
errors where an address is returned to a user, but any funds send to
that address are unspendable due to a mismatched keypair.
2013-12-03 12:37:18 -05:00
Josh Rickmar
eeb72db8b5 Change default CA file location.
This changes the default CA filename from 'cert.pem' to 'btcd.cert' to
reflect the fact that this cert is used for securely connecting to
btcd.  With the introduction of autogenerated btcwallet certs (saved
to rpc.cert and rpc.key) this change was made to better differentiate
the two cert files.

To upgrade across this change, simply move the btcd cert.  On unix,
use the command:

$ mv ~/.btcwallet/cert.pem ~/.btcwallet/btcd.cert
2013-12-03 11:00:26 -05:00
Josh Rickmar
3b04e3a4bc Use TLS+auth for frontend connections.
This change is mostly a copy paste job from the TLS listeners and
autogenerated cert code from btcd.
2013-12-03 10:52:09 -05:00
Josh Rickmar
af1438eecd Add frontend support for displaying txs.
This change adds a new websocket extension command,
listalltransaction, which works just like listtransactions except it
does not take the count or from optional args, and will return an
array of all transaction details.  Notifications for newly-added
transactions are now sent to frontends as well, using the newtx
notification.

No support for updating tx details or removing failed txs is
implemented yet, and will be when cleanly failing a tx send is
implemented later.
2013-12-02 17:34:36 -05:00
Josh Rickmar
3c528f81ec New Account and AccountStore API.
This change better organizes account handling by creating a new
AccountStore type and accountstore global variable, with receiver
funcs for all operations that require all accounts.  More Account
funcs are also added to clean up account handling in the RPC code.

Intial work on this done by dhill.
2013-12-02 14:56:06 -05:00
Josh Rickmar
2dd3fd0a21 Fix build. 2013-11-27 16:07:00 -05:00
Josh Rickmar
0056958dfa More verbose tx handling. 2013-11-27 14:50:43 -05:00
Josh Rickmar
e615f250d1 Send number of bitcoins, not satoshis, with listtransactions reply. 2013-11-27 13:55:14 -05:00
Josh Rickmar
413f23ea18 Add support for listtransactions RPC request.
This change adds support for the listtransactions RPC command.  To
properly reply to this command, additonal information about received
transactions was added, and is now saved in an account's tx.bin file.
Additionally, when sending a transaction, a *tx.SendTx is now saved to
the Tx store, and is included in listtransactions replies under the
"send" category.

WARNING: All account's tx.bin and utxo.bin files should be removed
before running with this change, or else the files may not be read
correctly.  Removing tx.bin is not an issue as it was not being used
before, and was being saved with incorrect data.  Removing utxo.bin is
not an issue as it will just trigger a rescan on next start.  File
format versions are now included in both files, so automatic updates
from previous file formats will be possible with future changes.

Fixes #12.
2013-11-26 16:22:15 -05:00
Josh Rickmar
a246fc91d6 Update for new btcws TxMinedNtfn API. 2013-11-25 12:54:49 -05:00
Josh Rickmar
e3e8a06661 Update for recent go-flags API changes. 2013-11-25 12:20:37 -05:00
Josh Rickmar
bec16828c5 Ignore zeros when generating wallet name. 2013-11-22 14:47:43 -05:00
Josh Rickmar
c71644815a Document the need to copy btcd's certificate. 2013-11-22 11:53:41 -05:00
Josh Rickmar
a05e9b7a3e Make tests pass again. 2013-11-22 11:40:24 -05:00
Josh Rickmar
38ed238a7f Refill keypool if empty and wallet is unlocked. 2013-11-22 11:34:40 -05:00
Josh Rickmar
74d7178aa8 Set TLS1.2 as the minimum acceptable TLS version. 2013-11-21 16:41:15 -05:00
Josh Rickmar
21faab5e3e Simplify BtcdHandler. 2013-11-21 15:49:07 -05:00
Josh Rickmar
935335f1a5 Pass handsake errors to caller. 2013-11-21 15:01:51 -05:00
Josh Rickmar
828544cb2f Fix some races found by -race. 2013-11-21 14:41:05 -05:00
David Hill
6558986cc5 Add --profile to enable live profiling 2013-11-21 11:35:40 -05:00
Josh Rickmar
57802d8daf Rename some Account variables. 2013-11-21 11:23:50 -05:00
Josh Rickmar
649112b764 Reply with errors if the expected account does not exist.
This fixes the cases for the walletlock and walletpassphase requests
to return an appropiate error to the frontend when the default account
does not exist.
2013-11-21 11:06:46 -05:00
Josh Rickmar
e1ce9843bf Add missing mutex unlock if an error is hit.
Spotted by dhill.
2013-11-21 10:48:35 -05:00
Josh Rickmar
47b5e17917 Return from dumpwallet handler after replying with an error. 2013-11-21 10:40:09 -05:00
Josh Rickmar
908b419443 Fix a typo. 2013-11-21 10:34:51 -05:00
Josh Rickmar
417aa63534 Add a missing mutex lock/unlock.
Spotted by dhill.
2013-11-21 10:27:58 -05:00
Josh Rickmar
5efbcecb53 Support UNIX ~ homedir expansion.
Patch from jolan, closes issue #17.
2013-11-21 10:02:27 -05:00
Josh Rickmar
0bcb2b6351 Fix websocket path in README. 2013-11-21 09:54:03 -05:00
Josh Rickmar
5ad35a4460 Create necessary directories when syncing accounts.
Fixes #15.
2013-11-21 09:24:16 -05:00
Josh Rickmar
3143ec328e Correctly serialize pubkeys for imported keys. 2013-11-20 10:47:44 -05:00
Josh Rickmar
455a376df8 Add hex string of pubkey to AddressInfo. 2013-11-20 10:17:49 -05:00
David Hill
89e3054bc5 socks5/tor proxy support 2013-11-19 20:54:48 -05:00
Josh Rickmar
1ff67707e4 Fix issues found by golint. 2013-11-19 20:46:16 -05:00
Josh Rickmar
7e0a24950a Disable dumpwallet RPC handler that snuck in.
We do not support this yet, and need to match bitcoin'd behavior
before the function is added back to the RPC handler map.
2013-11-19 20:44:37 -05:00
Josh Rickmar
00fe439670 Add private key import and export support.
This adds the necessary bits for handling importing addresses for the
wallet file format, as well as implementing the importprivkey and
dumpprivkey RPC requests.

Initial code by dhill.
2013-11-19 20:18:11 -05:00
Josh Rickmar
0bd877237f Add missing space for basic HTTP auth header. 2013-11-19 18:25:42 -05:00
Josh Rickmar
5dbf69d23e Enable TLS support for btcd websocket connections.
This adds an additional config option, -cafile, to specify the root
certificates checked when verifying a btcd TLC connection.  btcd will
now automatically generate certs in
~/.btcd/data/{main,test}net/rpc.cert, and this file should be copied
to ~/.btcwallet/cert.pem.

The -btcdport option is also gone now, and replaced with -connect (or
-c), to specify both the hostname/ip and port of the server running
btcd.
2013-11-19 12:21:54 -05:00
Josh Rickmar
474106a757 Sending and receving from chans on the same goroutine is a bad idea. 2013-11-18 16:37:28 -05:00
Josh Rickmar
28087af90b Add handling for standard bitcoind-style RPC.
With the exception of the createencryptedwallet extension (which is
required to make a wallet), all websocket-specific handlers are now
only available from a websocket connection, and standard RPC requests
are handled with a normal HTTP request and reply.

As an added bonus, listening on IPv6 now works.
2013-11-18 15:51:50 -05:00
David Hill
37109bfe0d update tests to use the new Account type and catch rand.Read errors 2013-11-15 12:03:52 -05:00
David Hill
fcc4871351 check rand.Read for errors 2013-11-15 11:59:37 -05:00
Josh Rickmar
ef49eca365 more wallet -> account renames 2013-11-15 11:44:24 -05:00
David Hill
9c827a824f Rename BtcWallet to Account and put it in its own file. 2013-11-14 12:15:16 -05:00
Josh Rickmar
c138a663e1 Return errors if rand.Read fails. 2013-11-13 17:25:50 -05:00
Josh Rickmar
56d732ff3e Link to btcdsuite on opensource.conformal.com. 2013-11-13 15:04:38 -05:00
Josh Rickmar
a6c8800fba Prepare for release 0.1.0. 2013-11-13 14:08:35 -05:00
Josh Rickmar
1ddd9c38dc Use btcutil.AppDataDir for data dir. 2013-11-12 15:25:56 -05:00
Josh Rickmar
503f591e88 Process tx notifications before new blocks.
This change modifies the order in which transaction to watched
addresses are processed and when frontend notifications occur.  Due to
btcd notifying all transactions before sending the blockconnected
notification, the UTXO and transaction stores can be modified without
sending any frontend notifications, and then a single frontend
notification is sent when the blockconnected notification arrives.

The order in which each file is synced to disk was also changed to
write out the UTXO and transaction stores before writing the wallet.
This is to prevent a race where wallet closes after writing the dirty
wallet, but before the dirty UTXO store is written.  In this
situation, newly added UTXOs will be missed and not found again on the
next wallet open during the rescan.  Writing the wallet (which holds
the synced-to-block information) last prevents this.

An issue where the unconfirmed change UTXO created from a new
transaction never being properly notified to frontends is fixed now as
well.
2013-11-12 14:53:38 -05:00
Josh Rickmar
b7aec7f7a1 Type assert GetNewAddressCmd correctly. 2013-11-12 12:40:20 -05:00