Commit graph

142 commits

Author SHA1 Message Date
Javed Khan
48a3b413b4 Move txstore package to legacy directory 2015-04-20 18:20:19 -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
Javed Khan
84675ec9b8 Creating account requires unlocked manager - err 2015-04-13 21:12:07 +05:30
Manan Patel
dfe617e05d create wallet package
This a refactor of the btcwallet main package to create a new wallet
package.
The main feature of this package is the integration of all the other
wallet components (waddrmgr, txstore, and chain) and the Wallet type is
'runnable', so it will be continuously updating itself against changes
notified by the remote btcd instance.

It also includes several methods which provide access to information
necessary to run a wallet RPC server.
2015-04-02 11:17:45 -07:00
Javed Khan
68a9168d9e Updated waddrmgr to manage account names 2015-03-19 06:28:23 +05:30
Josh Rickmar
0a7b10d051 Rescan after btcd reconnect.
Otherwise, if the websocket connection to btcd is lost and
reestablished, there is no sync to the current best block, and btcd
will not notify wallet of new relevant transactions.
2015-03-02 16:04:26 -05:00
Josh Rickmar
5ad37374fb Use the correct synced block when calculating confs.
This was previously using the most recently notified (by the chain
package) block, but transaction processing from this block may not be
finished yet.  Using this block's height to calculate the number of
confirmations is therefore incorrect, and can result in every RPC
handler missing transactions or returning transactions from the wrong
block.
2015-03-02 13:30:42 -05:00
Josh Rickmar
c9d9b4b610 Implement several btcd RPCs in wallet as well.
Wallet should handle these so that wallet clients don't end up
creating requests to btcd about the latest processed block, which is
not the same as wallet's most recently processed block.

By providing wallet clients with this info, we avoid a race where the
client thinks wallet has processed N blocks, but in fact is still
synced to N-1 (and perhaps currently processing transactions from
block N).  This can cause unexpected results for many of the
bitcoind-compatible RPC APIs due to their reliance on number of
confirmations, rather than using absolute block heights.
2015-03-02 13:22:46 -05:00
Dave Collins
8f9f53a618 Switch to new waddrmgr package
This commit converts the wallet to use the new secure hierarchical
deterministic wallet address manager package as well as the walletdb
package.

The following is an overview of modified functionality:

- The wallet must now be created before starting the executable
- A new flag --create has been added to create the new wallet using wizard
  style question and answer prompts
- Starting the process without an existing wallet will instruct now
  display a message to run it with --create
- Providing the --create flag with an existing wallet will simply show an
  error and return

In addition the snacl package has been modified to return the memory after
performing scrypt operations to the OS.

Previously a runtime.GC was being invoked which forced it to release the
memory as far as the garbage collector is concerned, but the memory was
not released back to the OS immediatley.  This modification allows the
memory to be released immedately since it won't be needed again until the
next wallet unlock.
2015-03-02 11:55:42 -06:00
Dave Collins
130e44c761 Move keystore to legacy directory. 2015-03-02 12:21:44 -05:00
David Hill
f704c58114 Use txscript.StandardVerifyFlags
By using txscript.StandardVerifyFlags when creating and validating
transactions, we can ensure the transactions successfully created
won't be rejected due to script policy.
2015-02-26 18:41:59 -05:00
Josh Rickmar
d9e2443002 Fix build.
This fixes the build after btcsuite/btcd#302, which renamed the
txscript constant ScriptCanonicalSignatures constant to
ScriptVerifyDERSignatures.
2015-02-23 22:44:04 -05:00
Dave Collins
8b6c161cbc Update btcws path import paths to new location. 2015-02-19 13:09:16 -06:00
Dave Collins
58f7cedc0e Update btcjson path import paths to new location. 2015-02-19 12:01:41 -06:00
Dave Collins
b2ebd20d75 Update btcec path import paths to new location. 2015-02-06 11:06:45 -06:00
Dave Collins
23c9dc423e Update btcwire path import paths to new location. 2015-02-05 15:41:38 -06:00
Dave Collins
6d4889ffb0 Update btcscript import paths to new location. 2015-01-30 12:31:29 -06:00
Dave Collins
31149b88b9 Add prints when client and server TLS is disabled. 2015-01-23 16:11:13 -06:00
Dave Collins
f05ab25696 Update btcwallet import paths to new location. 2015-01-17 00:25:53 -06:00
Dave Collins
06ed33b65a Update btcjson import paths to new location. 2015-01-16 23:58:53 -06:00
Dave Collins
3fc3ecc908 Update btcws import paths to new location. 2015-01-16 23:40:19 -06:00
Dave Collins
7276c1ca7d Update btcscript import paths to new location. 2015-01-16 19:38:15 -06:00
Dave Collins
7db8ff3f9a Update btcec import paths to new location. 2015-01-16 18:08:45 -06:00
Dave Collins
283aa28be5 Update btcwire import paths to new location. 2015-01-16 16:03:04 -06:00
Dave Collins
d71bc3193f Update btcrpcclient import paths to new location. 2015-01-15 21:28:09 -06:00
Dave Collins
174005d586 Update websocket import paths to new location. 2015-01-15 17:52:53 -06:00
Dave Collins
ea0d0ec280 Update for recent btcjson changes. 2015-01-15 17:52:12 -06:00
Dave Collins
afeb509c45 Update btcutil import paths to new location. 2015-01-15 10:48:58 -06:00
John C. Vernaleo
a702473c57 Check for nil to prevent panic.
ok jrick@
2015-01-14 09:57:28 -05:00
John C. Vernaleo
88e28a26a8 Compile again after btcjson changes. 2015-01-13 11:26:25 -05:00
Javed Khan
469a6f86eb Allow disabling RPC server TLS for localhost only.
This commit introduces a new flag, --noservertls, which can be used to disable
TLS for the RPC server.  However, the flag can only be used when the RPC
server is bound to localhost interfaces.  This is intended to prevent the
situation where someone decides they want to expose the RPC server to the
web for remote management/access, but forgot they have TLS disabled.
2015-01-09 15:07:06 +05:30
Josh Rickmar
df3779f780 Require TLS 1.2 minimum.
This prevents a downgrade attack to the vulnerable SSLv3.  While here,
go ahead and require at least TLS 1.2 since TLS 1.0 and 1.1 have their
own set of issues and it's only a matter of time before those would
need to be completely avoided as well.
2014-12-15 13:18:28 -06:00
Javed Khan
9225863706 Updated VerifyMessage to not use the keystore 2014-11-07 10:28:25 +05:30
Dave Collins
ccb2b1e16d Update for recent btcjson API change.
This commit updates the Tx field of the ListReceivedByAddressResult to
TxIDS to mirror the recent change btcjson.
2014-10-26 13:29:13 -05:00
Josh Rickmar
4c7243157f Make move and setaccount unsupported methods.
We no longer need to lie about supporting these in the future as they
will be impossible to implement correctly with the upcomming HD
wallet.
2014-10-14 13:11:11 -05:00
Javed Khan
3f99ed233f implemented ListReceivedByAccount 2014-10-13 10:08:37 -05:00
Javed Khan
9ab659cda3 Added tx ids to ListReceivedByAddress result 2014-10-13 18:50:06 +05:30
Jimmy Song
8d928ce2e1 Update for recent btcec API changes.
This change is introduced so that btcwallet will continue to compile after
issue 6 in btcec is merged.
2014-10-12 21:23:12 -05:00
Jonathan Gillham
a9cf4a2bf5 Removed hashType byte cast. 2014-10-11 21:00:27 +01:00
Jonathan Gillham
e6bdb4465d Changed TxIn.PreviousOutpoint to TxIn.PreviousOutPoint. 2014-10-01 17:27:55 +01:00
Josh Rickmar
2c52062894 Implement getreceivedbyaddress RPC.
Unlike Bitcoin Core wallet, this implementation does not ignore
coinbase transactions.
2014-09-11 10:09:02 -05:00
Josh Rickmar
5615e3530a Check websocket RPC auth for every method.
Previously, the createencryptedwallet and stop requests did not check
that the client had successfully authenticated to the server.  This
change moves the check outside of the select statement for these
special cased handlers (previously run from the default case) so an
auth check will occur even if a request method does not match either
of these two.
2014-08-19 08:03:06 -05:00
Josh Rickmar
97c9d986d4 Log an unexpected error that was encountered.
The stack trace did not make it evidant which request had caused this
issue, so add extra logging for the request that caused it.  Sanitize
this request if it may contain any secrets.

Additionally, in this situation, begin shutting down the wallet rather
than simply dropping the response.  This will help to catch the issue
since it's easier to notice all requests failing, rather than just one
that was dropped.  If shutdown takes an unreasonably long time, panic.
2014-08-14 14:23:47 -05:00
Josh Rickmar
7b90b48bc6 Fix shutdown deadlock for ws notification queue.
While here, correct the comment on rpcServer.notificationQueue.

Closes #122.
2014-08-13 09:05:08 -05:00
Josh Rickmar
42a494f762 Serialize transaction creation.
Fixes #120.
2014-08-11 21:43:59 -05:00
Javed Khan
8759d12617 allow client to disconnect when handlers are done
added a waitgroup on websocketClient to keep track of handler
goroutines specific to the client
2014-08-08 18:33:38 +05:30
David Hill
9b14cd99f1 Enable ScriptStrictMultiSig when creating or signing txs.
ok @jrick
2014-08-01 14:58:17 -04:00
Josh Rickmar
e7263e48dc Drain chain server connected notifications.
Fixes a possible hang on shutdown.
2014-08-01 11:05:26 -05:00
Josh Rickmar
5e18693d2a Register for ntfns when the RPCS creates wallets.
Previously, registerations for wallet notifications (new txs, changed
account balances) were only passed up to websocket clients if the
wallet was loaded off disk (SetWallet was called with a non-nil
wallet), and not for the case when the RPC server would create the
wallet (if it wasn't created yet, and the user manually created it
with createencryptedwallet).  This change fixes that by registering
for these notifications when this code path is taken.
2014-07-31 08:27:30 -05:00