Commit graph

1504 commits

Author SHA1 Message Date
Olaoluwa Osuntokun
284e2e0e69
Merge pull request #578 from cfromknecht/go-modules
build: Update to go modules
2018-11-29 19:07:54 -08:00
Olaoluwa Osuntokun
d1aea1782f
build: for go modules for entire goclean.sh 2018-11-29 19:03:23 -08:00
Olaoluwa Osuntokun
b0f5763403
build: force go modules support in goclean.sh test execution 2018-11-29 18:54:58 -08:00
Olaoluwa Osuntokun
50095184c1
build: update travis build to use go modules, switch to go 1.11 2018-11-29 18:47:19 -08:00
Olaoluwa Osuntokun
25f864e62f
build: update goclean.sh to use go modules, not dep 2018-11-29 18:46:36 -08:00
Olaoluwa Osuntokun
20db88d8ff
walletdb/bdb: switch from bolt to bbolt
Fixes #545.
2018-11-29 18:43:37 -08:00
Olaoluwa Osuntokun
b523fd5274
buid: remove old glide build files 2018-11-29 18:42:53 -08:00
Olaoluwa Osuntokun
47cd06ad14
build: add new go.mod and go.sum files for gomodules 2018-11-29 18:42:34 -08:00
Conner Fromknecht
13796b496a
votingpool: nuke package
This commit removes the votingpool package, which is currently
unused as far as I'm aware.
2018-11-29 15:07:08 -08:00
Olaoluwa Osuntokun
7ad4f1e81d
Merge pull request #576 from wpaulino/birthday-block-candidate
wallet/chainntnfs: set height for new birthday block candidate
2018-11-20 15:37:25 -08:00
Wilmer Paulino
80450c9033
wallet/chainntfns: make birthdaySanityCheck return ErrBirthdayBlockNotSet 2018-11-20 13:00:45 -08:00
Wilmer Paulino
cc77e41198
wallet/chainntfns: set height for new birthday block candidate
In this commit, we address an issue that would cause users to be stuck
in an infinite loop by fetching the same candidate birthday block due to
its height not being updated if the sanity check was attempting to fix
an estimate in the future. We fix this by setting the new candidate
height so that new candidate blocks can be fetched and tested.
2018-11-19 20:48:14 -08:00
Wilmer Paulino
f92cc4db42
wallet/chainntfns_test: add birthdaySanityCheck tests 2018-11-19 20:48:14 -08:00
Wilmer Paulino
03a818efaa
wallet/chainntfns: remove wallet dependency from birthdaySanityCheck
In this commit, we remove the wallet dependency from the
birthdaySanityCheck function. Every interaction with the wallet is now
backed by two interfaces, birthdayStore and chainConn. These interfaces
will allow us to increase the test coverage of the birthdaySanityCheck
as now we'll only need to mock out only the necessary functionality.
2018-11-19 20:48:14 -08:00
Olaoluwa Osuntokun
55c7c63993
Merge pull request #575 from wpaulino/syncedto-rescan
wallet/wallet: prevent always rescanning from birthday block
2018-11-15 19:00:35 -08:00
Wilmer Paulino
bd95bfa6fb
wallet/wallet: prompt sanity check upon setting new birthday block within ImportPrivateKey
In this commit, we set the verified bit to false upon setting the new
birthday block to ensure its correctness as it was provided by the caller.
2018-11-15 18:17:56 -08:00
Wilmer Paulino
16ea72e95b
wallet/wallet: update to latest SetBirthdayBlock changes 2018-11-15 18:17:56 -08:00
Wilmer Paulino
f9df4908b3
wallet/chainntfns: prevent sanity check if correctness of birthday block has been verified
In this commit, we prevent any further sanity check attempts by the
wallet if its correctness has previously been verified. We do this to
ensure we don't unnecessarily attempt to find a new candidate.
2018-11-15 18:17:56 -08:00
Wilmer Paulino
7c377b2906
waddrmgr/sync: expose verification status in Manager's birthday block methods 2018-11-15 18:02:21 -08:00
Wilmer Paulino
6568c433fe
waddrmgr/db: store birthday block verification status
In this commit, we add a new key/value pair to the waddrmgr's sync
bucket to store the verification status of the birthday block. This
verification status determines whether the wallet has verified the
correctness of its birthday block through its sanity check on startup.
2018-11-15 18:01:19 -08:00
Wilmer Paulino
4f5baed780
wallet/wallet: prevent always rescanning from birthday block
In this commit, we address an issue with the wallet where it would
always request a rescan from the birthday block. This is very crucial
for older wallets, as it'll potentially go through thousands of blocks.
To address this, we'll now only request a rescan from our birthday if
we're recovering our wallet from our seed, the birthday block was rolled
back, or if we're performing our initial sync. Otherwise, we'll request
a rescan from tip.
2018-11-15 16:34:42 -08:00
Olaoluwa Osuntokun
4c01c0878c
Merge pull request #573 from wpaulino/notify-received
wallet: notify wallet upon relevant transaction confirmation
2018-11-14 18:39:41 -08:00
Wilmer Paulino
31011de227
wtxmgr+wallet: add wtxmgr sublogger 2018-11-14 18:09:10 -08:00
Wilmer Paulino
9d329e111e
wtxmgr/migrations: add drop transaction history migration
In this commit, we follow up our previous migration to reset our synced
block to our birthday block with another migration to drop our
transaction history. We'll need to do this to ensure that the
transaction store matches the exact state of our outputs on-chain to
prevent inadvertently crafting any invalid transactions.
2018-11-14 18:09:10 -08:00
Wilmer Paulino
a0a5e46177
wtxmgr/db: add new createBuckets and deleteBuckets methods 2018-11-14 18:09:10 -08:00
Wilmer Paulino
de4662e5df
wtxmgr: convert unit tests to be package-level
This allows us to reuse some of the existing code to test migrations of
the transaction store.
2018-11-14 18:09:10 -08:00
Wilmer Paulino
0424fd22ec
waddrmgr/migrations: add migration to force rescan from birthday block
In this commit, we add a migration to force a rescan of users' wallets
starting from their birthday block to ensure that their balance is
reflected correctly as it is on-chain. This was inspired by the recent
bug discovered where the wallet would not watch for the confirmation of
a relevant transaction.
2018-11-14 18:09:10 -08:00
Wilmer Paulino
ae31984630
wallet: request notification of tx confirmation that pays to relevant addr
In this commit, we address a slight regression within the wallet
that was introduced in a previous commit. When attempting to send coins
on-chain, we would never ask the chain backend to notify us of the
transaction upon confirmation. This, along with the rebroadcast of
unconfirmed transactions logic, would result in the wallet becoming out
of sync with the chain.

Below is an example of how this could have happened:

  1. Send funds on-chain.
  2. Wallet doesn't ask to be notified of the confirmation.
  3. Since the wallet is not notified of the confirmation, the
  transaction remains in the unconfirmed bucket, even though it might
  have already confirmed on-chain.
  4. Restart and trigger the rebroadcast of unconfirmed transactions.
  5. The unconfirmed transaction is removed from the unconfirmed bucket
  due to it already existing on-chain, without it being moved to the
  confirmed bucket. Moving to the confirmed bucket would require the
  block at which it confirmed, which we don't have at this point.
2018-11-14 18:06:26 -08:00
Wilmer Paulino
4976c84f8f
wallet/wallet: prevent logging resend tx error if already accepted into
mempool
2018-11-14 18:06:25 -08:00
Olaoluwa Osuntokun
ee93fa9871
Merge pull request #571 from wpaulino/birthday-blockstamp
wallet+waddrmgr: add migration & sanity check to populate birthday block
2018-11-14 18:05:49 -08:00
Wilmer Paulino
71ead8e3b4
wallet/wallet: commit birthday blockstamp upon initial sync/recovery 2018-11-14 17:24:00 -08:00
Wilmer Paulino
603e03de32
wallet/chainntnfs: add sanity check for birthday block before syncing
In this commit, we add a sanity check for the wallet's birthday block
before syncing as a result of the migration that populated it for
existing wallets. This is done as the second part to the migration to
ensure we do not miss any relevant events throughout rescans.

The sanity check performs two main checks: whether the birthday block
timestamp reflects a time before the birthday timestamp and whether the
delta between these two timestamps is a reasonable amount. The birthday
block is then found as the first candidate that satisfies both of these
conditions.
2018-11-14 17:24:00 -08:00
Wilmer Paulino
a25899eae7
waddrmgr/migrations: add migration to populate birthday block for existing wallets
In this commit, we add a new migration to the waddrmgr to populate the
birthday block for existing wallets. This will deem useful when
performing rescans for whatever reason, as we'll now be able to start
from this point rather than the genesis block, incurring a longer
rescan.

The migration is not as reliable since we do not store block timestamps,
so we'll need to estimate our height by looking at the genesis timestamp
and assuming a block occurs every 10 minutes. This can be unsafe, and
cause us to actually miss on-chain events, so a sanity check will be
added before the wallet attempts to sync itself in a later commit.
2018-11-13 19:37:08 -08:00
Wilmer Paulino
709fa17540
waddrmgr+wallet: add waddrmgr log to the wallet 2018-11-12 08:56:31 -08:00
Wilmer Paulino
61a2a8c391
waddrmgr/db: return ErrBlockNotFound if block doesn't exist 2018-11-12 08:56:31 -08:00
Wilmer Paulino
33629dcfc2
wallet/wallet: set birthday block when importing private key 2018-11-12 08:56:31 -08:00
Wilmer Paulino
e30cebea1b
waddrmgr/sync: add methods to Manager to get/set birthday block 2018-11-11 17:44:10 -08:00
Wilmer Paulino
e9d24382d6
waddrmgr/db: add birthday block within syncBucket
In this commit, we add a new key/value pair within the waddrmgr's
syncBucket that will represent the birthday block of the wallet. This
can then be used to force rescans from this point, rather than from the
genesis block.
2018-11-11 17:44:08 -08:00
Olaoluwa Osuntokun
9eec895db8
Merge pull request #570 from wpaulino/waddrmgr-package-level-tests
waddrmgr: convert unit tests to package-level tests
2018-11-08 10:48:39 +11:00
Wilmer Paulino
f2432b1a5e
waddrmgr: remove testing work-around for unexported vars
These work-arounds are no longer needed since the tests now have
package-level access.
2018-11-07 04:02:59 -08:00
Wilmer Paulino
fb91894a20
waddrmgr: remove ErrUpgrade check in TestManager in favor of test 2018-11-07 00:44:31 -08:00
Wilmer Paulino
c2d6f1a8b3
waddrmgr: convert unit tests to package-level tests
In this commit, we convert our unit tests to have package-level access.
We do this as an effort to reduce test code duplication when we
introduce migration tests which require access to specific unexported
functions/methods.
2018-11-07 00:44:27 -08:00
Olaoluwa Osuntokun
6d43b2e29b
Merge pull request #568 from joostjager/output-indices
wallet: return full tx from SendOutputs
2018-11-07 16:38:07 +11:00
Olaoluwa Osuntokun
ea4b832693
Merge pull request #567 from wpaulino/wtxmgr-migrations
wallet: add atomic migration logic for sub-buckets
2018-11-07 16:36:42 +11:00
Joost Jager
b718296188
wallet: return full tx from SendOutputs 2018-11-06 10:40:37 +01:00
Olaoluwa Osuntokun
69684e9091
Merge pull request #569 from wpaulino/import-priv-key-birthday
wallet/wallet: only set new birthday if before current within ImportPrivateKey
2018-11-06 14:29:38 +11:00
Wilmer Paulino
df36d100e5
wallet/wallet: only set new birthday if before current within
ImportPrivateKey

In this commit, we ensure that when an external private key is imported
into the wallet, that we do not overwrite our existing birthday with the
one provided. If this were to happen and we forced a wallet rescan using
the birthday as our starting point, then we'd miss detecting relevant
on-chain events that occurred between them.
2018-11-05 18:23:15 -08:00
Wilmer Paulino
105faf52cb
wallet/log: use migration logger 2018-11-05 17:58:16 -08:00
Wilmer Paulino
f582eab1fa
waddrmgr: remove old migration logic
In this commit, we remove the old upgrade/migration logic of the address
manager as it's been superseded by the new approach using the
migration.Manager interface.
2018-11-05 17:58:16 -08:00
Wilmer Paulino
2fb234c68f
wtxmgr: remove old migration logic
In this commit, we remove the old upgrade/migration logic of the
transaction manager as it's been superseded by the new approach using
the migration.Manager interface.
2018-11-05 17:58:16 -08:00