Commit graph

729 commits

Author SHA1 Message Date
Josh Rickmar
6af96bfdb7 Correctly handle RPC listen addresses with IPv6 zones.
Fixes #341.
2016-01-14 13:33:08 -05:00
Mawuli Adzoe
c4abe025d0 Fix minor typos. 2015-12-30 15:24:31 -07:00
Josh Rickmar
b701fadd7b Update travis config for recent Go versions. 2015-12-08 11:40:20 -05:00
Josh Rickmar
647e7fdd22 Update README.
Removed links to outdated btcsuite MSIs, replacing these with links to
Github releases.

Combined installation and updating instructions since they are
identical.

Added Windows to the list of operating systems that the "Build from
source" instructions work with.

Added PowerShell examples for copying the sample btcd and btcwallet
configs for both MSI and source installs.
2015-11-25 12:27:34 -05:00
Josh Rickmar
b0566e09c8 Separate out default ports and utility funcs.
This change moves the chain and network parameter definitions, along
with the default client and server ports, to a package for reuse by
other utilities (most notably, tools in the cmd dir).  Along with it,
functions commonly used for config parsing and validation are moved to
an internal package since they will also be useful for distributed
tools.
2015-11-25 01:02:50 -05:00
Josh Rickmar
5482feecf4 Prepare for release 0.7.0. 2015-11-23 10:44:37 -05:00
Josh Rickmar
8999c13f4d Add 0.7.0 deps to deps.txt. 2015-11-23 10:44:36 -05:00
Rune T. Aune
52b8e1903f Add the chain subsystem logger to btcrpcclient.
Logging from btcrpcclient is currently not possible to set, and defaults
to nothing. Letting it inherit chain's logger can greatly simplify
debugging of connectivity issues.

Also remove a now redundant log message upon connecting to btcd.
2015-11-19 17:15:20 -06:00
Dave Collins
6ba74e6730 Update for hdkeychain NewMaster API change. 2015-11-10 12:05:16 -06:00
Josh Rickmar
4f6edce6dc Fix signmessage RPC to match Core.
AFAICT this function has never worked correctly due to the hash being
signed not matching the hash created by Core.  Core wallet writes
serialized strings to a double-sha256 hashing stream, while we were
using string concatination.  This produced different messages since
the message before hashing did not include compact integers (called
varints in btcsuite code) preceding each string with the string
length.

Tested by creating signed messages from btcwallet and verifying them
with Bitcoin-Qt, as well as creating signatures from Bitcoin-Qt and
verifying them with btcwallet.

Fixes #323.
2015-10-16 14:13:59 -04:00
John C. Vernaleo
cef002139f Fix wallet compile after SigCache addition to NewEngine. 2015-10-12 13:09:40 -04:00
Josh Rickmar
31d152608b Temporarly increase session RPC timeout. 2015-09-23 12:24:24 -04:00
Josh Rickmar
33d053c6a7 Detect silent network drops.
This change introduces additional network activity with the btcd
process to ensure that the network connection is not silently dropped.
Previously, if the connection was lost (e.g. wallet runs on a laptop
and connects to remote btcd, and the laptop is suspended/resumed) the
lost connection would not be detectable since all normal RPC activity
(excluding requests from btcwallet to btcd made by the user) is in the
direction of btcd to wallet in the form of websocket notifications.
2015-09-22 14:54:40 -04:00
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