Commit graph

1320 commits

Author SHA1 Message Date
Josh Rickmar
50073b32c1 Save correct addresses for new utxos 2013-10-10 18:44:44 -04:00
Josh Rickmar
1ecc74c37d Begin sending notifications based on all accounts.
We need to notify frontends of notifications for every account
(wallet), not just the "current" opened account, since wallet will
need to have multiple wallets open at the same time.  Frontends will
have to filter notifications to show only details of only one account
if they need to display just one account at a time.

As of this commit, account balances and lock state notifications are
using this per-account notification scheme.
2013-10-10 16:20:23 -04:00
Josh Rickmar
94d4bd28ae Hold wallet map lock until wallet has been added (or an error happens) 2013-10-08 19:36:44 -04:00
Josh Rickmar
2e42efef53 fix comment 2013-10-08 19:33:22 -04:00
Josh Rickmar
2a7f09a422 Track new addresses after a getnewaddress command 2013-10-08 19:30:43 -04:00
Josh Rickmar
8163227225 Correctly parse account name for getnewaddress 2013-10-08 19:25:33 -04:00
Josh Rickmar
9cc6600db2 Fixes for api changes 2013-10-08 13:36:39 -04:00
Josh Rickmar
c85a3a29e3 'err != nil' -> 'err == nil', fixes getaddressesbyaccount 2013-10-07 22:22:47 -04:00
Josh Rickmar
f14d2edbff Return errors for getaddressesbyaccount command 2013-10-07 22:17:27 -04:00
Josh Rickmar
7e3edab24b remove debugging that snuck in 2013-10-07 20:33:43 -04:00
Josh Rickmar
c1cf2c59bb Implement settxfee command 2013-10-07 15:14:45 -04:00
Josh Rickmar
b137542c92 unbreak tests 2013-10-07 14:26:29 -04:00
Josh Rickmar
ea9ce4e0b1 Default to testnet.
Use on mainnet is not recommended until extensive testing has been
done, and should be done at your own risk. Run btcwallet with
--mainnet to operate on main Bitcoin network.
2013-10-07 13:25:05 -04:00
Josh Rickmar
3c4ff4b0f4 Add support for running wallet on testnet3.
Websocket connections to btcd will be closed if btcd and btcwallet are
running on different networks.
2013-10-07 13:09:24 -04:00
Josh Rickmar
1d6741eb05 Allocate mutex on stack, spotted by davec. 2013-10-06 11:04:01 -04:00
Josh Rickmar
e081508c9d Reply with errors when parameters are not a []interface{}. 2013-10-04 18:34:53 -04:00
Josh Rickmar
911e9fa5ae Add space to btcd auth string. 2013-10-04 16:40:57 -04:00
Josh Rickmar
4857572e59 Send raw transactions off to btcd. 2013-10-04 15:02:17 -04:00
Josh Rickmar
0f986d6cf3 More test code 2013-10-04 12:05:16 -04:00
Josh Rickmar
b394444b11 Add simple sample configuration file. 2013-10-04 09:01:04 -04:00
Josh Rickmar
8e9e6f6229 Handle basic auth for dialing btcd websocket connections. 2013-10-03 09:11:35 -04:00
Josh Rickmar
b28730b82b Remove finished items from TODO list 2013-10-01 14:45:06 -04:00
Josh Rickmar
63686347c6 Create transactions using saved utxo data.
This is a big change that also many general fixes to problems found
when creating transactions.  In particular the Utxo and Tx formats and
serialization functions were updated with additional information that
would be necessary for rolling back old utxo and tx data data after
btcd chain switches.  This change also implements the json methods
'sendfrom' and 'sendmany' to create a new transaction based on a
frontend request.

Transactions are currently not sent to btcd since the tx relay code is
not finished yet, so a temporary error is returned back to frontends
who try to send new transactions.
2013-10-01 14:26:27 -04:00
Josh Rickmar
fa85e586fc Save the pkScript for each Utxo. This is needed to create transactions. 2013-09-09 13:31:37 -04:00
Josh Rickmar
24d6168709 Reply with correct account balance for getbalance requests. 2013-09-05 15:31:39 -04:00
Josh Rickmar
290fdb5427 Read btcd:blockconnected hash string from correct map. 2013-09-05 12:58:19 -04:00
Josh Rickmar
2789502ec9 Begin tracking newly created wallets against btcd. 2013-09-05 12:50:39 -04:00
Josh Rickmar
ed98256553 Track opened wallets after establishing btcd connection. 2013-09-05 11:51:33 -04:00
Josh Rickmar
019df772b1 Use a single handler (per wallet) for all tx notifications. 2013-09-05 11:19:48 -04:00
Josh Rickmar
897fa1448b Return comprehensive errors when opening wallets. 2013-09-05 09:43:53 -04:00
Josh Rickmar
90b9a98802 Remove unused func. 2013-09-04 20:41:09 -04:00
Josh Rickmar
6e20de7c4a Interpret btcd:blockconnected hash as string.
btcd was changed to send the block hash for new block notifications as
a big endian string, so type assert as a string and convert to a
btcwire.ShaHash.
2013-09-04 20:38:57 -04:00
Josh Rickmar
79d1491ac4 Save index from tx notifications to utxo store. 2013-09-04 16:36:48 -04:00
Josh Rickmar
2d5950299f Unbreak build caused by changes in tx pkg. 2013-09-04 16:21:03 -04:00
Josh Rickmar
a6ad4cf48c Save index as well as tx hash for outputs. 2013-09-04 16:16:20 -04:00
Josh Rickmar
34dc33d48c requesttxs -> notifynewtxs 2013-09-04 14:14:21 -04:00
Josh Rickmar
be538d149e Combine tx and utxo requesters.
btcd now has only one notifier mechanism for received transactions to
a watched address.  This previously combines the seperate notifiers
for generic tx and exclusively unspent outputs.

A new handler will be added to watch for spent outputs instead of
relying on the now-removed "btcd:sendtx" notification.
2013-09-04 13:41:33 -04:00
Josh Rickmar
419ceb55c6 Implement Utxo notification handler to add to utxo store. 2013-09-04 09:54:06 -04:00
Josh Rickmar
0928361f22 Save address with Utxo.
We want only one utxo file per wallet, so each serialized Utxo needs
to also contain the receiving address.
2013-09-04 09:32:14 -04:00
Josh Rickmar
a1d3800feb Remove basic tx/utxo handlers as id routing handles this now. 2013-09-03 21:20:48 -04:00
Josh Rickmar
46077ac50a Pass wallet pointer as receiver for requester funcs.
Each wallet needs its own handler running and listening to replies
from btcd, so that wallet can be synced to disk with the new tx or
utxo information.  Another rounter to map from addresses to wallets
could have been written, but we'll use the JSON Id router message
router instead.
2013-09-03 19:05:59 -04:00
Josh Rickmar
85425c2c80 Abstract out wallet tracking function.
This will soon be used to also implement tracking of utxo and txs for
address in this wallet.
2013-09-03 17:16:07 -04:00
Josh Rickmar
42274b143f Defer closing files when reading saved wallet. 2013-09-03 17:05:22 -04:00
Josh Rickmar
3d6ad329d0 Set Jsonrpc string when manually creating json messages. 2013-09-03 16:35:54 -04:00
Josh Rickmar
b495842b0e Set defualt highestUsed chained address to -1 (root). 2013-09-03 16:35:07 -04:00
Josh Rickmar
28c679ee82 Reply with nil result if wallet creation succeeded. 2013-09-03 12:16:02 -04:00
Josh Rickmar
e3416add35 Implement 'getbalance' replier (currently replies with 0). 2013-09-03 11:00:01 -04:00
Josh Rickmar
1918bd3698 Do not fail if default wallet does not exist.
We must instead wait for the user to explicitly generate their own
wallet for an account name.  This is because all btcwallet wallets
must be encrypted, and the passphrase must be known at time of wallet
generation.
2013-09-03 10:21:14 -04:00
Josh Rickmar
1c1ab52ef7 Implement new JSON extension 'createencryptedwallet'. 2013-09-03 09:49:16 -04:00
Josh Rickmar
9eae969230 Implement new wallet and chained address creation. 2013-09-03 00:10:32 -04:00