Commit graph

1306 commits

Author SHA1 Message Date
Olaoluwa Osuntokun
fbb3bc184d
wallet/txauthor: fix bug in dust calculation
In this commit, we fix a 3 year old bug in dust calculation. Before this
commit, the target fee of the transaction to be crafted would be used to
determine dust. If the target fee is very high, then this would cause
over all higher fees, as we'd base that dust computation off of that fee
rate, rather than the min relay fee.

To fix this, we always use the min relay fee at all times when computing
dust.
2020-08-13 16:43:00 -07:00
Olaoluwa Osuntokun
ca24ed58cf
Merge pull request #710 from cfromknecht/update-root-module-walletdb
build: update to latest walletdb and wtxmgr versions
2020-06-15 17:46:19 -07:00
Olaoluwa Osuntokun
1edb2b51c3
build: update to latest walletdb and wtxmgr versions 2020-06-15 16:20:30 -07:00
Olaoluwa Osuntokun
d68942b7f3
Merge pull request #709 from cfromknecht/bbolt-import-path
walletdb: eliminate old bbolt ref by using uniform import path
2020-06-15 16:16:57 -07:00
Olaoluwa Osuntokun
79727f4e6f
walletdb: eliminate old bbolt ref by using uniform import path 2020-06-15 14:24:49 -07:00
Olaoluwa Osuntokun
bf76ca145a
Merge pull request #708 from cfromknecht/fin-wallet-db-update
wtxmgr: update to walletdb v1.3.2
2020-06-15 14:16:54 -07:00
Olaoluwa Osuntokun
186417b824
wtxmgr: update to walletdb v1.3.2 2020-06-15 12:08:53 -07:00
Olaoluwa Osuntokun
3502b46b2d
Merge pull request #707 from cfromknecht/wallet-db-update
build: update to walletdb v1.3.2
2020-06-15 11:45:02 -07:00
Olaoluwa Osuntokun
6dd0b0d376
build: update to walletdb v1.3.2
In this commit, we update `walletdb` to the latest version which makes
it compatible with Go 1.14.
2020-06-15 11:29:28 -07:00
Olaoluwa Osuntokun
ea0fb843a0
Merge pull request #706 from cfromknecht/bbolt-bug-fix
walletdb: update to latest bbolt version w/ Go 1.14 bug fix
2020-06-15 11:27:18 -07:00
Olaoluwa Osuntokun
727ca139b8
walletdb: update to latest bbolt version w/ Go 1.14 bug fix 2020-06-15 11:17:46 -07:00
Olaoluwa Osuntokun
48addcd559
Merge pull request #705 from wpaulino/bitcoind-20-compat
wallet: handle new error string for missing/spent input in bitcoind 0.20
2020-06-11 18:25:34 -07:00
Wilmer Paulino
2bd41b9dd1
wallet: handle new error string for missing/spent input in bitcoind 0.20
The error string was updated in:

3004d5a12d
2020-06-09 12:46:36 -07:00
Olaoluwa Osuntokun
6390f167e5
Merge pull request #703 from wpaulino/genesis-block-timestamp-sync-info
waddrmgr: set timestamp for genesis block sync info
2020-06-03 17:53:47 -07:00
Wilmer Paulino
6aa23a2389
waddrmgr: set timestamp for genesis block sync info
Not setting this would result in a non-sensible unix timestamp
(2288912640) being exposed when the wallet hasn't synced any blocks,
like in the case when it's waiting for the backend to sync.
2020-06-01 12:51:58 -07:00
Olaoluwa Osuntokun
c52dcaf17c
Merge pull request #700 from wpaulino/persistent-output-locking
wallet: introduce persistent output leases
2020-05-29 15:48:44 -07:00
Wilmer Paulino
0f2b15bb4d
wallet: expose persistent output leases 2020-05-28 17:53:50 -07:00
Wilmer Paulino
c42130075c
wtxmgr: introduce persistent output leases
This commit allows for the ability to lease an output to a particular ID
for a limited amount of time, ensuring that no other processes can use
said output for their coin selection needs. An output can either be
unlocked manually, or lazily whenever required.
2020-05-28 17:53:49 -07:00
Olaoluwa Osuntokun
43c9c2e2f7
Merge pull request #702 from carlaKC/dropwtxmgr-keeplabels
dropwtxmgr: add drop labels option
2020-05-28 16:07:41 -07:00
carla
338cf08088
dropwtxmgr: keep tx labels, with an optional DropLabels flag 2020-05-28 09:09:15 +02:00
carla
ab19740c94
wtxmgr: extract label deserialization into separate function
Requrired so that we can use the same logic in dropwtxmgr.
2020-05-28 09:07:31 +02:00
carla
4ec3fb4928
wtxmgr: separate PutTxLabel into store-independent function
Separate out the logic we use to write labels so that it can be used
in dropwtxmgr to re-add labels if we want to keep them when we drop the
rest of the db.
2020-05-27 14:54:25 +02:00
Olaoluwa Osuntokun
e0e62245ec
Merge pull request #699 from wpaulino/btcd-dep-update
build: update to latest btcd version
2020-05-15 15:49:13 -07:00
Wilmer Paulino
17c23a9266
build: update to latest btcd version 2020-05-14 15:43:23 -07:00
Wilmer Paulino
ce888ed941
wallet: use GetBlockHeaderVerbose to retrieve block heights in GetTransactions
There's no need to retrieve the full block as we're only interesting in
retrieve its corresponding height, which can be done with
GetBlockHeaderVerbose.
2020-05-14 15:43:03 -07:00
Olaoluwa Osuntokun
b07494fc2d
Merge pull request #696 from carlaKC/txn-labels
wtxmgr: add labels to transactions
2020-05-11 17:12:28 -07:00
carla
212575f7d1
wallet: add label transaction function
Add function which allows you to retrospectively label a transaction,
optionally overwriting the existing label.
2020-05-11 15:19:42 +02:00
carla
3465d2ecc6
wallet/test: extract testWallet generation into separate function 2020-05-11 15:18:38 +02:00
carla
3809a6d553
wallet: add transaction label to transaction summary 2020-05-11 15:18:34 +02:00
carla
f852d2f991
wtxmgr: add transaction label to TxDetails 2020-05-11 15:18:15 +02:00
carla
9aed49070d
wtxmgr: update rangeBlockTransactions to use minedTxDetails
Code is duplicated across these two functions, so update
rangeBlockTransactions to use minedTxDetails. When iterating through
a block, we do have the block metadata already (which is looked up by
minedTxDetails). This change can be further optimized to split
minedTxDetails into minedTxDetails and minedTxDetailsWithoutBlock to
reduce this redundancy.
2020-05-11 15:18:06 +02:00
carla
9e2f2ce157
wallet: add label parameter to SendOutputs 2020-05-11 15:17:55 +02:00
carla
d2f9185f6a
wallet: add label to PublishTransaction
All label parameter to PublishTransaction. Pass in an empty string
in rpc call as a placeholder for follow up PR which will add a label
parameter to the PublishTransaction request.
2020-05-11 15:16:22 +02:00
carla
50869085eb
wtxmgr: add put and fetch functions for optional transaction label
Add and test functions which can be used to write optional transaction
labels to disk in their own bucket. These labels are keyed by txid and
write the labels to disk using-length value encoding scheme. Although
the length field is not required at present, it is added to allow future
extensibility without a migration.

This approach is chosen over adding this information to txRecords,
Because a migration would be required to add a field after the variable
Length serialized tx.

The put label function will overwrite existing labels if called more
than once for the same txid. User side validation of whether we want
to override this label should be performed by calling code. Labels must
be > 0 characters and <= 500 characters (an arbitrarily chosen limit).
2020-05-11 15:16:11 +02:00
Dev Random
4c5bc1b15d
waddrmgr: create watch-only address managers and accounts
This PR allows the creation of managers and accounts that are watch-only. The state of the database after creation would be identical to the state after calling 

Manager.ConvertToWatchingOnly, assuming accounts with the right xpubs were created in the former case.

Co-authored-by: Ken Sedgwick <ken@bonsai.com>
2020-04-24 17:44:21 -07:00
Olaoluwa Osuntokun
ada7ca077e
Merge pull request #691 from wpaulino/pin-walletdb-v1.3.1
build: pin to walletdb v1.3.1
2020-04-03 15:22:02 -07:00
Wilmer Paulino
d2ce512b4b
build: pin to walletdb v1.3.1 2020-04-03 15:08:07 -07:00
Olaoluwa Osuntokun
2fed914b79
Merge pull request #690 from wpaulino/walletdb-revert-bolt-v1.3.4
walletdb: revert bolt v1.3.4
2020-04-03 15:01:46 -07:00
Wilmer Paulino
57be08fbbf
Revert "walletdb: update to bolt v1.3.4"
The v1.3.4 version of the bolt module contained a bug fix to allow the
use of go1.14, but it uncovered a GC issue.
2020-04-03 14:18:22 -07:00
Wilmer Paulino
e51b4821ce
walletdb: use temp dir for db filepaths in tests 2020-04-03 14:13:53 -07:00
Olaoluwa Osuntokun
237a3ee772
Merge pull request #688 from wpaulino/neutrino-recovery-batch-filters
chain: batch filter fetches for neutrino chain client
2020-03-31 18:28:17 -07:00
Wilmer Paulino
90a0744ae4
chain: batch filter fetches for neutrino chain client
This greatly speeds up wallet recovery with a neutrino backend, as we'll
avoid unnecessary round trips for each block filter fetch.
2020-03-31 13:37:56 -07:00
Olaoluwa Osuntokun
60299130c6
Merge pull request #682 from wpaulino/scan-key-scopes
wallet: rescan and recover addresses in all relevant key scopes
2020-03-31 11:10:45 -07:00
Wilmer Paulino
31c027e19f
wallet: perform recovery on all registered key scopes
In similar fashion to the previous commit, due to a no longer existing
bug within the wallet, it was possible for change addresses to be
created outside of their intended key scope (the default), so wallets
affected by this now need to ensure upon recovery that they scan the
chain for _all_ existing key scopes, rather than just the default ones,
to reflect their proper balance. Through manual testing, it was shown
that the impact of recovering the additional key scopes is negligible in
most cases for both full nodes and light clients.
2020-03-30 15:35:50 -07:00
Wilmer Paulino
1285049923
wallet: include addresses from relevant key scopes in rescan
Due to a no longer existing bug within the wallet, it was possible for
change addresses to be created outside of their intended key scope (the
default), so wallets affected by this now need to ensure they scan the
chain for all addresses within the default key scopes (as expected), and
all _internal_ addresses (branch used for change addresses) within any
other registered key scopes to reflect their proper balance.
2020-03-30 15:35:49 -07:00
Wilmer Paulino
43e19da868
Revert "waddrmgr+wallet: only watch addresses within default key scopes"
The commit being reverted resulted in the discovery of a bug in which
change addresses could at times be created outside of the default key
scopes, causing us to not properly determine their spends.
2020-03-30 15:31:44 -07:00
Wilmer Paulino
60fce250f4
wallet: derive change addresses from the provided key scope
Previously, the wallet would determine the key scope to use for change
addresses by locating the one compatible with P2WPKH addresses, but this
wasn't always safe like in the case when multiple key scopes that
supported these addresses existed within the address manager, leading
the change address to be created outside of the intended key scope.
2020-03-30 15:30:53 -07:00
Olaoluwa Osuntokun
7b2cbe89f8
Merge pull request #686 from wpaulino/walletdb-upgrade
build: update to walletdb v1.3.0
2020-03-25 19:46:02 -07:00
Olaoluwa Osuntokun
ba45925bcb
build: update to walletdb v1.3.0 2020-03-25 18:53:31 -07:00
Olaoluwa Osuntokun
60327da210
Merge pull request #684 from wpaulino/bbolt-134
walletdb: update to bolt v1.3.4
2020-03-25 18:50:50 -07:00