Commit Graph
100 Commits
Author SHA1 Message Date
Wilmer Paulino 08d93fd15b docs: add script enforced channel leases text to release notes 2021-10-19 18:30:58 -07:00
Wilmer Paulino e891dd0fd3 itest: test backup restore of script enforced lease channel type 2021-10-19 18:30:53 -07:00
Wilmer Paulino 0b0dd65c93 chanbackup: support backup restore of script enforced leased channels 2021-10-19 18:30:50 -07:00
Wilmer Paulino 974fc346cf itest: update itests to use new script-enforced lease commitment type
We update several of our integration tests that exercise different
scenarios with regards to the broadcast of a channel commitment
transaction with HTLCs in-flight to use the new commitment type for
channel leases. We do this to ensure we have complete coverage of said
channel commitment type. This required changing several assumptions
throughout the tests based on when we should expect sweeps to happen.
2021-10-19 18:30:48 -07:00
Wilmer Paulino e15ad026d4 chanacceptor: include commitment type in channel acceptor requests 2021-10-19 18:30:45 -07:00
Wilmer Paulino c9f6d788e2 lnrpc: add new CommitmentType for script enforced leased channels 2021-10-19 18:30:43 -07:00
Wilmer Paulino e1c269c7ed sweep: remove previous exclusive group upon re-offered inputs
This aims to cover an edge case and also serves as an optimization of
what happens when an input that was offered to the Sweeper with an
exclusive group is re-offered without one. This happens every time we
attempt to sweep the different possible anchors of a channel at the time
of broadcast, as we don't know which commitment transaction will end up
confirming in the chain. Once the commitment transaction confirms
however, we know which anchor output to act upon and re-offer it to the
Sweeper without an exclusive group. At this point, the Sweeper will
continue to attempt sweeping the other anchor output versions even know
we know they are not valid.
2021-10-19 18:30:40 -07:00
Wilmer Paulino 5faf3dc03b contractcourt: handle sweeping script-enforced leased channel outputs
In order to sweep the commitment and HTLC outputs belonging to a
script-enforced leased channel, each resolver must know whether the
additional CLTV clause on the channel initiator applies to them. To do
so, we retrieve the historical channel state stored within the database
and supplement it to the resolvers to provide them with what's needed in
order to sweep the necessary outputs and resolve their respective
contracts.
2021-10-19 18:30:37 -07:00
Wilmer Paulino 2f27fa370b input: add new constructor to support CSV and CLTV locked inputs 2021-10-19 18:30:35 -07:00
Wilmer Paulino 8cfb53f64a lnwallet: support transactions and scripts for new commitment type
This commit modifies the channel state machine to be able to derive the
proper commitment and second-level HTLC output scripts required by the
new script-enforced leased channel commitment type.
2021-10-19 18:30:32 -07:00
Wilmer Paulino 01e9bb2bff lnwallet: coalesce different supported output scripts into single method 2021-10-19 18:30:30 -07:00
Wilmer Paulino 652f841738 input: add witness gen and weight estimates for new commitment type
This witness generators and weight estimates added only apply for the
new script-enforced leased channel commitment type.
2021-10-19 18:30:27 -07:00
Wilmer Paulino b84307e62e input: add scripts for new script enforced lease commitment type
The new commitment type consists of adding an additional CLTV
requirement to guarantee a leased channel's expiration on any commitment
and HTLC outputs that pay directly to the channel initiator.
2021-10-19 18:30:24 -07:00
Wilmer Paulino 564ec0fd9b funding+lnwallet: support funding new script enforced leased channels 2021-10-19 18:30:22 -07:00
Wilmer Paulino f38c6d6662 channeldb: add new ChannelType bit for script enforced leased channels 2021-10-19 18:30:19 -07:00
Wilmer Paulino 6252563bc5 lnwire: add LeaseExpiry custom record for Open+AcceptChannel 2021-10-19 18:30:17 -07:00
Wilmer Paulino 6052a446dc lnwire+feature: add feature bit for script enforced lease support 2021-10-19 18:30:14 -07:00
Wilmer Paulino 35fd985118 lncfg: add protocol config option for script enforced lease support 2021-10-19 18:30:12 -07:00
Wilmer Paulino 61a0112765 docs: add explicit channel negotiation text to release notes 2021-08-30 19:17:51 -07:00
Wilmer Paulino 3299af7919 lncli: add channel type flag to openchannel command 2021-08-30 19:17:45 -07:00
Wilmer Paulino 523eef5cf4 lntest: use explicit channel commitment negotiation for multi-hop itests 2021-08-30 19:17:42 -07:00
Wilmer Paulino 449f207217 lntest: replace commitType type with rpc alternative 2021-08-30 19:17:39 -07:00
Wilmer Paulino e7885f2bde funding: add explicit commitment type negotiation support
This commit adds the ability for a channel initiator/responder to
determine whether the channel to be opened can use a specific commitment
type through explicit negotiation. It also includes the existing
implicit negotiation logic to fall back on if explicit negotiation is
not supported.
2021-08-30 19:17:34 -07:00
Wilmer Paulino 031d7b1d55 lnwire: extend RawFeatureVector with helper methods 2021-08-30 19:17:31 -07:00
Wilmer Paulino 6bbe790535 lnwallet: prevent anchor reserve enforcement on legacy inbound channel
This commit aims to address a flaw in our anchor reserve enforcement
logic in which an inbound "legacy" channel (i.e. a channel with a
commitment type that precedes anchors) would be rejected by the
recipient if they have at least one opened channel using the anchors
commitment type and do not have enough on-chain funds to meet the
anchors reserve.
2021-06-23 18:24:31 -07:00
Wilmer Paulino d7299802d4 itest: extend testAnchorReservedValue to open additional channels
We do this to trigger a bug that will be resolved in a follow-up commit.
This bug prevents inbound legacy channels from being rejected by the
recipient if they have at least one anchor channel already opened
without an on-chain balance.
2021-06-23 18:24:30 -07:00
Wilmer Paulino 0bd6f32867 chainreg: handle missing case for bitcoind signet rpc connectivity
This allows lnd to connect to bitcoind's expected signet RPC port.
2021-06-01 16:22:36 -07:00
Wilmer Paulino b213402722 config: support auto rpc config with bitcoind signet
This allows lnd to automatically retrieve the RPC credentials when
attempting to connect to a signet bitcoind node.
2021-06-01 16:22:10 -07:00
Wilmer Paulino 186237ca73 discovery: demote err log to debug from processZombieUpdate
This log can be "spammy" while nodes throughout the network have yet to
upgrade to v0.13.0-beta, which includes several enhancements to prevent
the broadcast of zombie edges/updates.
2021-05-26 13:33:41 -07:00
Wilmer Paulino f195f21c8c lncli: remove RPC name from list wallet accounts command description 2021-05-26 11:20:31 -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
Wilmer Paulino 3b22bd9064 docs: add introductory documentation for new key import feature 2021-05-21 14:39:35 -07:00
Wilmer Paulino b01437d24e rpc: fix policy order for GetNodeInfo
GetNodeInfo retrieves the policies for every edge the node belongs to.
When these policies are retrieved from the database, they're returned
in the following order: the first policy is the outgoing policy from the
node, and the second is the incoming policy to the node. This ordering
is not consistent with the ordering we have within our other RPCs like
GetChanInfo and DescribeGraph, where policies are sorted based on the
smaller public key of the nodes within an edge.

We fix this by maintaining the same order as our other RPCs.
2021-05-12 18:24:38 -07: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
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
Wilmer Paulino 0ada2288cc discovery: prevent logging certain validation barrier errors 2021-04-29 15:53:07 -07:00
Wilmer Paulino eb4413154d routing: return err on validation failure of network update
This ensures the waiting receiving channel always receives an error to
prevent a deadlock when processing a network update that fails due to
the validation barrier.

On commit d5aedbcbd9:

1000 @ 0x43a285 0x44a38f 0xc42e86 0xc80fda 0xc8682d 0xc976c9 0x46fce1
github.com/lightningnetwork/lnd/routing.(*ChannelRouter).AddNode+0x245                      github.com/lightningnetwork/lnd/routing/router.go:2218
github.com/lightningnetwork/lnd/discovery.(*AuthenticatedGossiper).addNode+0x3b9            github.com/lightningnetwork/lnd/discovery/gossiper.go:1510
github.com/lightningnetwork/lnd/discovery.(*AuthenticatedGossiper).processNetworkAnnouncement+0x574c github.com/lightningnetwork/lnd/discovery/gossiper.go:1554
github.com/lightningnetwork/lnd/discovery.(*AuthenticatedGossiper).networkHandler.func1+0x24github.com/lightningnetwork/lnd/discovery/gossiper.go:1043
2021-04-29 15:52:24 -07:00
Wilmer Paulino c59c8d9c19 build: increase global test timeout to 60m
This doesn't affect our travis builds as much as our integration suite
is ran in parellel, but it is needed when running it sequentially.
2021-04-29 13:56:21 -07:00
Wilmer Paulino f26cfac440 itest: use wait predicate for balance assertion in assertDLPExecuted
This assertion would at times fail if the wallet balance hadn't been
updated yet.
2021-04-29 13:56:20 -07:00
Wilmer Paulino 6bb7b00a80 lntest: decrease broadcast timeout for neutrino-backed integration tests
Since we don't have to worry about network latency within our
integration tests, we can shorten the broadcast timeout for neutrino
integration tests from 5s to 1s.
2021-04-29 13:56:19 -07:00
Wilmer Paulino 2084cb0ad5 lncfg: add config options for new neutrino options 2021-04-29 13:56:17 -07:00
Wilmer Paulino 7517243d6d wtclient: decrement pending tasks stats upon accepted task
We'd never decrement the number of pending backups upon a watchtower
accepting one, making it confusing for users to determine whether their
backups have actually been accepted. Along the way, we also rename
NumTasksReceived to NumTasksPending to better reflect its purpose.
2021-04-14 17:18:25 -07:00
Wilmer Paulino 2f1f616c65 lntest: use validatechannels config option for itests 2021-04-09 15:47:04 -07:00
Wilmer Paulino 56c536583f lncfg: add new PrunedNodeMaxPeers config option/flag 2021-04-06 14:55:19 -07:00
Wilmer Paulino 82fe5d9bba build: update btcwallet dependency introducing pruned bitcoind support
This is achieved by some recent work within the BitcoindClient enabling
it to retrieve pruned blocks from its server's peers.
2021-04-06 14:55:14 -07:00
Wilmer Paulino 983f402369 itest: add wallet import cases 2021-04-05 15:41:12 -07:00
Wilmer Paulino cb3e179eaf rpc: break down wallet balance by accounts 2021-04-05 15:41:12 -07:00
Wilmer Paulino 4964801c6f lncli: add wallet import related commands 2021-04-05 15:41:11 -07:00
Wilmer Paulino 5301c7e83f walletrpc: expose wallet import related RPCs 2021-04-05 15:41:10 -07:00
Wilmer Paulino 2d163b788b lnwallet: expose wallet import related methods to WalletController 2021-04-05 15:41:09 -07:00
Wilmer Paulino c7bed34bca lncli: add account flag to wallet related commands 2021-04-05 15:41:08 -07:00
Wilmer Paulino a7211b34c3 rpc: expose account parameter for several wallet RPCs 2021-04-05 15:41:07 -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
Wilmer Paulino 393111cea9 discovery+routing: cancel dependent jobs if parent validation fails
Previously, we would always allow dependent jobs to be processed,
regardless of the result of its parent job's validation. This isn't
correct, as a parent job contains actions necessary to successfully
process a dependent job. A prime example of this can be found within the
AuthenticatedGossiper, where an incoming channel announcement and update
are both processed, but if the channel announcement job fails to
complete, then the gossiper is unable to properly validate the update.
This commit aims to address this by preventing the dependent jobs to
run.
2021-03-23 11:56:51 -07:00
Wilmer Paulino e713205eea discovery: add missing error channel sends in processNetworkAnnouncement
Without the error channel sends, we would block the gossip message
stream upon receiving a premature channel announcement.
2021-03-23 11:56:31 -07:00
Wilmer Paulino 022d44f776 itest: test new channel update rate limiting options 2021-03-16 12:08:18 -07:00
Wilmer Paulino dcac5a87f4 lncfg: expose channel update rate limiting options 2021-03-16 11:42:29 -07:00
Wilmer Paulino 83a0d03c0b discovery: use token bucket based rate limiting to throttle gossip
The recently added gossip throttling was shown to be too aggressive,
especially with our auto channel enable/disable signaling. We switch to
a token bucket based system instead as it's based on time, rather than a
block height which isn't constantly updated at a given rate.
2021-02-10 16:21:13 -08:00
Wilmer Paulino 1f1f7be770 Revert "lncfg: add new legacy protocol option to turn off gossip throttling"
This reverts commit b1fbbcf562.
2021-02-10 15:45:49 -08:00
Wilmer Paulino bfc8523873 Revert "discovery: add new option to toggle gossip rate limiting"
This reverts commit 13a2598ded.
2021-02-10 15:45:48 -08:00
Wilmer Paulino d4fa430ca6 Revert "lntest: always turn off gossip throttling for nodes created in itests"
This reverts commit 447c9f2c0b.
2021-02-10 15:45:47 -08:00
Wilmer Paulino 904003fbcb discovery: use source of ann upon confirmed channel ann batch
We do this instead of using the source of the AnnounceSignatures
message, as we filter out the source when broadcasting any
announcements, leading to the remote node not receiving our channel
update. Note that this is done more for the sake of correctness and to
address a flake within the integration tests, as channel updates are
sent directly and reliably to channel counterparts.
2021-02-10 13:22:28 -08:00
Wilmer Paulino 023f327cdd lntest: add rebroadcast stale announcements err to whitelist 2021-01-06 14:33:41 -08:00
Wilmer Paulino 7ef1f3f636 discovery: use source of ann upon confirmed channel ann batch
We do this instead of using the source of the AnnounceSignatures
message, as we filter out the source when broadcasting any
announcements, leading to the remote node not receiving our channel
update. Note that this is done more for the sake of correctness and to
address a flake within the integration tests, as channel updates are
sent directly and reliably to channel counterparts.
2021-01-06 13:16:44 -08:00
Wilmer Paulino 00d4e92362 discovery: prevent rebroadcast of premature channel updates
As similarly done with premature channel announcements, we'll no longer
allow premature channel updates to be rebroadcast once mature. This is
no longer necessary as channel announcements that we're not aware of are
usually broadcast to us with their accompanying channel updates.
2021-01-06 12:52:41 -08:00
Wilmer Paulino 871a6f1690 discovery: prevent rebroadcast of previously premature announcements 2020-12-08 15:18:08 -08:00
Wilmer Paulino a4f33ae63c discovery: adhere to proper channel chunk splitting for ReplyChannelRange 2020-12-08 15:18:07 -08:00
Wilmer Paulino c5fc7334a4 discovery: limit NumBlocks to best known height for outgoing QueryChannelRange
This is done to ensure we don't receive replies for channels in blocks
not currently known to us, which we wouldn't be able to process.
2020-12-08 15:18:06 -08:00
Wilmer Paulino 791ba3eb50 discovery: rate limit incoming channel updates
This change was largely motivated by an increase in high disk usage as a
result of channel update spam. With an in memory graph, this would've
gone mostly undetected except for the increased bandwidth usage, which
this doesn't aim to solve yet. To minimize the effects to disks, we
begin to rate limit channel updates in two ways. Keep alive updates,
those which only increase their timestamps to signal liveliness, are now
limited to one per lnd's rebroadcast interval (current default of 24H).
Non keep alive updates are now limited to one per block per direction.
2020-11-25 15:38:08 -08:00
Wilmer Paulino d3157bcaf8 watchtower: prevent removal of last tower addr
This addresses a potential panic when a tower has one of its candidate
sessions chosen, but its only reachable address was removed by a
user-initiated RPC before the fact.
2020-11-04 15:43:18 -08: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
Wilmer Paulino a5c5304c09 Merge pull request #4452 from yyforyongyu/add-connection-timeout
lnrpc+tor: add network connection timeout
2020-09-16 12:28:29 -07: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
Wilmer Paulino 90af440380 Merge pull request #4451 from yyforyongyu/fix-go-fmt
lnd: fix go fmt
2020-07-08 10:14:47 -07:00
Wilmer Paulino 9e8c39d4a2 Merge pull request #971 from vctt94/addMaxValueFlag
Add max value in flight flag
2020-07-07 10:29:51 -07:00
Wilmer Paulino 6075997ebc multi: add relative thaw height interpretation
This is useful when we wish to have a channel frozen for a specific
amount of blocks after its confirmation. This could also be done with an
absolute thaw height, but it does not suit cases where a strict block
delta needs to be enforced, as it's not possible to know for certain
when a channel will be included in the chain. To work around this, we
add a relative interpretation of the field, where if its value is below
500,000, then it's interpreted as a relative height. This approach
allows us to prevent further database modifications to account for a
relative thaw height.
2020-07-02 12:05:49 -07:00
Wilmer Paulino a998d5d647 Merge pull request #4106 from yyforyongyu/display-recovery-progress
multi: add a rpc endpoint to track the recovery process
2020-06-26 11:06:46 -07:00
Wilmer Paulino 8c79359247 Merge pull request #4395 from bmancini55/reply-channel-range-query
discovery: prevent endBlock overflow in replyChanRangeQuery
2020-06-18 15:19:52 -07:00
Wilmer Paulino d808ec0d17 itest: add sync error to whitelist 2020-06-18 14:51:45 -07:00
Wilmer Paulino d23be59f53 channeldb: remove graph insertion of restored channels
This was initially done as there were a few assertions throughout the
codebase requiring a channel's policy to be known. Now that these have
been addressed, we no longer need to store restored channels in the
graph, as their policies where incomplete anyway.
2020-06-18 14:51:44 -07:00
Wilmer Paulino 2a5b66ec00 lnwallet: note requirement of global coin selection lock 2020-06-12 11:22:30 -07:00
Wilmer Paulino c2f1fe26c1 rpc: acquire global coin select lock in related RPCs
This ensures proper coin selection synchronization between lnd and users
of the RPC to avoid potential double spend errors.
2020-06-12 11:22:29 -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 6e8021f858 scripts: bump bitcoind version to 0.20 2020-06-12 10:46:20 -07:00
Wilmer Paulino d49c6fba87 build: update btcwallet dependency for bitcoind v0.20 compat 2020-06-12 10:46:16 -07:00
Wilmer Paulino 69b8a356b2 chainntnfs: remove queued confirmation notification in CancelConf
This addresses a panic when a notification is canceled after its been
detected as included in a block and before its confirmation notification
is dispatched.
2020-06-10 13:45:45 -07:00
Wilmer Paulino 98da6c61c1 signrpc: parse both KeyDescriptor fields for SignOutputRaw requests
This is meant to handle a quirk in which key descriptors obtained
through walletrpc.DeriveKey don't result in the derived key being
persisted to the wallet's database, unlike with DeriveNextKey. Due to
this and some fallback logic in the wallet with regards to empty key
locators, if a request only specified the compressed public key, the
signature returned would be over a different key, namely the one derived
from (family=0, index=0).
2020-06-04 17:44:25 -07:00
Wilmer Paulino 146611d1c1 lnrpc: mark existing ListUnspent RPC as deprecated in favor of walletrpc 2020-06-03 19:03:05 -07:00
Wilmer Paulino acfd432602 walletrpc: add ListUnspent RPC 2020-06-03 19:03:04 -07:00
Wilmer Paulino 7616a3dc7f rpc: refactor request validation and response marshal into functions 2020-06-03 18:50:11 -07:00
Wilmer Paulino 9dcaf4fbc6 walletrpc: add output leases RPCs 2020-06-03 18:50:09 -07:00
Wilmer Paulino ae7335ce3b lnwallet: expose output leases on WalletController interface 2020-06-03 18:49:39 -07:00
Wilmer Paulino 94629b6c73 build: update btcwallet version to expose output leases 2020-06-03 18:31:53 -07:00
Wilmer Paulino c7dad7a8dd Merge pull request #4341 from wpaulino/log-raw-funding-tx
fundingmanager: log raw transaction on broadcast
2020-06-03 15:45:22 -07:00