Commit Graph

150 Commits

Author SHA1 Message Date
Olaoluwa Osuntokun
ad0ecc4d58
Merge pull request #5333 from wpaulino/incompatible-account-addr-type
lnwallet: check if requested address type is compatible with account
2021-05-27 19:06:13 -07:00
Wilmer Paulino
8745cf03c1
lnwallet: check if requested address type is compatible with account 2021-05-26 11:20:30 -07:00
Wilmer Paulino
798113a024
lnwallet: refactor common logic between NewAddress and LastUnusedAddress 2021-05-26 11:20:28 -07:00
Joost Jager
42f4afef75
multi: add random coin selection 2021-05-24 20:09:56 +02:00
Olaoluwa Osuntokun
7ab5906093
Merge pull request #5245 from bhandras/kvdb_module
kvdb: make kvdb a top level submodule to allow dependency in other projects
2021-05-13 15:59:20 -07:00
Andras Banki-Horvath
14c851c8fc
kvdb: move channeldb/kvdb to top level 2021-05-07 14:18:56 +02:00
Wilmer Paulino
994405709a
lnwallet: expose dry run support for ImportAccount 2021-05-06 19:04:21 -07:00
Andras Banki-Horvath
b6a620e6b2
misc: add ability to store the wallet in the remote DB 2021-05-04 17:33:11 +02:00
Elle Mouton
432b1f0588 btcwallet: lock blockcache for Neutrino GetBlock
This commit ensures that for the neutrino implementation of
lnwallet.BlockChainIO, the neutrino GetBlock method is called directly
(since it already uses the blockcache). It also ensures that the block
cache mutex for the given hash is locked before the call to GetBlock.
2021-04-28 09:46:11 +02:00
Elle Mouton
106f93a1b4 btcwallet: make blockcache available to BtcWallet
This commit makes the blockcache available to BtcWallet so that any
GetBlock call made to BtcWallet is wrapped by the blockcache GetBlock
call.
2021-04-28 09:46:11 +02:00
Tom Kirkpatrick
2f80283ec2
rpc: minConfs and spendUnconfirmed for EstimateFee 2021-04-22 20:35:51 +02:00
Tom Kirkpatrick
03b55446b5
refactor: use camel case for minConfs 2021-04-22 20:35:00 +02:00
Wilmer Paulino
2d163b788b
lnwallet: expose wallet import related methods to WalletController 2021-04-05 15:41:09 -07:00
Wilmer Paulino
f91e7cde59
lnwallet: expose optional account filter for several WalletController methods 2021-04-05 15:41:06 -07:00
Wilmer Paulino
f38bf4d7fa
lnwallet: expose required account parameter for WalletController methods 2021-04-05 15:41:05 -07:00
Wilmer Paulino
a620ce3682
build: update btcd and btcwallet dependencies 2021-04-05 15:41:04 -07:00
Joost Jager
9398220568 walletrpc: add ListLeases 2021-03-13 08:45:52 +01:00
Joost Jager
5ba0f8e355 lnwallet: bump btcwallet 2021-03-13 08:45:52 +01:00
Conner Fromknecht
1483ed119b
make: use low-scrypt to speed up unit-race
This predominately affects the lnwallet unit tests which are the bulk of
the execution time.
2020-12-10 17:42:26 -08:00
Yong
582b164c46
kvdb: add timeout options for bbolt (#4787)
* mod: bump btcwallet version to accept db timeout

* btcwallet: add DBTimeOut in config

* kvdb: add database timeout option for bbolt

This commit adds a DBTimeout option in bbolt config. The relevant
functions walletdb.Open/Create are updated to use this config. In
addition, the bolt compacter also applies the new timeout option.

* channeldb: add DBTimeout in db options

This commit adds the DBTimeout option for channeldb. A new unit
test file is created to test the default options. In addition,
the params used in kvdb.Create inside channeldb_test is updated
with a DefaultDBTimeout value.

* contractcourt+routing: use DBTimeout in kvdb

This commit touches multiple test files in contractcourt and routing.
The call of function kvdb.Create and kvdb.Open are now updated with
the new param DBTimeout, using the default value kvdb.DefaultDBTimeout.

* lncfg: add DBTimeout option in db config

The DBTimeout option is added to db config. A new unit test is
added to check the default DB config is created as expected.

* migration: add DBTimeout param in kvdb.Create/kvdb.Open

* keychain: update tests to use DBTimeout param

* htlcswitch+chainreg: add DBTimeout option

* macaroons: support DBTimeout config in creation

This commit adds the DBTimeout during the creation of macaroons.db.
The usage of kvdb.Create and kvdb.Open in its tests are updated with
a timeout value using kvdb.DefaultDBTimeout.

* walletunlocker: add dbTimeout option in UnlockerService

This commit adds a new param, dbTimeout, during the creation of
UnlockerService. This param is then passed to wallet.NewLoader
inside various service calls, specifying a timeout value to be
used when opening the bbolt. In addition, the macaroonService
is also called with this dbTimeout param.

* watchtower/wtdb: add dbTimeout param during creation

This commit adds the dbTimeout param for the creation of both
watchtower.db and wtclient.db.

* multi: add db timeout param for walletdb.Create

This commit adds the db timeout param for the function call
walletdb.Create. It touches only the test files found in chainntnfs,
lnwallet, and routing.

* lnd: pass DBTimeout config to relevant services

This commit enables lnd to pass the DBTimeout config to the following
services/config/functions,
  - chainControlConfig
  - walletunlocker
  - wallet.NewLoader
  - macaroons
  - watchtower
In addition, the usage of wallet.Create is updated too.

* sample-config: add dbtimeout option
2020-12-07 15:31:49 -08:00
Federico Bond
10d94f99c0
multi: move several wait group done calls to defer statements 2020-11-23 14:48:44 +01:00
Wilmer Paulino
1ad0dbade9
btcwallet: return chain best timestamp while backend is syncing
A while back, changes were made to the wallet such that it waits for the
backend to be synced before beginning to store the latest 10,000 blocks
of the chain. This inherently broke sync progress implementations based
on the best_header_timestamp result from the GetInfo RPC for
neutrino-based nodes as the wallet is no longer tracking all blocks in
the chain. To work around this, we now make sure to return the backend's
best header timestamp instead of the wallet's, allowing said sync
progress implementations to work again.
2020-10-19 13:57:30 -07:00
Oliver Gugger
f947576f33
lnwallet+mock: add new PSBT methods 2020-10-03 10:34:39 +02:00
Oliver Gugger
9f5f98e736
btcwallet: use new base wallet methods 2020-10-03 10:34:39 +02:00
Tom Kirkpatrick
73a5f325b6
lnrpc: ability to spend unconfirmed coins 2020-10-01 13:27:03 +01:00
Wilmer Paulino
a85c4feb17
btcwallet: skip unsupported addresses in ListTransasctionDetails
A transaction with an unsupported address would prevent the method from
returning any other transactions and would instead return an error.
2020-08-25 11:21:29 -07:00
yyforyongyu
987edc9d81 multi: add a rpc endpoint to track the recovery process 2020-06-25 15:49:54 +08:00
Wilmer Paulino
2a5b66ec00
lnwallet: note requirement of global coin selection lock 2020-06-12 11:22:30 -07:00
Wilmer Paulino
9d9e54f83e
btcwallet: ensure output isn't locked by in-memory impl in LeaseOutput
The current implementation of LeaseOutput already checked whether the
output had already been leased by the persisted implementation, but not
the in-memory one used by lnd internally. Without this check, we could
potentially end up with a double spend error if lnd acquired the UTXO
internally before the LeaseOutput call.
2020-06-12 11:22:28 -07:00
Wilmer Paulino
ae7335ce3b
lnwallet: expose output leases on WalletController interface 2020-06-03 18:49:39 -07:00
carla
baeef63aab
lnwallet: add label transaction to WalletController interface 2020-05-25 08:38:05 +02:00
Olaoluwa Osuntokun
53da66a6fc
Merge pull request #4302 from wpaulino/btcwallet-fetchinputinfo-bounds-check
btcwallet: add transaction outputs bounds check to FetchInputInfo
2020-05-21 17:22:25 -07:00
Wilmer Paulino
f287ac3cea
btcwallet: add transaction outputs bounds check to FetchInputInfo
This prevents a panic when providing an incompatible output index for
the transaction.
2020-05-20 11:42:12 -07:00
carla
e8ca306f12
lnrpc: display transaction label in transaction details 2020-05-19 13:31:51 +02:00
carla
099161ed0b
multi: add label to WalletController SendOutputs and dependent rpcs
Add a label parameter to the WalletController SendOutputs endpoint and
update rpcs that use it to allow optional provision of labels.
2020-05-19 13:31:51 +02:00
carla
75370ce6b4
multi: update WalletController PublishTransaction to include label
Add label parameter to PublishTransaction in WalletController
interface. A labels package is added to store generic labels that are
used for the different types of transactions that are published by lnd.

To keep commit size down, the two endpoints that require a label
parameter be passed down have a todo added, which will be removed in
subsequent commits.
2020-05-19 13:30:00 +02:00
Wilmer Paulino
0e3fc4c7a6
build: update to latest btcd and btcwallet versions
This update introduces backwards compatibility for btcd nodes running
versions prior to v0.20.1-beta.
2020-05-15 17:00:16 -07:00
carla
537dac3c62
multi: specify start and end height for ListTransactionDetails
Add start and end height parameters to the rpc and cli GetTransactions
endpoints. Default to returning all transactions from genesis to tip,
including unconfirmed transactions to maintain backwards compatibility.
2020-05-05 21:10:06 +02:00
Conner Fromknecht
0f94b8dc62
multi: return input.Signature from SignOutputRaw 2020-04-10 14:27:35 -07:00
Oliver Gugger
95a6796778
lnwallet/btcwallet: use fast scrypt options in itest 2020-03-24 09:52:40 +01:00
Olaoluwa Osuntokun
777ed104a3
chainfee: create new chainfee package extracting fees from lnwallet
In this commit, we create a new chainfee package, that houses all fee
related functionality used within the codebase. The creation of this new
package furthers our long-term goal of extracting functionality from the
bloated `lnwallet` package into new distinct packages. Additionally,
this new packages resolves a class of import cycle that could arise if a
new package that was imported by something in `lnwallet` wanted to use
the existing fee related functions in the prior `lnwallet` package.
2019-10-31 16:41:57 -07:00
Wilmer Paulino
194a9dea81
multi: support sync freelist option within btcwallet 2019-10-04 12:19:40 -04:00
Johan T. Halseth
61e1b48f57
lnwallet/btcwallet: check publication error types, handle replacement
error

Since btcwallet will return typed errors now, we can simplify the
matching logic in order to return ErrDoubleSpend.

In case a transaction cannot be published since it did not satisfy the
requirements for a valid replacement, return ErrDoubleSpend to indicate
it was not propagated.
2019-09-25 08:04:04 +02:00
Olaoluwa Osuntokun
5ecde6d552
lnwallet+chainntnfs: update to use latest neutrino APIs 2019-09-11 05:57:06 -07:00
Joost Jager
3d7de2ad39
multi: remove dead code 2019-09-10 17:21:59 +02:00
Wilmer Paulino
9e8a1707cc
lnwallet: modify FetchInputInfo to return additional information for utxos 2019-08-22 13:49:41 -07:00
Wilmer Paulino
c7bdfe149a
lnwallet/btcwallet: remove internal utxoCache
The cache wasn't really serving a purpose as FetchInputInfo isn't known
to be a hot path. Also, with a planned addition of returning the
confirmation status of an output within FetchInputInfo in a later
commit, caching won't be useful as we'll have to go to disk anyway to
determine the confirmation status.
2019-08-22 13:49:39 -07:00
Olaoluwa Osuntokun
cc4daa04ad
lnwallet: when signing create account if not found
In this commit, we address an edge case that can happen a user rescans
w/ their seed, while retaining their existing `channel.db`. Once they
rescan, if they go to sign for a channel sweep for example, the
commitment key family (actually an account) may not yet have been
created, causing the signing attempt to fail.

We remedy this always creating the account if we go to sign, and the
account isn't found. The change has been structured to make this the
exception, so we'll avoid always needing to do 2 DB hits (check if
account exists, sign), each time we sign.

A new test has been added to exercise this behavior. If the diff from
the `signer.go` file is removed, then the test will fail.
2019-08-20 19:08:03 -07:00
Yaacov Akiba Slama
f33df0928d Fill DestAddresses in unmined transactions 2019-07-10 09:38:27 +03:00
Olaoluwa Osuntokun
bd46491d07 lnwallet: fix key derivation for very first key in family
In this commit, we fix an existing bug that would cause us to be unable
to derive the very first key in a key family if the wallet hadn't
already derived it in the past. This can happen if a user keeps their
same `channel.db`, but restores their wallet resulting in fresh
`wallet.db` state.

This is an existing issue due to the fact that we don't properly
distinguish between an empty key locator, and the very first key in a
`KeyFamily`: `(0, 0)`. Atm, `KeyLoactor{0, 0}.IsEmpty() == True`,
causing us to be unable to retrieve this key in certain cases since we
fall through and attempt address based derivation.

In order to remedy this, we add a new special case (until we upgrade
`KeyLoactor` formats, but needed for legacy reasons) to _try_ a regular
`KeyLoactor` based derivation if we fail to derive via address, and this
is an "empty" key loc. This has been tested in the field and shown to
work, with the one downside that in this "hot swap restoration" case,
we'll hit the database twice to derive the key.
2019-07-08 17:08:39 -07:00