Commit graph

223 commits

Author SHA1 Message Date
Josh Rickmar
38ed238a7f Refill keypool if empty and wallet is unlocked. 2013-11-22 11:34:40 -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
Josh Rickmar
1ff67707e4 Fix issues found by golint. 2013-11-19 20:46:16 -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
David Hill
fcc4871351 check rand.Read for errors 2013-11-15 11:59:37 -05:00
Josh Rickmar
c138a663e1 Return errors if rand.Read fails. 2013-11-13 17:25:50 -05:00
Josh Rickmar
e9b7fd2fcf Huge cleanup for decreased eye bleeding. 2013-11-11 15:30:50 -05:00
Josh Rickmar
e65206f752 Begin using btcws.
This change begins using the btcws package for marshaling custom
commands used for websocket connections to btcd.
2013-11-06 11:23:30 -05:00
Josh Rickmar
f3408bad91 Add support for compressed pubkeys (used by default).
Wallets that include compressed pubkeys are no longer compatible with
armory, however, imported wallets from armory (using uncompressed
pubkeys) are still valid.
2013-11-05 11:08:02 -05:00
Josh Rickmar
18fb993d0b Implement address rescanning.
When a wallet is opened, a rescan request will be sent to btcd with
all active addresses from the wallet, to rescan from the last synced
block (now saved to the wallet file) and the current best block.

As multi-account support is further explored, rescan requests should
be batched together to send a single request for all addresses from
all wallets.

This change introduces several changes to the wallet, tx, and utxo
files.  Wallet files are still compatible, however, a rescan will try
to start at the genesis block since no correct "last synced to" or
"created at block X" was saved.  The tx and utxo files, however, are
not compatible and should be deleted (or an error will occur on read).
If any errors occur opening the utxo file, a rescan will start
beginning at the creation block saved in the wallet.
2013-11-01 10:06:38 -04:00
Josh Rickmar
3c390364d7 Switch some integers from unsigned to signed.
This change switches the time fields (firstSeen/lastSeen) of an
address from uint64 to int64, to be compatible with (time.Time).Unix,
as well as changing the block height fields (firstBlock/lastBlock)
from uint32 to int32, since block height is normally represented
signed.
2013-10-28 09:15:26 -04:00
Josh Rickmar
50073b32c1 Save correct addresses for new utxos 2013-10-10 18:44:44 -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
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
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
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
b495842b0e Set defualt highestUsed chained address to -1 (root). 2013-09-03 16:35:07 -04:00
Josh Rickmar
9eae969230 Implement new wallet and chained address creation. 2013-09-03 00:10:32 -04:00
Josh Rickmar
cc13f2eed5 Implement JSON extension walletislocked 2013-08-21 14:46:20 -04:00
Josh Rickmar
92a79baeff Implement (*Wallet).Lock() and reply with correct JSON 2013-08-21 13:25:22 -04:00
Josh Rickmar
a56e4e89d2 Initial commit. 2013-08-21 10:37:30 -04:00