Commit graph

1151 commits

Author SHA1 Message Date
Wilmer Paulino
3bdfb6cc23
wtxmgr/db: define new helpers to set/get store version 2018-11-05 17:58:16 -08:00
Wilmer Paulino
1e582298b2
waddrmgr/db: remove LatestVersion const in favor of getLatestVersion
In this commit, we can remove the LatestVersion constant as it's no
longer needed. Instead, we'll now define the latest version as the last
entry in the slice of versions previously defined.
2018-11-05 17:58:16 -08:00
Wilmer Paulino
b05148bb8b
waddrmgr/migrations: move migration-related functions
This commit is strictly a code move to keep all migration-related things
within the same file.
2018-11-05 17:58:16 -08:00
Wilmer Paulino
3b4f73272f
waddrmgr/migrations: add migration.Manager implementation
In this commit, we add an implementation of the recently introduced
migration.Manager interface for the address manager. With this, we'll
now be able to only expose the things required for the migration to
happen, but have the actual migration logic live at a much higher level.

The existing versions defined are set up in the same way as the existing
upgrade/migration logic, which will end up being superseded by this and
removed in a later commit.
2018-11-05 17:58:16 -08:00
Wilmer Paulino
c01bbc4758
waddrmgr/db: remove unused pubPassPhrase arg from upgradeToVersion5 2018-11-05 17:58:16 -08:00
Wilmer Paulino
541ad708c7
walletdb/migration: add new migration package with Manager interface
In this commit, we add a new sub-package to the walletdb package:
migration. In this package, we define a new interface, Manager, which
will expose all of the necessary functions required to abstract the
migration logic of different sub-services within the wallet, like the
address and transaction managers. The implementations of this interface
will then be able to use the migration logic within the Upgrade
function with no additional complexity.
2018-11-05 17:58:16 -08:00
Olaoluwa Osuntokun
c4dd27e481
Merge pull request #541 from halseth/neutrino-recovery
Wait for neutrino filter headers
2018-10-16 18:53:32 -07:00
Johan T. Halseth
312baff46a
travis: update golint dep path 2018-10-16 18:43:02 -07:00
Johan T. Halseth
d791cb7c30
wallet: always wait for Neutrino IsCurrent during initial sync 2018-10-16 18:18:46 -07:00
Johan T. Halseth
060361939b
chain/neutrino: use new neutrino API 2018-10-16 18:18:46 -07:00
Johan T. Halseth
8705541e9a
glide: update neutrino dependency 2018-10-16 18:18:29 -07:00
Olaoluwa Osuntokun
29ee9442fe
Merge pull request #551 from wpaulino/fix-initial-sync-catchup
wallet: relax initial sync detection logic to speed up sync in case o…
2018-09-25 19:37:02 -07:00
Olaoluwa Osuntokun
fd0bac8e18
wallet: add godoc to publishTransaction 2018-09-25 19:19:20 -07:00
Olaoluwa Osuntokun
f7085cf1bf
wallet: relax initial sync detection logic to speed up sync in case of mid restart
In this commit, we relax the initial sync detection logic a bit. We do
this as right now, if a user creates an address during the sync point,
if they restart, then we'll fall back to performing a rescan from that
height as we'll detect that we aren't performing the initial sync, so
won't pick up the birthday timestamp.

To fix this, we now declare that if we have no UTXO's, then we're still
performing the initial sync. This solves this issue as when the user
restarts, we'll continue to wait for the backend to sync, and pick up
the proper birthday height before we attempt to scan forward for the
rescan. However, the one tradeoff is that we'll now always start the
rescan from the birthday height until the wallet has gained it's first
UTXO. I don't think this is too bad, as after all, the point of a wallet
is to manage utxos.
2018-09-25 19:19:04 -07:00
Olaoluwa Osuntokun
04340fd158
Merge pull request #549 from wpaulino/unify-send-outputs-publish-tx
wallet: unify SendOutputs + PublishTransaction logic
2018-09-25 19:15:48 -07:00
Olaoluwa Osuntokun
2922e4d37a
Merge pull request #548 from wpaulino/extend-remove-unmined-tx-test
wtxmgr/tx_test: extend TestRemoveUnminedTx to check balances
2018-09-25 19:07:58 -07:00
Wilmer Paulino
427e497498
wtxmgr/tx_test: extend TestRemoveUnminedTx to check balances
In this commit, we extend TestRemoveUnminedTx to also account for
checking the store's total balance (confirmed and unconfirmed). It
currently ensures that the UTXO state is correct, but as a sanity check,
we'll also ensure that balances are properly updated.
2018-09-20 19:12:34 -07:00
Wilmer Paulino
db51e8b8de
wallet/wallet: use publishTransaction within SendOutputs 2018-09-20 19:04:30 -07:00
Wilmer Paulino
c125b59df4
wallet/wallet: refactor PublishTransaction to use unexported method
In this commit, we refactor the logic outside of PublishTransaction into
another unexported method. This will pave the road for unifying the
logic between SendOutputs and PublishTransaction.
2018-09-20 18:59:02 -07:00
Wilmer Paulino
06e70c0f08
wallet/wallet: use addRelevantTx when publishing transactions
In this commit, we simplify the logic when broadcasting transactions to
the greater network. Rather than special casing when running with a
Neutrino backend, we'll always add the transaction to the store as
relevant when attempting to broadcast it. This will properly insert it
into the store and update unconfirmed balances. In the event that the
transaction failed to broadcast, it can be removed from the store with
no side-effects, essentially acting as if the transaction was never
added to the store in the first place.
2018-09-20 18:58:34 -07:00
Olaoluwa Osuntokun
421298df22
Merge pull request #542 from wpaulino/bitcoind-client-birthday
chain+wallet: set bitcoind client birthday after wallet init
2018-09-12 20:41:30 -07:00
Olaoluwa Osuntokun
54a82426c8
Merge pull request #543 from Roasbeef/neutrino-ntfn
wallet: allow SendOutputs to notify new outgoing transactions for neu…
2018-09-12 20:21:40 -07:00
Olaoluwa Osuntokun
0cfe15c0c7
wallet: allow SendOutputs to notify new outgoing transactions for neutrino
In this commit, we modify the SendOutputs method to also notify new
outgoing transctions for neutriino. For the full node backends, they'll
get this notification when the transactino hits the mempool. However,
for neutrino it will only be notified once the transaction has been
confirmed. This commit ensures that we'll notify on send as well.
2018-09-12 19:25:06 -07:00
Wilmer Paulino
ed47296c88
wallet: set chain client birthday after the wallet has been initialized 2018-09-12 14:25:11 -07:00
Wilmer Paulino
1ddb9f2c11
chain: allow setting the client's birthday after creation 2018-09-12 14:24:30 -07:00
Olaoluwa Osuntokun
f4ae41ce5f
Merge pull request #540 from wpaulino/avoid-notifying-txs-not-found
wallet/chainntfns: avoid notifying txs if not found within the wallet
2018-09-06 20:09:02 -07:00
Wilmer Paulino
aca9bebfab
wallet/chainntfns: avoid notifying txs if not found within the wallet
In this commit, we avoid notifying clients of transactions that we've
received chain.RelevantTx notifications for, but are not found within
the wallet. This can happen as now we'll prevent adding an unconfirmed
transaction to the wallet that already exists as confirmed. Due to this,
UniqueTxDetails will be unable to find the transaction and return nil,
casuing a panic for potential callers.
2018-09-06 19:42:13 -07:00
Olaoluwa Osuntokun
8ae4afc701
Merge pull request #536 from cfromknecht/birthday-block-rescan
wallet: start initial rescan from birthday block
2018-09-03 18:05:40 -07:00
Olaoluwa Osuntokun
0059b9fcd9
Merge pull request #537 from cfromknecht/dont-print-rawtx-garbage
chain/bitcoind_conn: only print ASCII rawtx event types
2018-09-03 17:55:49 -07:00
Olaoluwa Osuntokun
d14d889e88
Merge pull request #535 from cfromknecht/notify-addrs-after-db-commit
wallet/wallet: notify addrs+props after db commit
2018-09-03 17:42:28 -07:00
Olaoluwa Osuntokun
d2db08afc9
Merge pull request #534 from wpaulino/multiple-output-entries
wtxmgr: resolve duplicate entries for outputs within bucketUnspent
2018-09-03 17:37:34 -07:00
Olaoluwa Osuntokun
09d3730f35
Merge pull request #532 from wpaulino/remove-extra-reconnection-logic
chain/rpc: remove unnecessary ping keep alive
2018-09-03 17:14:59 -07:00
Conner Fromknecht
0c5c8d7f9e
wallet/wallet: start initial rescan from birthday block 2018-08-31 16:49:11 -07:00
Conner Fromknecht
042d409236
chain/bitcoind_conn: only print ASCII rawtx event types 2018-08-31 16:31:29 -07:00
Conner Fromknecht
e508a127b6
wallet/wallet: notify addrs+props after db commit
This PR moves any address notifications outside of the
db transaction that creates them. This is known to have
resulted in deadlocks, since chainClient.NotifyReceived
could block the db transaction from committing.

Doing so also prevents the situation where we send
notifications about the new addresses, but the db txn
fails to commit and the addresses are in fact never
created.
2018-08-31 16:30:39 -07:00
Conner Fromknecht
85c75de4a5
waddrmgr/manager_test: use SetSecretKeyGen to safely swap keygen 2018-08-31 16:29:55 -07:00
Conner Fromknecht
644fd2bda0
waddrmgr/internal_test: remove TstRunWithReplacedSecretKey 2018-08-31 16:29:55 -07:00
Conner Fromknecht
ba58d5357f
waddrmgr/manager: guard access to newSecretKey
This commit places a mutex around calls to newSecretKey,
since the inner function needs to be swapped out
during testing. Prior to this change, the race
detector would panic since the mutation was
unprotected.
2018-08-31 16:29:54 -07:00
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
Wilmer Paulino
989a81eb24
wtxmgr/query_test: remove duplicate hash test case
In this commit, we remove the duplicate test case from TestStoreQueries
as we'll no longer allow storing a transaction as unconfirmed if it's
already confirmed.
2018-08-29 17:10:41 -07:00
Wilmer Paulino
4a7f2c1078
wtxmgr/query_test: remove t.Fatal calls within db transactions in TestStoreQueries 2018-08-29 17:10:40 -07:00
Wilmer Paulino
fbe82c3531
wtxmgr: check existing unspent outputs before adding the credit
In this commit, we resolve a lingering bug within the wallet where it's
possible that an output is added as unconfirmed credit after the fact
that it has already confirmed. This would lead to duplicate entries for
the same output within the wallet causing double spend transactions to
be crafted.
2018-08-29 17:10:40 -07:00
Wilmer Paulino
98f65ac943
wtxmgr/tx_test: add test case for duplicate outputs within the store
In this commit, we add a new test case to the wtxmgr store to ensure
that duplicate outputs don't exists within the store. It's possible for
this to happen if an output is marked as unconfirmed credit, then marked
as confirmed once it confirms, and once again marked as unconfirmed. It
can be marked as unconfirmed again due to the backend notifying the
client about this transaction. Ideally this should not happen, but the
root cause is much more involved. As a stop gap, we'll ensure that
outputs can be marked as unconfirmed credits more than once whatsoever.
As is, the test case fails, which proves that this is an issue. A later
commit will resolve this and the test case should pass.
2018-08-29 17:10:39 -07:00
Wilmer Paulino
a71881aed8
wtxmgr/tx_test: move store teardown after error check 2018-08-29 17:10:38 -07:00
Wilmer Paulino
d179c276b4
chain/rpc: remove unnecessary ping keep alive
In this commit, we remove the keep-alive logic within the handler of the
RPCClient struct as this logic already exists within the backing
rpclient.Client instance. In this case, we'd completely stop the
connection after the ping timeout (1 min), which would render the
reconnection logic within rpcclient.Client useless.
2018-08-27 17:25:16 -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