Commit graph

65 commits

Author SHA1 Message Date
Alex
3f15a85da7 chain: ensure bitcoind back-end fully rescans and sends correct ntfn 2018-05-23 19:38:56 -07:00
Alex
81c4b1d096 chain: eliminate start of sync race condition in bitcoind back-end
This commit also allows bitcoind back-end to return block timestamp
in `BlockStamp()` and prevents logging and notification of events
until after the client wallet requests notifications.
2018-05-23 19:38:56 -07:00
Alex
6b6ed89d87 chain: improve reorg-during-rescan handling for bitcoind 2018-05-23 19:38:56 -07:00
Conner Fromknecht
2bd4130581 chain/bitcoind: connect to zmq in Start() to return error 2018-05-23 19:38:56 -07:00
Alex
30d84da3e5 build+chain: replace pebbe/zmq4 with lightninglabs/gozmq (native Go) 2018-05-23 19:38:56 -07:00
Alex
a16bfd7775 chain/neutrino: fix data races due to not using pointer for rescan 2018-05-23 19:38:56 -07:00
Alex
78a69b4802 chain/neutrino: fix deadlock 2018-05-23 19:38:56 -07:00
Alex
73dbcf3943 multi: add bitcoind back-end (only for API use for now) 2018-05-23 19:38:56 -07:00
Alex
d7ad221ee0 chain: ensure clientMtx is never locked while waiting on channel 2018-05-23 19:38:56 -07:00
Alex
1b6d7a7ee3 chain: add GetBlockHeader support
This commit allows neutrino to simulate the GetBlockHeader RPC, and
allows chain client code to use the call with both btcd/RPC back end
and the neutrino back end.
2018-05-23 19:38:56 -07:00
Alex
e06434ed75 chain: add StartTime support to neutrino client
This commit adds support for using StartTime in a rescan in
neutrino. The NeutrinoClient instance can have a birthday set
such that all underlying neutrino rescans are called with that
start time.
2018-05-23 19:38:56 -07:00
Olaoluwa Osuntokun
a0abd3632c multi: update to new upstream btcsuite/btcd API's 2018-05-23 19:38:56 -07:00
Alex
081f7b0dce chain: fix issue where mutex can be unlocked twice 2018-05-23 19:38:56 -07:00
Alex Akselrod
c85893de1a chain+waddrmgr+wallet: store all hashes for better reorg handling (#5) 2018-05-23 19:38:56 -07:00
Olaoluwa Osuntokun
4ac75773d7 chain: wait for rescan exit before re-creating, ensure thread safety 2018-05-23 19:38:56 -07:00
Olaoluwa Osuntokun
3dc7a8529c multi: switch all imports to roasbeef's forks 2018-05-23 19:38:56 -07:00
Olaoluwa Osuntokun
7acc49dddb chain: also register blockConnected for NotigyReceived calls 2018-05-23 19:38:56 -07:00
Olaoluwa Osuntokun
772fbd4726 chain: dispatch BlockConnected notifications for NeutrinoClient 2018-05-23 19:38:56 -07:00
Olaoluwa Osuntokun
dbe472edd6 build: update neutrino glide.lock hash, API usage 2018-05-23 19:38:56 -07:00
Alex
3f12fa3c6c chain+wallet: rename SPVChain to NeutrinoClient 2018-05-23 19:38:56 -07:00
Alex
4598742465 chain: stop SPV rescan immediately when wallet is already caught up 2018-05-23 19:38:56 -07:00
Alex
3601b2fa14 chain: fix RescanFinished notification 2018-05-23 19:38:56 -07:00
Alex
d6bcab4912 chain: make ChainService public member of SPVChain struct 2018-05-23 19:38:56 -07:00
Alex
0e7e8404e5 chain: fix Neutrino driver bugs 2018-05-23 19:38:56 -07:00
Alex
b5873a5b2c Finish integration of Neutrino; still untested. 2018-05-23 19:38:56 -07:00
Alex
9e5250e6d7 More neutrino integration into btcwallet. 2018-05-23 19:38:56 -07:00
Alex
3d81f856fd Move spvchain into neutrino and start integration w/btcwallet 2018-05-23 19:38:56 -07:00
Alex
32adc3c43f Make rescan a struct, add spending tx to GetUtxo, start integration. 2018-05-23 19:38:56 -07:00
Olaoluwa Osuntokun
521b2123de Fix RPC ping/pong deadlock and timeout issue.
This is a backport of decred/dcrwallet#612.

This change moves the wait for the session RPC response (used as a
pong) to a new goroutine that does not run directly in the queue
handler.  By moving this out to a new goroutine, the handler can
continue enqueuing and dequeueing notifications while waiting for the
session response.  Previously, if a notifiation was sent after the
session RPC was called and before the response was received, the
rpcclient main loop would block due to being unable to enqueue the
notification.
2018-05-23 19:38:56 -07:00
Olaoluwa Osuntokun
01d52770d2 chain: enable auto-reconnect within the client 2018-05-23 19:38:56 -07:00
Olaoluwa Osuntokun
77b756c651 multi: point all imports towards roasbeef's forks 2018-05-23 19:38:56 -07:00
Dave Collins
e92f94dcd1 Update for recent chainhash-related API changes. (#450)
This updates all code to make use of the new chainhash package since the
old wire.ShaHash type and related functions have been removed in favor
of the abstracted package.

Also, while here, rename all variables that included sha in their name
to include hash instead.

Finally, update glide.lock to use the required version of btcd, btcutil,
and btcrpcclient.
2016-08-08 14:49:09 -05:00
John C. Vernaleo
c2ed8ffc2b Add goclean.sh script from btcd.
This commit corrects various things found by the static checkers
(comments, unkeyed fields, return after some if/else).

Add generated files and legacy files to the whitelist to be ignored.

Catch .travis.yml up with btcd so goclean can be run.
2016-03-31 11:43:54 -04:00
Josh Rickmar
5140086f6e Use LICENSE file and short license headers. 2016-02-28 22:22:34 -05:00
Josh Rickmar
497ffc11f0 Modernize the RPC server.
This is a rather monolithic commit that moves the old RPC server to
its own package (rpc/legacyrpc), introduces a new RPC server using
gRPC (rpc/rpcserver), and provides the ability to defer wallet loading
until request at a later time by an RPC (--noinitialload).

The legacy RPC server remains the default for now while the new gRPC
server is not enabled by default.  Enabling the new server requires
setting a listen address (--experimenalrpclisten).  This experimental
flag is used to effectively feature gate the server until it is ready
to use as a default.  Both RPC servers can be run at the same time,
but require binding to different listen addresses.

In theory, with the legacy RPC server now living in its own package it
should become much easier to unit test the handlers.  This will be
useful for any future changes to the package, as compatibility with
Core's wallet is still desired.

Type safety has also been improved in the legacy RPC server.  Multiple
handler types are now used for methods that do and do not require the
RPC client as a dependency.  This can statically help prevent nil
pointer dereferences, and was very useful for catching bugs during
refactoring.

To synchronize the wallet loading process between the main package
(the default) and through the gRPC WalletLoader service (with the
--noinitialload option), as well as increasing the loose coupling of
packages, a new wallet.Loader type has been added.  All creating and
loading of existing wallets is done through a single Loader instance,
and callbacks can be attached to the instance to run after the wallet
has been opened.  This is how the legacy RPC server is associated with
a loaded wallet, even after the wallet is loaded by a gRPC method in a
completely unrelated package.

Documentation for the new RPC server has been added to the
rpc/documentation directory.  The documentation includes a
specification for the new RPC API, addresses how to make changes to
the server implementation, and provides short example clients in
several different languages.

Some of the new RPC methods are not implementated exactly as described
by the specification.  These are considered bugs with the
implementation, not the spec.  Known bugs are commented as such.
2016-01-29 11:18:26 -05:00
Mawuli Adzoe
c4abe025d0 Fix minor typos. 2015-12-30 15:24:31 -07: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
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
Josh Rickmar
e5e239e124 API updates for times in block notifications. 2015-06-18 12:29:13 -04:00
Dave Collins
c820c8a015 Relicense to the btcsuite developers. 2015-05-01 12:20:05 -05:00
Dave Collins
0a13274d5b Update btcjson path import paths to new location. 2015-05-01 00:59:14 -05:00
Josh Rickmar
56039deb94 Integrate wtxmgr package. 2015-04-28 17:30:17 -04:00
Javed Khan
48a3b413b4 Move txstore package to legacy directory 2015-04-20 18:20:19 -04:00
Josh Rickmar
fbe92830c1 Use btcjson v2 types with the updated btcrpcclient.
btcrpcclient commit 9ca93b30ad11ec34348d2d788c58019571bf9524 switched
the client to btcjson v2 and broke the wallet build.  This change is
the minimum amount of work to make wallet work again.

The rpc server still uses btcjson v1, so there will be 2 versions of
btcjson linked in the resulting binary.  This is not optimal but not
compiling is worse.
2015-04-06 13:14:01 -04:00
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
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
Dave Collins
8b6c161cbc Update btcws path import paths to new location. 2015-02-19 13:09:16 -06:00
Josh Rickmar
ad80e9f384 Address several issues pointed out by lint and vet.
This brings the entire tree closer to but not 100% goclean.sh clean.
2015-02-06 01:04:01 -05:00