Commit graph

666 commits

Author SHA1 Message Date
cjepson
6ee1f9b7ee Fix retrieval of public key addresses from address manager
The behaviour of function Address() in waddrmgr has been updated such that
it now displays the correct behaviour as described in the comments. That is,
when a public key address is given as a btcutil.Address, the key is converted
to a public key hash address so that serializing with ScriptAddress() yields
the corresponding public key hash. This allows the address manager to find
the corresponding private key, and fixes the signing of multisignature
transactions.
2015-07-22 15:48:24 -04:00
Josh Rickmar
c31dc63760 Remove unnecessary address manager locks.
In particular, this allows the use of AccountName in the passed
function when iterating over all account numbers.
2015-07-21 13:59:46 -04:00
Josh Rickmar
eb25d889a0 Add spendable field to listunspent result.
Fixes #262.
2015-07-21 13:46:24 -04:00
Josh Rickmar
a2a132129e Add AppVeyor continuous integration. 2015-06-30 22:54:36 -04:00
Josh Rickmar
f7ed140a9b Reorder wtxmgr.CreditRecord fields.
This reverses the order of index and amount fields to match
DebitRecord and also saves 8 bytes per instance on amd64.
2015-06-19 01:43:15 -04:00
Josh Rickmar
e5e239e124 API updates for times in block notifications. 2015-06-18 12:29:13 -04:00
Alex Yocom-Piatt
a735e3c3e2 Add mutex for delete(m.addrs, ..) in MarkUsed 2015-06-15 12:01:18 -05:00
Josh Rickmar
411eacbeea Remove data races from switching lock impls.
sync.Locker cannot be safely used to switch a sync.Mutex to a noop
locker since other goroutines that attempt to lock the mutex will race
on the changing interface.  Instead, just statically dispatch
sync.Mutex methods.
2015-06-12 11:40:04 -04:00
Josh Rickmar
9d5abaf14e Simplify error handling with waddrmgr.IsError. 2015-05-27 18:21:17 -04:00
Josh Rickmar
39cab6087a Add waddrmgr.IsError function. 2015-05-27 17:32:33 -04:00
Josh Rickmar
9ee887823d Take advantage of Go 1.5 optimized zeroing.
Closes #286.
2015-05-27 15:32:32 -04:00
Josh Rickmar
8caef99ee4 Fix whitespace. 2015-05-27 13:45:45 -04:00
Josh Rickmar
164368d02e Prepare for release 0.6.0. 2015-05-27 11:45:21 -04:00
Josh Rickmar
5843c0bc66 Move legacy under internal directory.
After Go 1.5, this will prevent consumers from importing these
packages since they are currently unmaintained.

Closes #232.
2015-05-27 10:12:24 -04:00
Josh Rickmar
b7cef610c0 Fix JSON-RPC error code for walletpassphrase failures. 2015-05-26 11:39:22 -04:00
Javed Khan
fbf744bc5e Update wallet to use ForEach- style functions 2015-05-21 23:35:13 +05:30
Guilherme Salgado
fe0f60991a Stop mocking global func() variables
Doing that may cause erratic test failures when we run them in parallel, so
move the functions the tests need to mock as struct fields that are not
shared across tests.
2015-05-14 21:49:09 +02:00
Guilherme Salgado
97e84fe212 Turn isTxTooBig into a method on withdrawalTx
Also get rid of the replaceIsTxTooBig test helper by making tests use
replaceCalculateTxSize instead
2015-05-14 21:48:01 +02:00
Manan Patel
a883c96aa5 add SendPairs helper function to wallet package 2015-05-14 11:51:52 -07:00
Josh Rickmar
d714bf3310 Refactor wallet opening.
Rather than the main package being responsible for opening the address
and transaction managers, the namespaces of these components are
passed as parameters to the wallet.Open function.

Additionally, the address manager Options struct has been split into
two: ScryptOptions which holds the scrypt parameters needed during
passphrase key derivation, and OpenCallbacks which is only passed to
the Open function to allow the caller to provide additional details
during upgrades.

These changes are being done in preparation for a notification server
in the wallet package, with callbacks passed to the Open and Create
functions in waddrmgr and wtxmgr.  Before this could happen, the
wallet package had to be responsible for actually opening the managers
from their namespaces.
2015-05-14 14:33:33 -04:00
Josh Rickmar
edde89cd4c Rollback transactions past the last saved recent block.
If a long reorganize occurs farther back than the last saved recent
block hash (currently max 20 are saved) a full rescan is triggered
since there is no guarantee the previous blocks weren't also removed
in the reorg.  In this case, the address manager was set unsynced, but
transaction history was not rolled back as well.  This commit corrects
this by unconfirming all transactions but those in the genesis block.
2015-05-14 14:32:15 -04:00
Guilherme Salgado
47ca1ca6e5 StartWithdrawal returns a previously saved WithdrawalStatus if parameters match
StartWithdrawal now persists the WithdrawalStatus before returning, and also
returns a previously saved one in subsequent calls with the same parameters.
2015-05-14 13:14:01 -05:00
Josh Rickmar
472d6b0c1e Prevent duplicate waddrmgr lock error.
Fixes #270.
2015-05-14 10:42:01 -04:00
Guilherme Salgado
49210dcf97 Change the stack semantics in withdrawal.eligibleInputs 2015-05-14 09:27:19 -05:00
Josh Rickmar
4637d62baf Use 0 instead of -1 for zero-conf listtransactions results.
Fixes #278.
2015-05-13 20:06:44 -04:00
Josh Rickmar
736a46ff81 Use negative fees with listtransaction result types.
This matches Bitcoin Core Wallet.

Fixes #272.
2015-05-13 13:18:06 -04:00
Josh Rickmar
41b7d4c5ee Remove target conf limit on listsinceblock txs.
All transactions since the specified block (or the genesis block if
left unspecified) should be included in the result array

Along with this fix, update the help descriptions to mention that the
target confirmations parameter is not considered when including
transactions in the result object.  That is, transactions with a
height greater than the height of the lastblock in the result object
are still included.

Fixes #263.
2015-05-13 11:46:31 -04:00
David Hill
9d7fb99b8b Add script verification errors to signrawtransaction result.
This mimics Bitcoin Core commit 8ac2a4e1788426329b842eea7121b8eac7875c76
2015-05-08 10:09:35 -04:00
Josh Rickmar
49f33eec0f Updates for btcjson type changes.
To increase compatibility with Bitcoin Core Wallet, additional fields
were added to and other fields made optional for the listtransactions
and gettransaction results structs.  For both, fee was changed to be
optional (including the zero value is allowed).
2015-05-06 13:18:13 -04:00
Josh Rickmar
8ce25ce518 Do not remove txs from extra block on reorgs. 2015-05-04 09:28:19 -04:00
Dave Collins
c820c8a015 Relicense to the btcsuite developers. 2015-05-01 12:20:05 -05:00
Josh Rickmar
0ae57f2564 Fix waddrmgr version 4 upgrade path.
If the account number to name index mapped the default account name to
an alias, the upgrade would not succeed and the upgrade would be
aborted (and rolled back).

This became a problem for upgrading old (pre-v3) wallets since the v3
upgrade did not rename the previous "" account to "default", but
instead just created an alias.

Fix tested by @dajohi, who ran into this issue with a wallet upgrade
from an older keystore version.
2015-05-01 12:24:22 -04:00
Dave Collins
0a13274d5b Update btcjson path import paths to new location. 2015-05-01 00:59:14 -05:00
Josh Rickmar
ec6034e2d9 Modify default account naming policy.
Rather than disallowing the default account to be renamed as was
proposed in #245 (and implemented in #246), the default account name
is no longer considered a reserved name by the address manager.
Instead, it is simply the initial name used for the first initial
account.

A database upgrade removes any additional aliases for the default
account in the database.  This prevents a lookup for some name which
is not an account name from mapping to the default account
unexpectedly (potentially preventing incorrect account usage from the
RPC server due to bad iteraction with default parameters).

All unset account names in a JSON-RPC request are expected to be set
nil by btcjson.  This behavior depends on btcsuite/btcd#399.

Additionally, the manager no longer considers the wildcard * to be a
reserved account name.  Due to poor API decisions, the RPC server
overloads the meaning of account fields to optionally allow referring
to all accounts at a time, or a single account.  This is not a address
manager responsibility, though, as a future cleaner API should not use
multiple differet meanings for the same field across multiple
requests.  Therefore, don't burden down future APIs with this quirk
and prevent incorrect wildcard usage from the RPC server.

Closes #245.
2015-05-01 01:30:20 -04:00
Josh Rickmar
43aef7db3c Convert RPC server to btcjson v2.
Closes #227.
2015-05-01 00:55:12 -04:00
Guilherme Salgado
d050a32cb2 votingpool: API to store withdrawal txs in the txstore 2015-04-29 07:55:32 -03:00
Josh Rickmar
09c391cc38 Remove legacy txstore. 2015-04-28 17:30:18 -04:00
Josh Rickmar
c012cdbd50 Add guide for forced rescans. 2015-04-28 17:30:17 -04:00
Josh Rickmar
f60b8207d2 Add utility to drop wtxmgr namespace.
This is intended to be used to force a full rescan.
2015-04-28 17:30:17 -04:00
Guilherme Salgado
847c7d8df9 Migrate votingpool tests to use wtxmgr 2015-04-28 17:30:17 -04:00
Josh Rickmar
56039deb94 Integrate wtxmgr package. 2015-04-28 17:30:17 -04:00
Javed Khan
ee72c81a73 Added additional test cases for account tests 2015-04-27 22:53:58 +05:30
Josh Rickmar
0087d38710 Add wtxmgr package. 2015-04-25 00:42:28 -04:00
Javed Khan
48a3b413b4 Move txstore package to legacy directory 2015-04-20 18:20:19 -04:00
Javed Khan
814d5c8771 Move rename to legacy 2015-04-20 18:20:19 -04:00
Josh Rickmar
437c7b3e59 Add cursor functionality to walletdb. 2015-04-20 18:20:19 -04:00
Josh Rickmar
dcef172f6b Rollback txstore on disconnected blocks.
Seems that this code got lost over time, and the only place where
reorgs were handled were those that happened while wallet was
disconnected.
2015-04-20 17:24:53 -04:00
Josh Rickmar
b74a6f78a6 Update for txscript.Script -> txscript.Engine. 2015-04-20 17:21:19 -04:00
Josh Rickmar
0d7b8af543 Updates for txscript.NewScript API change. 2015-04-20 16:52:26 -04:00
Dave Collins
ab8a155841 Update for recent wire API hash error changes. 2015-04-17 01:41:25 -05:00