Commit Graph

11673 Commits

Author SHA1 Message Date
Oliver Gugger
ea4ef204a0
rpcserver: add router synced to synced_to_chain flag
The router has a lot of work to do for each block. So it might be
possible that it isn't yet up to date with the most recent block,
even if the wallet is. This can happen in environments with high CPU
load (such as parallel itests). Since the `synced_to_chain` flag in
the response of this call is used by many wallets (and also our
itests) to make sure everything's up to date, we add the router's
state to it. So the flag will only toggle to true once the router was
also able to catch up.
2021-05-10 16:46:28 +02:00
Oliver Gugger
9f0228b21c
router: add SyncedHeight() method
The router subsystem has its own goroutine that receives chain updates
and then does its (quite time consuming) work on each new block. To make
it possible to find out what block the router currently is synced to, we
export its internal best height through a new method.
2021-05-10 16:46:27 +02:00
Johan T. Halseth
6f2f23aae6
Merge pull request #5284 from yuki-js/master
lnrpc: Change State -> state in GetState
2021-05-10 10:41:09 +02:00
yuki-js
241f62fbb6 lnrpc: Change State -> state in GetState
protobuf and rest field's first letter should be lower case
2021-05-09 22:50:10 +00:00
Wilmer Paulino
e079a9583c
walletrpc: use bytes to represent master key fingerprint
The integer representation is not common and using bytes allows users to
easily confirm whether their master key fingerprint is correct.
2021-05-07 13:07:10 -07:00
Wilmer Paulino
f7b130b5ca
lncli: add dry run flag for wallet account import command 2021-05-07 13:07:10 -07:00
Wilmer Paulino
e180023843
walletrpc: expose dry run support for ImportAccount 2021-05-07 13:06:27 -07:00
Olaoluwa Osuntokun
1868c7dec1
Merge pull request #5231 from Crypt-iQ/unsigned_ack_patch_04212021
lnwallet: use tail not tip in getUnsignedAckedUpdates
2021-05-07 12:46:48 -07:00
Juan Pablo Civile
a10c96a63b htlcswitch: set sourceRef when resolving packets through interceptor
Having it set to nil caused https://github.com/lightningnetwork/lnd/issues/5115

The problem was several layers removed from the fix. The link decides to
clean up a `fwdPkg` only if it's completed, otherwise it renotifies the
HTLCs. A package is only set to complete if it's `addAck` and
`settleFail` filters are full. For forwarded HTLCs, the `addAck` was
never being set so it would never be considered complete under this
criteria.

`addAck` is set for an HTLC when signing the next commitment TX in the
`LightningChannel`. The path for this is:
* `LightningChannel#SettleHtlc` adds the HTLC to `localUpdates`
* `LightningChannel#SignNextCommitment` builds the `ackAddRef` for all
updates with `SourceRef != nil`.
* `LightningChannel#SignNextCommitment` then passes the list of
`ackAddRef` to `OpenChannel#AppendRemoteCommitChain` to persist the new
acks in the filter

Since `SourceRef` was nil for interceptor packages, `SignNextCommitment`
ignored it and the ack was never persisted.
2021-05-07 10:31:22 -03:00
Andras Banki-Horvath
3c6f036bee
kvdb: make lnd/kvdb a submodule 2021-05-07 14:18:57 +02:00
Andras Banki-Horvath
14c851c8fc
kvdb: move channeldb/kvdb to top level 2021-05-07 14:18:56 +02:00
Johan T. Halseth
b1d9525d29
Merge pull request #5269 from bhandras/healthcheck_module
kvdb: separate healthcheck module
2021-05-07 14:05:48 +02:00
Johan T. Halseth
a8d813a4e5
Merge pull request #5277 from guggero/neutrino-update
mod: bump neutrino dep to latest version
2021-05-07 13:56:55 +02:00
Johan T. Halseth
2f99cd7ba1
Merge pull request #5268 from yyforyongyu/fix-whitelist
trivial: update log_error_whitelist
2021-05-07 13:56:21 +02:00
Johan T. Halseth
683a3f952a
Merge pull request #5275 from halseth/mod-update-btcd
mod: update btcd to latest master
2021-05-07 13:55:39 +02:00
Johan T. Halseth
99c609c1a8
mod: update btcd to latest master 2021-05-07 11:36:46 +02:00
yyforyongyu
270984b7d5
trivial: update log_error_whitelist 2021-05-07 13:20:54 +08:00
Wilmer Paulino
994405709a
lnwallet: expose dry run support for ImportAccount 2021-05-06 19:04:21 -07:00
Wilmer Paulino
64699d8538
build: update btcwallet dependency with dry run account import support 2021-05-06 19:00:32 -07:00
Conner Fromknecht
6e5ccb4efb
Merge pull request #5229 from halseth/breacharbiter-twoway-handoff
breacharbiter<->chainwatcher two-way handoff
2021-05-06 16:17:03 -07:00
Oliver Gugger
10eb52909b
mod: bump neutrino dep to latest version
We update the Neutrino dependency to the latest version that fixed a
struct alignment and several loop variable as pointer issues found by
the linter.
2021-05-06 22:55:12 +02:00
Johan T. Halseth
ac49031396
chainwatcher: only continue breach handling after successfully marked
closed

This commit makes the handoff procedure between the breachabiter and
chainwatcher use a function closure to mark the channel pending closed
in the DB. Doing it this way we know that the channel has been markd
pending closed in the DB when ProcessACK returns.

The reason we do this is that we really need a "two-way ACK" to have the
breacharbiter know it can go on with the breach handling. Earlier it
would just send the ACK on the channel and continue. This lead to a race
where breach handling could finish before the chain watcher had marked
the channel pending closed in the database, which again lead to the
breacharbiter failing to mark the channel fully closed.

We saw this causing flakes during itests.
2021-05-06 12:37:11 +02:00
Johan T. Halseth
bdc1f3100d
breachabirter+contraccourt: convert ProcessACK to function closure 2021-05-06 12:37:11 +02:00
Oliver Gugger
d13fb16608
docs: add wallet management doc, fix markup in INSTALL doc
To give users an idea how the new auto-unlock flag can be used in a more
safe way than just writing the password to a file, we add a new wallet
management document and describe the unlock feature in detail.
2021-05-06 12:23:46 +02:00
Oliver Gugger
571d00b32c
config+lnd: add wallet-unlock-password-file option
In automated or unattended setups such as cluster/container
environments, unlocking the wallet through RPC presents a set of
challenges. Usually the password is present as a file somewhere in the
container already anyway so we might also just read it from there.
2021-05-06 10:07:04 +02:00
Oliver Gugger
8224de599b
walletunlocker: extract LoadAndUnlock
As a preparation to do auto-unlock without the unlock RPC, we extract
the relevant part into its own method in the unlocker service.
2021-05-06 10:07:00 +02:00
Olaoluwa Osuntokun
4685341dcb
Merge pull request #5227 from Roasbeef/spent-channs-zombie-index
routing: add chans rejected due to failed chain validation to zombie index
2021-05-05 18:32:13 -07:00
Andras Banki-Horvath
ad586c6bf1
healthcheck: separate lnd/healthcheck into submodule 2021-05-05 15:33:19 +02:00
Andras Banki-Horvath
cee832b749
healthcheck: disable default healthcheck logger
Disable logging by default in the healthcheck submodule to cut
dependency on lnd/build as we are hooking the logger separately
during lnd init.
2021-05-05 15:33:14 +02:00
Olaoluwa Osuntokun
6d66133459
Merge pull request #4998 from bhandras/leader_election
cluster: leader election using etcd backend
2021-05-04 20:05:02 -07:00
Olaoluwa Osuntokun
9d9f420da5
Merge pull request #5246 from joostjager/router-best-height
routing: no backend call to fetch best block
2021-05-04 19:27:37 -07:00
Conner Fromknecht
af289a180c
Merge pull request #5258 from wpaulino/validation-barrier-err-deadlock
routing: return err on validation barrier failure of network update
2021-05-04 10:44:08 -07:00
Andras Banki-Horvath
dd14947154
lint: silence depreciation warnings 2021-05-04 17:33:14 +02:00
Andras Banki-Horvath
80bc46e614
lint: fix proto message no-copy linter warnings 2021-05-04 17:33:14 +02:00
Andras Banki-Horvath
9aacc35989
lnrpc: add GetState to stateservice (v1/state)
This commit adds a new GetState call to the state service in order to
make leader election integrate simply with k8s using a readinessProbe.
2021-05-04 17:33:13 +02:00
Andras Banki-Horvath
7caf26ce94
itest: add itest for failover after forcefull shutdown 2021-05-04 17:33:12 +02:00
Andras Banki-Horvath
5d8488871c
itest: basic failover itest when using leader election on etcd 2021-05-04 17:33:12 +02:00
Andras Banki-Horvath
5e215a7a66
lnrpc: add "waiting to start" state to state service
This commit adds a new "waiting to start" state which may be used to
query if we're still waiting to become the cluster leader. Once leader
we advance the state to "wallet not exist" or "wallet locked" given
wallet availablity.
2021-05-04 17:33:11 +02:00
Andras Banki-Horvath
b6a620e6b2
misc: add ability to store the wallet in the remote DB 2021-05-04 17:33:11 +02:00
Andras Banki-Horvath
08be03367a
walletunlocker: extract method to create the Loader 2021-05-04 17:33:10 +02:00
Andras Banki-Horvath
c190c3d582
etcd: update etcd to 3.4.14 2021-05-04 17:33:09 +02:00
Andras Banki-Horvath
e5f249ad51
mod: integrate latest btcwallet and bump protobuf and grpc 2021-05-04 17:33:09 +02:00
Andras Banki-Horvath
d161b34ee5
lnd: integrate leader elector to lnd main
This commit also changes the order of DB init to be run after the RPC
server is up. This will allow us to later add an RPC endpoint to be used
to query leadership status.
2021-05-04 17:33:08 +02:00
Andras Banki-Horvath
41532ce634
cluster: add etcd based leader elector and factory 2021-05-04 17:33:07 +02:00
Andras Banki-Horvath
e62dbca11a
cluster: add cluster package skeleton and LeaderElector interface 2021-05-04 17:33:07 +02:00
Andras Banki-Horvath
282618441d
etcd: do not try authenticate when using embedded 2021-05-04 17:33:06 +02:00
Andras Banki-Horvath
5441c1bb6d
etcd: fix embbeded etcd connection cfg 2021-05-04 17:33:06 +02:00
Andras Banki-Horvath
9992e5c0b5
etcd: decouple embedded etcd instance startup
This refactor changes how we instantiate the etcd based Backend to allow
separate initialization and startup for the embedded instance.
2021-05-04 17:33:05 +02:00
Andras Banki-Horvath
6757e14998
etcd: refactors to simplify etcd configuration
This refactor removes a redundancy where we had etcd configuration under
kvdb and kvdb/etcd packages.
2021-05-04 17:33:04 +02:00
Andras Banki-Horvath
44e312ace9
etcd: remove (unused) etcd root bucket prefix
This commit removes the unused prefix from the etcd backend config as
etcd key space separation in LND is implemented by using namespaces
instead.
2021-05-04 17:32:59 +02:00