Commit graph

1007 commits

Author SHA1 Message Date
Conner Fromknecht
dfa3a88529
wallet/rescan: add rescanWithTarget helper
This commit adds rescanWithTarget, in order to facilitate
rescans beginning a certain height. This is done as a
precursor to fixing a bug in the initial sync, that would
cause us to miss relevant txns if they are confirmed before
starting the initial rescan.
2018-08-30 19:40:06 -07:00
Olaoluwa Osuntokun
7b84dc25a6
Merge pull request #529 from cfromknecht/build-upd-remove-tx-fix
Build upd remove tx fix
2018-08-22 20:42:57 -07:00
Olaoluwa Osuntokun
7d0d499cd0
wallet: remove txns from store if they're in the chain, or have a negative output 2018-08-22 20:20:54 -07:00
Olaoluwa Osuntokun
caab9f91f0
chain: update neutrino client due to recent API changes 2018-08-22 20:20:31 -07:00
Olaoluwa Osuntokun
06da9724e2
build: update build to latest versions of btcd+neutrino 2018-08-22 20:19:56 -07:00
Olaoluwa Osuntokun
635b1bb9b2
Merge pull request #526 from wpaulino/improve-bitcoind-zmq-errors
chain: improve bitcoind zmq errors
2018-08-17 14:13:40 -07:00
Wilmer Paulino
850ad0959a
chain: ensure eventType from ZMQ response is human-readable
In this commit, we fix a small issue where it's possible that we read a
malformed message from the ZMQ connection to bitcoind due to it shutting
down. To fix this, we ensure that the event type is human readable
before attempting to log it.
2018-08-15 18:17:29 -07:00
Wilmer Paulino
d6155a55e9
chain: improve error when filtering blocks and transactions 2018-08-15 17:37:04 -07:00
Wilmer Paulino
5f7060dadf
chain: handle ZMQ timeout error correctly 2018-08-15 17:37:03 -07:00
Olaoluwa Osuntokun
5fb94231d0
Merge pull request #525 from wpaulino/addr-derivation-info
waddrmgr: add new DerivationInfo method to ManagedPubKeyAddress
2018-08-14 18:47:21 -07:00
Olaoluwa Osuntokun
1fbdc8c44b
wallet: catch and return error from rollback failure 2018-08-14 18:17:47 -07:00
Olaoluwa Osuntokun
1feb87e6ae
waddrmgr: update tests to ensure correcntess of new DerivationInfo method 2018-08-14 18:17:46 -07:00
Olaoluwa Osuntokun
bd81968215
waddrmgr: add new DerivationInfo method to managedAddress, update ScopedKeyManager
In this commit, we add the new DerivationInfo method to the current
default implementation of the ManagedPubKeyAddress interface. In doing
this, we replace the account field with the derivationPath, as we can
obtain the account field from the derivationPath itself.
2018-08-14 18:17:46 -07:00
Olaoluwa Osuntokun
05d73f6899 waddrmgr: add new DerivationInfo method to ManagedPubKeyAddress
In this commit, we add a new method DerivationInfo to the
ManagedPubKeyAddress interface. This method is meant to provide callers
with the information necessary to independently derive each key returned
by the various methods provided to derive addresses.
2018-08-14 18:15:02 -07:00
Olaoluwa Osuntokun
1ede0a1a66
Merge pull request #511 from wpaulino/bitcoind-rescan-client
chain: share the same bitcoind connection between multiple rescan clients
2018-07-31 19:53:37 -07:00
Wilmer Paulino
dec9978ca2 wallet: stop handling chain notifications once wallet has stopped
In this commit, we alter the behavior for handling chain notifications
within the wallet. The previous code would assume that the channel would
close, but due to now using a ConcurrentQueue to handle notifications,
this assumption no longer stands. Now, we'll stop handling notifications
either once the wallet has or stopped or once the notifications channel
has been closed.
2018-07-30 17:54:08 -07:00
Wilmer Paulino
bbb5a6c058 wallet: remove the need to set the birthday for bitcoind chain clients
Due to the previous commit allowing us to specify the birthday of the
wallet at the time of the BitcoindClient's creation, this is now
unnecessary.
2018-07-30 17:54:08 -07:00
Wilmer Paulino
8357e86a4d chain: match transaction against currently watched transactions
In this commit, we extend the client's filtering process to also look at
the set of currently watched transactions. The logic to watch for
transaction hashes was previously there, but it was not used to filter
against incoming transactions.
2018-07-30 17:54:08 -07:00
Wilmer Paulino
00428d5828 chain: share the same bitcoind connection between multiple rescan clients 2018-07-30 17:54:08 -07:00
Wilmer Paulino
27e22b1f79 chain: return err when updating the rescan filter while shutting down 2018-07-30 14:55:56 -07:00
Wilmer Paulino
0b269d799e
chain: send empty struct instance rather than bool to reset filters 2018-07-26 16:38:58 -07:00
Wilmer Paulino
7df2b72beb
chain: switch BitcoindClient to use atomic started/stopped pattern 2018-07-26 16:38:57 -07:00
Wilmer Paulino
1aeead0eeb
chain: keep track of the best block within BitcoindClient
In the previous commit, we modified our BitcoindClient struct to use a
ConcurrentQueue struct to handle its notifications to the caller. Before
this, the BitcoindClient had a goroutine that would handle these
notifications in the background and detect when a OnBlockConnected
notification was received in order to update the best block. Due to this
logic being removed, we now keep track of the best block througout the
struct as a whole.
2018-07-26 16:38:56 -07:00
Wilmer Paulino
2091ac0936
chain: use ConcurrentQueue within BitcoindClient to handle event notifications 2018-07-26 16:38:55 -07:00
Wilmer Paulino
fc73cc9678
chain: add concurrent unbounded queue implementation 2018-07-26 16:38:54 -07:00
Wilmer Paulino
8e9e4d6926
chain: rename bitcoind.go to bitcoind_client.go 2018-07-26 16:38:38 -07:00
Olaoluwa Osuntokun
a4d9da433f
Merge pull request #509 from wpaulino/double-spend-bug-fix
wtxmgr: fix double spend bug
2018-07-23 20:28:34 -07:00
Olaoluwa Osuntokun
8b2629a935
Merge pull request #514 from vapopov/zerobalance
wallet: fix lost balance of unmined transaction for neutrino
2018-07-23 17:58:56 -07:00
Olaoluwa Osuntokun
eb5aba63a6
Merge pull request #522 from halseth/test-race-condition
waddrmgr test: fix test race condition
2018-07-20 17:14:06 -07:00
Johan T. Halseth
f243546c33
waddrmgr test: move t.Parallel to actual test 2018-07-20 11:13:27 +02:00
Olaoluwa Osuntokun
5b3d124de2 chain: also accept map[wire.OutPoint]btcutil.Address for bitcoind rescans
In this commit, we update bitcoind to also accept a mapping from
outpoint to address for its implementation of the recan RPC. We do this
as in the near future, when bitcoind implements BIP 158 indexing, then
we'll be able to utilize that to do rescans.
2018-07-17 19:05:17 -07:00
Olaoluwa Osuntokun
6a0e6da280 chain: continue to accept []wire.OutPoint for rescan updates for bitcoind
In this commit, we fix a recently introduced bug that would cause
callers that attempted to get a spend notifications for a particular
outpoint to no longer get that precise notification. In a prior commit,
in preparation for the new neutrino gcs filter format, we added a
mapping from script to outpoint that will be used by neutrino, and later
other backends as well. However, we still need to match on outpoint
slices for bitcoind today.
2018-07-17 19:05:17 -07:00
Olaoluwa Osuntokun
fdca047246 chain: update block filterer unit tests 2018-07-16 19:47:17 -07:00
Olaoluwa Osuntokun
dbb7ae6668 wallet: remove extraneous err check 2018-07-16 19:47:17 -07:00
Olaoluwa Osuntokun
255063b1b2 build: update glide to point to latest btcd+btcutil 2018-07-16 19:47:17 -07:00
Olaoluwa Osuntokun
fb511876c5 wallet: update to use new recovery manager API 2018-07-16 19:47:17 -07:00
Olaoluwa Osuntokun
49e46f3232 wallet: update rescan to take addrs along with their outpoints 2018-07-16 19:47:17 -07:00
Olaoluwa Osuntokun
d6ee9fd0e4 wallet: update HD recovery logic to map outpoints to addresses 2018-07-16 19:47:17 -07:00
Olaoluwa Osuntokun
b29e917a24 chain: update Rescan method for bitcoind to adhere to new interface 2018-07-16 19:47:17 -07:00
Olaoluwa Osuntokun
bc47007c50 chain: update block filterer to map outpoints to addrs 2018-07-16 19:47:17 -07:00
Olaoluwa Osuntokun
714ac383cb chain: update watched/found outpoints to map to addrs 2018-07-16 19:47:17 -07:00
Olaoluwa Osuntokun
2d600fe6ab chain: create new Rescan wrapper for btcd to comply w/ future BIP 158 usage 2018-07-16 19:47:17 -07:00
Olaoluwa Osuntokun
b24714270a chain: update neutrino interface impl to use new InputWithScript 2018-07-16 19:47:17 -07:00
Olaoluwa Osuntokun
87d91316cd chain: update interface to map outpoints to their addresses
In this commit, we update the Rescan call in the interface to map the
outpoint to the address that the outpoint holds. We do this as BIP 158
has recently been updated to match on the prev output script rather than
the outpoint itself. Additionally, in the near future, btcd (then
bitcoind), will switch over to using the BIP 158 filters internally,
which will also match on the output scripts.
2018-07-16 19:47:17 -07:00
Wilmer Paulino
aa826c64cf
wtxmgr: store multiple spending tx hashes for outpoints
In this commit, we modify the way we store spending transaction hashes
for unconfirmed spends. Now, rather than only keeping track of one
possible unconfirmed spend, we track multiple in order to ensure we
properly handle transaction replacements, like in the case of RBF,
double spends, etc. With this in, the double spent tests recently added
should now pass.
2018-07-16 13:39:53 -07:00
Wilmer Paulino
ff646086b7
wtxmgr: split moveMinedTx into deleteUnminedTx and updateMinedBalance
In this commit, we slightly refactor the existing moveMinedTx method
and split it into two: deleteUnminedTx and updateMinedBalance. We do
this as moveMinedTx is no longer moving the transaction from the unmined
bucket to the mined, instead it just removes it from the unmined bucket.
2018-07-16 13:39:52 -07:00
Wilmer Paulino
6340c65d14
wtxmgr: refactor common code within insertMinedTx
In this commit, we remove most of the common code between insertMinedTx
and moveMinedTx. Now, all the common logic is handled within
insertMinedTx, and moveMinedTx only contains its unique logic.
2018-07-16 13:39:50 -07:00
Wilmer Paulino
15cec7d90d
wtxmgr: add transaction replacement and double spend tests
In this commit, we add a set of double spend tests to ensure that we can
properly detect and handle them. At this point, we do not do this, but a
follow up commit will address this.
2018-07-16 13:39:49 -07:00
Olaoluwa Osuntokun
64b5b448f5 chain: update neutrino API usage 2018-07-13 16:53:17 -07:00
Olaoluwa Osuntokun
43244ccc61 build: update glide to point to latest neutrino 2018-07-13 16:53:17 -07:00