Commit Graph
100 Commits
Author SHA1 Message Date
Wilmer Paulino bed485f0a9 Merge pull request #3194 from halseth/listpayments-test-on-chain-settle
[integration tests]: restart Alice after on-chain settle
2020-01-28 17:29:23 -08:00
Wilmer Paulino 57b69e3b1a discovery: check ChainHash in QueryChannelRange messages
If the provided ChainHash in a QueryChannelRange message does not match
that of our current chain, then we should send a blank response, rather
than reply with channels for the wrong chain.
2020-01-17 11:51:09 -08:00
Wilmer Paulino 9a7f66f2f7 peer: modify ReplyChannelRange log message
The message now shows the block range the reply spans, which is a lot
more useful.
2020-01-06 14:03:19 -08:00
Wilmer Paulino 1bacdfb41e discovery: interpret block range from ReplyChannelRange messages
We move from our legacy way of interpreting ReplyChannelRange messages
which was incorrect. Previously, we'd rely on the Complete field of the
ReplyChannelRange message to determine when our peer had sent all of
their replies. Now, we properly adhere to the specification by
interpreting the block ranges of these messages as intended.

Due to the large number of nodes deployed with the previous method, we
still maintain and detect when we are communicating with them, such that
we are still able to sync with them for backwards compatibility.
2020-01-06 14:03:13 -08:00
Wilmer Paulino d688e13d35 discovery: remove unnecessary test check
It's not possible to send another reply once all replies have been sent
without another request. The purpose of the check is also done within
another test, TestGossipSyncerReplyChanRangeQueryNoNewChans, so it can
be removed from here.
2020-01-06 14:02:31 -08:00
Wilmer Paulino c4723ce3db lnwire: add LastBlockHeight method to QueryChannelRange 2020-01-06 14:00:16 -08:00
Wilmer Paulino c7c0853531 discovery: cover requested range in ReplyChannelRange messages
In order to properly adhere to the spec, when handling a
QueryChannelRange message, we must reply with a series of
ReplyChannelRange messages, that when consumed together cover the
entirety of the block range requested.
2020-01-06 14:00:15 -08:00
Wilmer Paulino 1f781ea431 discovery: use inclusive range in FilterChannelRange
FilterChannelRange takes an inclusive range, so it was possible for us
to return channels for an additional block that was not requested.
2020-01-06 14:00:14 -08:00
Wilmer Paulino 9216ef2cd7 Merge pull request #3855 from cfromknecht/sorted-policies
routing/pathfind_test: construct sorted edge policies
2019-12-20 10:27:28 -08:00
Wilmer Paulino 7f3771e74f Merge pull request #3796 from carlaKC/3786-setupfrontshutdown
Add Upfront Shutdown Address to OpenChannelRequest
2019-12-18 11:28:29 -08:00
Wilmer Paulino 1fb28b6cd9 Merge pull request #3745 from akovalenko/master
lncli addholdinvoice: allow specifying msat with --amt_msat
2019-12-13 10:45:16 -08:00
Wilmer Paulino 3c6be62b18 Merge pull request #3702 from carlaKC/lnrpc-addcloseaddress
Add optional close address
2019-12-10 13:01:45 -08:00
Wilmer Paulino d01feb516f Merge pull request #3813 from ellemouton/add-space-in-log-message
bitcoindnotify: add missing space in log message in bitcoind.go
2019-12-10 12:29:05 -08:00
Wilmer Paulino 9484287f1f Merge pull request #3815 from alexbosworth/patch-13
trivial: typo fix
2019-12-10 11:14:29 -08:00
Wilmer Paulino 75dbfba4ec lntest: lower cpfp fee due to new bitcoind max fee restriction 2019-11-25 12:40:01 -08:00
Wilmer Paulino 44fa28b27b build: bump travis bitcoind version to 0.19.0.1 2019-11-25 10:59:00 -08:00
Wilmer Paulino 0c83a066e9 Merge pull request #3754 from dennisreimann/patch-1
Document setting multiple tlsextra entries
2019-11-22 10:41:22 -08:00
Wilmer Paulino 29f12411cd Merge pull request #3732 from Crypt-iQ/router_race_1115
routing: fix race condition when resuming payments
2019-11-18 11:06:18 -08:00
Wilmer Paulino 11a031c34b Merge pull request #3726 from halseth/chainntfs-test-spend-during-rescan
[test only] add TestTxNotifierSpendDuringHistoricalRescan
2019-11-14 09:38:28 -08:00
Wilmer Paulino 9587a2259f lnwallet: fix test inconsistencies to support bitcoind 0.19.0
bitcoind's sendrawtransaction API in v0.19.0 now enforces a maximum fee
rate of 0.1 BTC/kb and valid output scripts.
2019-11-12 20:34:37 -08:00
Wilmer Paulino b33a229457 build: bump btcsuite and neutrino dependencies to latest tagged versions
The btcwallet update includes some edge-case wallet bug fixes and an
optimization on ZMQ connections for bitcoind backends.

The btcd update allows for compatibility with bitcoind v0.19.0 backends.
2019-11-12 20:34:35 -08:00
Wilmer Paulino 9c454e9c6f Merge pull request #3704 from halseth/neutrino-dep-update
mod: update neutrino dep
2019-11-11 13:20:38 -08:00
Wilmer Paulino e1dd2a88e3 Merge pull request #3699 from Crypt-iQ/macaroon_store_race_1109
macaroons: add encKeyMtx to prevent race condition
2019-11-11 11:44:06 -08:00
Wilmer Paulino b0dc3b76fd Merge pull request #3661 from guggero/deprecate-rest-string
proto: deprecate duplicate string fields in requests
2019-11-07 10:52:45 -08:00
Wilmer Paulino 2bec35a3d2 Merge pull request #3687 from joostjager/wallet-binding-fix
lnwallet: fix loop binding bug
2019-11-07 10:49:18 -08:00
Wilmer Paulino 211eb4d472 Merge pull request #3518 from halseth/make-default-backend
[trivial] make: default backend variable to btcd
2019-11-05 15:42:46 -08:00
Wilmer Paulino 13b56d5849 Merge pull request #3632 from wpaulino/server-not-active-closechannel
rpcserver: ensure server has started before CloseChannel
2019-10-28 17:01:21 -04:00
Wilmer Paulino a469d5dc2c Merge pull request #2327 from ottosuess/invoice_macaroon_permissions
lnrpc: allow invoice.macaroon to read onchain transactions
2019-10-24 12:15:16 -04:00
Wilmer Paulino dd55d43520 rpcserver: ensure server has started before CloseChannel
We do this as a general sanity check to ensure channels cannot be closed
while either the backend is still syncing or the server is still
starting.
2019-10-23 17:40:38 -04:00
Wilmer Paulino 955d143c1b server+lntest: extract ErrServerNotActive error 2019-10-23 17:37:15 -04:00
Wilmer Paulino 254de64d4c Merge pull request #3533 from alrs/macaroons-test-fixes
macaroons: Test Improvements
2019-10-22 17:22:42 +02:00
Wilmer Paulino 239abded15 Merge pull request #3615 from Meshugah/patch-1
Fix Formatting of *Wrong*
2019-10-22 17:17:58 +02:00
Wilmer Paulino 0b2ef8bb4e Merge pull request #2813 from wereHamster/tor-target-ip-address
Tor option to override target IP address
2019-10-22 17:15:54 +02:00
Wilmer Paulino 73ceb9a06e Merge pull request #3603 from cryptagoras/patch-2
discovery/gossiper: fix minor typo
2019-10-15 14:21:21 +02:00
Wilmer Paulino 4e1658a02f htlcswitch: raise max cltv limit to 2016 blocks
The previous limit of 1008 proved to be low, given that almost 50% of
the network still advertises CLTV deltas of 144 blocks, possibly
resulting in routes with many hops failing.
2019-10-11 18:07:40 -04:00
Wilmer Paulino cbf7e4886a multi: extend QueryRoutes RPC with CLTV limit field 2019-10-11 18:07:39 -04:00
Wilmer Paulino 0fc401de19 routing+routerrpc: take max cltv limit into account within path finding
With the introduction of the max CLTV limit parameter, nodes are able to
reject HTLCs that exceed it. This should also be applied to path
finding, otherwise HTLCs crafted by the same node that exceed it never
left the switch. This wasn't a big deal since the previous max CLTV
limit was ~5000 blocks. Once it was lowered to 1008, the issue became
more apparent. Therefore, all of our path finding attempts now have a
restriction of said limit in in order to properly carry out HTLCs to the
network.
2019-10-11 18:04:49 -04:00
Wilmer Paulino 3e499f7cc9 build: expand reproducible build system with build and verification steps 2019-10-09 22:48:03 -04:00
Wilmer Paulino b63ed5ad56 config: add sync freelist cli flag 2019-10-04 12:19:42 -04:00
Wilmer Paulino fa96450db8 channeldb: add freelist sync option modifier 2019-10-04 12:19:41 -04:00
Wilmer Paulino 194a9dea81 multi: support sync freelist option within btcwallet 2019-10-04 12:19:40 -04:00
Wilmer Paulino fa96d707c5 lnwallet: enforce fee floor on max fee allocation
Without this, it was possible for a combination of our balance and max
fee allocation to result in a fee rate below the fee floor causing the
remote party to reject the update and close the channel.
2019-10-03 20:13:26 -04:00
Wilmer Paulino 5ed1084130 Merge pull request #3572 from joostjager/canceled-spelling
multi: fix canceled spelling
2019-10-03 16:50:06 -04:00
Wilmer Paulino e51df8d810 chainntnfs: only log confirmation notification registration once 2019-10-03 14:05:28 -04:00
Wilmer Paulino 40d63d5b4e Merge pull request #3571 from joostjager/log-pathfinding-metrics
routing: log performance metrics
2019-10-03 12:21:45 -04:00
Wilmer Paulino 4b857f819a Merge pull request #3567 from cfromknecht/bump-bitcoind-0.18.1
build: bump to bitcoind 0.18.1 for itests
2019-10-02 10:29:36 -04:00
Wilmer Paulino cf5dc90d04 peer+server: wait until peer is active to begin channel opening process
Without waiting, we would proceed to retrieve the remote peer's
supported features, which may have not been set due to not yet receiving
their Init message.
2019-10-01 17:42:43 -04:00
Wilmer Paulino 04a7cda3d5 Merge pull request #3534 from alrs/discovery-test-improvements
discovery: Goroutine Test Fixes and Linting
2019-09-25 16:12:30 -07:00
Wilmer Paulino c05b8f88ac docs: update watchtower docs to include wtclientrpc info 2019-09-25 14:41:27 -07:00
Wilmer Paulino cf04b4cfc8 lncfg: show deprecated warning for wtclient.private-tower-uris option
A proper deprecated config option should show a warning to the user
rather than preventing the daemon from starting.
2019-09-25 14:41:26 -07:00
Wilmer Paulino 26954b3718 lnrpc: remove remaining wtclientrpc build tags
The tags to expose the lncli wtclient commands were removed, but the RPC
subserver still required them, causing the commands to return an error.
2019-09-25 14:41:25 -07:00
Wilmer Paulino 811c2df75a Merge pull request #3505 from Crypt-iQ/invoice-param-checks-0913
zpay32: check route+hop hints while decoding
2019-09-24 15:22:30 -07:00
Wilmer Paulino 9e4c4c5041 Merge pull request #2084 from halseth/node-announcement-stale
Retransmit NodeAnnouncement on regular intervals
2019-09-17 11:37:05 -07:00
Wilmer Paulino 35027e52fc Merge pull request #3497 from joostjager/nursery-err
utxonursery: lower shutdown message log level
2019-09-14 11:59:56 +03:00
Wilmer Paulino 5d016f8c62 Merge pull request #3439 from valentinewallace/fix-zero-fwding-policy-updates
discovery+switch: apply zero forwarding policy updates in-memory as w…
2019-09-10 01:00:14 -07:00
Wilmer Paulino 38c64b2030 Merge pull request #3433 from halseth/atpl-nodescore-tracelogs
[autopilot] Add trace logging during node scoring
2019-09-04 13:04:10 -07:00
Wilmer Paulino d1a4fe7e2e Merge pull request #2088 from wpaulino/lower-mempool-spend-check-timeout
chainntnfs/interface_test: lower mempool spend check timeout
2019-09-04 12:08:06 -07:00
Wilmer Paulino d8dd6b3245 htlcswitch: cap fee updates to max fee allocation
In this commit, we begin to enforce a maximum channel commitment fee for
channel initiators when attempting to update their commitment fee. Now,
if the new commitment fee happens to exceed their maximum, then a fee
update of the maximum fee allocation will be proposed instead if needed.

A default of up to 50% of the channel initiator's balance is enforced
for the maximum channel commitment fee. It can be modified through the
`--max-channel-fee-allocation` CLI flag.
2019-09-03 16:49:59 -07:00
Wilmer Paulino 047d5b173c htlcswitch: refactor TestChannelLinkUpdateCommitFee common code into closure 2019-09-03 16:49:56 -07:00
Wilmer Paulino 59d19e0ca9 lnwallet: add MaxFeeRate method to LightningChannel 2019-09-03 16:49:54 -07:00
Wilmer Paulino d7364d0f28 rpc: populate missing fields for waiting close channels 2019-09-03 14:25:03 -07:00
Wilmer Paulino 06f544a78c cmd/lncli: return error upon missing channel backup when parsing 2019-09-03 14:04:38 -07:00
Wilmer Paulino 578df81fb2 lntest/itest: resolve mempool flake in multi-hop htlc local timeout test
The test assumed that transactions would be broadcast and confirmed at
incorrect heights. Due to timing issues, it was possible for the test to
still succeed, resulting in a flake.

The test assumes that Bob will sweep a pending outgoing HTLC and commit
output back to their wallet. This commit ensures that these operations
are done when expected, i.e.:

1. Bob force closes the channel due to the HTLC timing out.
2. Once the channel is confirmed, Bob broadcasts their HTLC timeout
transaction.
3. Bob broadcasts their commit output sweep transaction once its CSV
expires.
4. Bob broadcasts their second layer sweep transaction for the timed out
HTLC once its CSV expires.
2019-08-30 12:15:14 -07:00
Wilmer Paulino 06206f09b5 Merge pull request #3010 from wpaulino/node-ann-flake
lntest/itest: prevent direct connection within testNodeAnnouncement
2019-08-30 11:55:05 -07:00
Wilmer Paulino 2f6ec77b3c chainntnfs/interface_test: lower mempool spend check timeout
In this commit, we lower the mempool spend check timeout to be twice as
long as the trickle interval of the miner node, which will greatly
improve the execution time of this specific test. We're able to do this
now since we can specify custom trickle intervals for our test
harnesses.
2019-08-29 18:05:46 -07:00
Wilmer Paulino 47a8cd36f7 lntest/itest: prevent direct connection within testNodeAnnouncement
Alice and Dave don't need to be connected in order to receive the node
announcement as we assume that she can receive it from Bob because they
are connected at the beginning of every test.
2019-08-29 18:04:13 -07:00
Wilmer Paulino 2e122a807b Merge pull request #3406 from cfromknecht/die-spew
pilot+discovery: die spew
2019-08-22 15:33:56 -07:00
Wilmer Paulino 2cc5891c8c lnrpc/walletrpc: use current height as height hint for cpfp
In this commit, we address an issue that would cause us to scan from the
genesis block for the spend of an output that we wish to use to raise
the fee of a transaction through CPFP. This was due to setting a 0
height hint when constructing the input required by the sweeper and was
discovered due to the recently added validation checks at the chain
notifier level. We'll now use the current height as the height hint
instead as the sweeper will end up creating a new transaction that
spends the input.
2019-08-22 13:49:42 -07:00
Wilmer Paulino 9e8a1707cc lnwallet: modify FetchInputInfo to return additional information for utxos 2019-08-22 13:49:41 -07:00
Wilmer Paulino 8b398bdbd1 sweep: remove unnecessary use of FetchInputInfo within CraftSweepAllTx
We already have all of the information required for the outputs from the
ListUnspent method.
2019-08-22 13:49:40 -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
Wilmer Paulino a9efb61767 lnwallet: remove irrelevant fields in Utxo struct
These fields are only relevant for spent transaction outputs.
2019-08-22 13:49:38 -07:00
Wilmer Paulino cb1d6683d9 chainntnfs: acquire TxNotifier lock after closing quit chan
This prevents a deadlock while tearing down the TxNotifier if it's
currently blocked delivering a notification. By closing the quit chan
first, we ensure blocked sends/reads can exit and allow the TxNotifier
to proceed tearing down.
2019-08-22 13:49:38 -07:00
Wilmer Paulino 17b6205f3a chainntnfs: validate conf/spend ntfn registration parameters
A height hint not being set would cause lnd to scan for the
confirmation/spend of a txid/outpoint/address from genesis.

The number of confirmations not being set within a confirmation request
would cause the internal TxNotifier to deadlock when dispatching
updates.
2019-08-22 13:49:37 -07:00
Wilmer Paulino 7821eb6ffb chainntnfs: refactor common registration code within RegisterSpendNtfn 2019-08-22 13:49:35 -07:00
Wilmer Paulino 5089311ca1 chainntnfs: refactor common registration code within RegisterConfirmationsNtfn 2019-08-22 13:49:33 -07:00
Wilmer Paulino c4ba5577cc Merge pull request #3366 from wpaulino/prevent-initial-gossip-sync-broadcast
discovery: prevent broadcast of anns received during initial graph sync
2019-08-21 13:07:14 -07:00
Wilmer Paulino e15e524637 discovery: prevent broadcast of anns received during initial graph sync
There's no need to broadcast these as we assume that online nodes have
already received them. For nodes that were offline, they should receive
them as part of their initial graph sync.
2019-08-21 12:06:33 -07:00
Wilmer Paulino 938516ec5a Merge pull request #3387 from cfromknecht/tlv-primtive-test
tlv: add tests for all primitive encodings
2019-08-14 12:46:45 -07:00
Wilmer Paulino c405e89197 discovery: check non-nil syncer upon historical sync tick 2019-08-13 18:23:05 -07:00
Wilmer Paulino 51216c6e5e cmd/lncli: properly set synced_to_graph for getinfo command 2019-08-13 17:40:18 -07:00
Wilmer Paulino 8ca2c79bfe rpc: expose graph synced status within GetInfo 2019-08-06 17:56:56 -07:00
Wilmer Paulino 977c139f3c discovery: handle graph synced status after stalled initial historical sync
This ensures that the graph synced status is marked true at some point
once a historical sync has completed. Before this commit, a stalled
historical sync could cause us to never mark the graph as synced.
2019-08-06 17:56:55 -07:00
Wilmer Paulino af4234f680 discovery: allow the SyncManager to report whether the graph is synced 2019-08-06 17:56:54 -07:00
Wilmer Paulino 0690c8f627 watchtower/wtclient: only reset iterator once we've exhausted all candidates
Doing so allows us to load balance sessions better amongst all of the
tower candidates.
2019-07-30 15:18:18 -07:00
Wilmer Paulino 0431701262 multi: only allow specifying towers to TowerClient through RPC
With the introduction of the WatchtowerClient RPC subserver, the lnd
configuration flag to specify private watchtowers for the client is no
longer needed and can lead to confusion upon users. Therefore, we remove
the flag completely, and only rely on the watchtower client being active
through a new --wtclient.active flag.
2019-07-30 15:18:17 -07:00
Wilmer Paulino 359b2049b6 watchtower: load persisted towers upon TowerClient creation
We do this as a convenience for WatchtowerClient users so that they do
not need to re-add towers upon restarts. We ensure not to re-add towers
that have been previously removed by determining whether it has any
lingering active sessions.
2019-07-30 15:18:17 -07:00
Wilmer Paulino 787986283c cmd/lncli: add watchtower client commands 2019-07-30 15:18:16 -07:00
Wilmer Paulino 8f010abac5 multi: add watchtower client RPC subserver 2019-07-30 15:18:15 -07:00
Wilmer Paulino c57128097e watchtower/wtclient: extend TowerClient with CRUD operations for towers
In this commit, we extend the wtclient.Client interface with the
following methods:

  * AddTower
  * RemoveTower
  * RegisteredTowers
  * LookupTower
  * Stats

Care has been taken to ensure that any in-memory state updates are
_only_ performed after a successful database update.

These methods are currently unused, but they serve as a dependency for
the upcoming WatchtowerClient RPC subserver.
2019-07-30 15:18:13 -07:00
Wilmer Paulino 06d10d8100 watchtower/wtclient: extend TowerCandidateIterator to update candidates 2019-07-30 15:13:24 -07:00
Wilmer Paulino 1d73a6564f watchtower: extend client databse with CRUD operations for towers
These operations are currently unused, but will be integrated into the
TowerClient at a later point as future preparation for the
WatchtowerClient RPC subserver, which will allow users to add, remove,
and list the watchtowers currntly in use.
2019-07-30 15:13:23 -07:00
Wilmer Paulino 56d66c80a1 watchtower: extend client db to filter sessions for a specific tower
This currently takes O(N) time as there does not exist an index of
active client sessions for each watchtower within the client's database.
This index is likely to be added in the future.
2019-07-30 15:13:22 -07:00
Wilmer Paulino 4abadc82f3 watchtower/wtclient: export clientStats 2019-07-30 15:13:21 -07:00
Wilmer Paulino 159883665d wtclient: refactor client creation after database calls 2019-07-30 15:13:20 -07:00
Wilmer Paulino 76f9c9bd52 watchtower/wtclient: remove stale sessionQueue TODO
The state updates that are pending to be acked by the tower are already
loaded within newSessionQueue.
2019-07-30 15:13:17 -07:00
Wilmer Paulino 24ca962f75 htlcswitch: lower max outgoing cltv expiry to one week worth of blocks
The current value was based on the previous default CLTV delta of 144
blocks. This has been lowered to 40 since lnd v0.6.0-beta, making the
current value of 5000 blocks a bit high. Lowering it to one week should
be more than enough to account for the other major lightning
implementations. Eclair currently has a default CLTV delta of 144, while
c-lightning's is 14.
2019-07-26 18:06:40 -07:00
Wilmer Paulino 87ff463abd htlcswitch+lnd: make max cltv expiry configurable 2019-07-26 18:05:58 -07:00
Wilmer Paulino 99d9e3caeb server: use custom wtclient policy instead of default 2019-07-24 18:16:18 -07:00
Wilmer Paulino 1d2aba8cd4 watchtower/wtpolicy: properly set DefaultSweepFeeRate and MinSweepFeeRate
These values were intended to be 10 sat/vbyte and 4 sat/vbyte
respectively, but the conversion was done incorrectly.
2019-07-24 18:12:48 -07:00