Commit Graph

830 Commits

Author SHA1 Message Date
Elle Mouton
2abc422aac
watchtower+server: let manager Start & Stop the clients
In this commit, the `Stop` and `Start` methods are removed from the
`Client` interface and instead added to the new `Manager`. Callers now
only need to call the Manager to start or stop the clients instead of
needing to call stop/start on each individual client.
2023-11-28 09:54:01 +02:00
Elle Mouton
ab0375e0c1
wtclient+server: introduce tower client Manager
Introduce a wtclient `Manager` which handles tower clients. It indexes
clients by the policy used. The policy field is thus removed from the
`Config` struct which configures the Manager and is instead added to a
new `towerClientCfg` which configures a specific client managed by the
manager. For now, only the `NewClient` method is added to the Manager.
It can be used to construct a new `TowerClient`. The Manager currently
does notthing with the clients added to it.
2023-11-28 09:51:15 +02:00
Elle Mouton
84cdcd6847
multi: move DB schemas to channeldb/models
This commit moves the ChannelEdgePolicy, ChannelEdgeInfo,
ChanelAuthProof and CachedEdgePolicy structs to the `channeldb/models`
package.
2023-11-08 14:50:35 +02:00
Elle Mouton
6c76d31e89
multi: let FetchLightningNode take an optional tx
In preparation for the next commit which will remove the
`*LightningNode` from the `ChannelEdgePolicy` struct,
`FetchLightningNode` is modified to take in an optional transaction so
that it can be utilised in places where a transaction exists.
2023-11-08 14:50:34 +02:00
Elle Mouton
9dc1a1dfec
channeldb: convert FetchOtherNode to ChannelGraph method
To prepare for the `kvdb.Backend` member of `ChannelEdgeInfo` being
removed, the `FetchOtherNode` method is moved from the `ChannelEdgeInfo`
to the `ChannelGraph` struct.
2023-11-08 14:50:34 +02:00
Elle Mouton
fa7c1e250b
multi: let ForEachChannel be a method on ChannelGraph
Having a `ForEachChannel` method on the `LightningNode` struct itself
results in a `kvdb.Backend` object needing to be stored within the
LightningNode struct. In this commit, this method is replaced with a
`ForEachNodeChannel` method on the `ChannelGraph` struct will perform
the same function without needing the db pointer to be stored within the
LightningNode. This change, the LightningNode struct more closely
represents the schema on disk.

The existing `ForEachNodeChannel` method on `ChannelGraph` is renamed to
`ForEachNodeDirectedChannel`. It performs a slightly different function
since it's call-back operates on Cached policies.
2023-11-08 10:51:50 +02:00
yyforyongyu
4ba09098d1
sweep+lnd: move ticker creation into sweeper 2023-10-23 10:24:58 +08:00
Keagan McClelland
ac265812fc peer+lnd: make BestBlockView available to Brontide 2023-10-19 09:22:07 -07:00
Keagan McClelland
74b30a71cb lnd: start the BestBlockTracker during server startup 2023-10-19 09:22:07 -07:00
yyforyongyu
82053970ef
lnd+sweep: move DetermineFeePerKw into config
This commit makes `DetermineFeePerKw` configurable on sweeper so it's
easier to write unit tests for it.
2023-10-13 14:44:20 +08:00
yyforyongyu
063fb9dd43 multi: make max fee rate configurable 2023-10-06 16:34:47 -07:00
yyforyongyu
66b8700c0b multi: add debug logs to catch slow shutdown 2023-10-06 16:34:47 -07:00
Elle Mouton
031dbd7760 multi: remove ChainRegistry 2023-10-06 16:34:47 -07:00
Elle Mouton
be90bcbe46 multi: remove litecoin references and comments 2023-10-06 16:34:47 -07:00
Elle Mouton
3912d5a0c6 multi: remove Litecoin config options
This commit removes the `Litecoin`, `LtcMode` and `LitecoindMode`
members from the main LND `Config` struct. Since only the bitcoin
blockchain is now supported, this commit also deprecates the
`cfg.Bitcoin.Active` config option.
2023-10-06 16:34:47 -07:00
Olaoluwa Osuntokun
7323e9373b
feature+lncfg: add new CLI flag to opt into taproot chans 2023-08-22 16:32:35 -07:00
Olaoluwa Osuntokun
b368e476c5
lnwire: update Sig to support both ECDSA and schnorr sigs
In this commit, we update the Sig type to support ECDSA and schnorr
signatures. We need to do this as the HTLC signatures will become
schnorr sigs for taproot channels. The current spec draft opts to
overload this field since both the sigs are actually 64 bytes in length.
The only consideration with this move is that callers need to "coerce" a
sig to the proper type if they need schnorr signatures.
2023-08-22 16:29:19 -07:00
Oliver Gugger
d822d75f00
server+funding: remove previous link update mechanism
Because we now send the correct initial forwarding policy to Brontide,
the correct initial values are inserted into the link and we no longer
need to update the link in a later step.
2023-08-22 06:22:34 +08:00
Oliver Gugger
665179ece2
funding+server: don't use wallet DB for channel operations
Since the actual wallet backends might be different between the wallet
DB and the actual channel state DB, we pass in the correct struct to the
funding manager.
2023-08-18 09:44:05 +02:00
yyforyongyu
0dd2aa0aef
multi: add itest to check race between channel_ready and update_add_htlc
This commit adds a new itest case to check the race condition found in
issue #7401. In order to control the funding manager's state, a new dev
config for the funding manager is introduced to specify a duration we
should hold before processing remote node's channel_ready message.

A new development config, `DevConfig` is introduced in `lncfg` and will
only have effect if built with flag `integration`. This can also be
extended for future integration tests if more dev-only flags are needed.
2023-08-09 01:29:19 +08:00
Elle Mouton
552ef4bf81
wtclient: replay pending tasks on sessionQueue stop
This commit does a few things:
- First, it gives the sessionQueue access to the TowerClient task
  pipeline so that it can replay backup tasks onto the pipeline on Stop.
- Given that the above is done, the ForceQuit functionality of the
  sessionQueue and TowerClient can be removed.
- The bug demonstrated in a prior commit is now fixed due to the above
  changes.
2023-07-18 16:28:26 +02:00
yyforyongyu
bacb49ddba
peer+server: provide more verbose logging 2023-06-19 14:04:24 +08:00
Elle Mouton
d9c4ada991
multi: add wtclient config defaults to lnd config
In this commit, a `DefaultWtClientCfg` function is added which
populates some default values for the `WtClient` struct. This is then
used to populate the wtclient defaults in the main LND config struct.
2023-06-15 11:15:32 +02:00
Elle Mouton
1cdf15a39b
server+lncfg: make max in-mem tasks configurable
Add a `MaxTasksInMemQueue` field to the `WtClient` config so that users
can change the default if they please.
2023-05-16 10:57:50 +02:00
Elle Mouton
56cd825695
watchtower: replace taskpipeline with disk overflow queue 2023-05-16 10:57:50 +02:00
Carla Kirk-Cohen
4e36e2fd2b
multi: add custom feature bits to config options 2023-05-04 10:35:48 -04:00
Carla Kirk-Cohen
e41c65785f
multi: update node announcement features in feature manager first
Move merge of our features into the feature manager, rather than
updating our node announcement then retrospectively setting the
feature manger's set to the new vector. This allows us to use the
feature vector as our single source of truth for announcements.
2023-05-04 10:35:46 -04:00
Carla Kirk-Cohen
3f9f0ea5d1
multi/refactor: separate methods for get and set node announcement
In preparation for a more complex function signature for set node
announcement, separate get and set so that readonly callers don't need
to handle the extra arguments.
2023-05-04 10:35:42 -04:00
Carla Kirk-Cohen
c6263c2fe6
multi/refactor: move node ann modification outside of sign method
In preparation for moving feature bit modification inside of the
feature manager, separate node modification from signing.
2023-05-04 10:35:41 -04:00
Elle Mouton
85ec38f447
multi: pass BuildBreachRetribution callback to tower client
In this commit, a new BuildBreachRetribution callback is added to the
tower client's Config struct. The main LND server provides the client
with an implementation of the callback.
2023-04-24 13:15:40 +02:00
Olaoluwa Osuntokun
3d2daeefd8
sweep: remove conflicted sweep txns from the rebroadcaster
In this commit, we an existing gap in our rebroadcast handling logic. As
is, if we're trying to sweep a transaction and a conflicting transaction
is mined (timeout lands on chain, anchor swept), then we'll continue to
try to rebroadcast the tx in the background.

To resolve this, we give the sweeper a new closure function that it can
use to mark conflicted transactions as no longer requiring rebroadcast.
2023-04-21 11:53:08 -07:00
yyforyongyu
556c38fefd
contractcourt+lnd: watch for preimage reveal in mempool
This commit extends the current htlc timeout resolver to also watch for
preimage spend in mempool for a full node backend.

If mempool enabled, the resolver will watch the spend of the htlc output
in mempool and blocks **concurrently**, as if they are independent.

Ideally, a transaction will first appear in mempool then in a block.
However, there's no guarantee it will appear in **our** mempool since
there's no global mempool, thus we need to watch the spend in two places
in case it doesn't go through our mempool.

The current design favors the spend event found in blocks, that is, when
the tx is confirmed, we'd abort the monitoring and conitnue since the
outpoint cannot be double spent and re-appear in mempool again. This is
not true in the rare case of reorg, and we will handle reorg seperately.
2023-04-19 01:18:19 +08:00
Oliver Gugger
af70af2710
funding+server: update switch after sending channel update
With this commit we give the funding manager the ability to inform the
switch about custom channel policies, right after we've announced the
channel to the network.
This change is necessary because before #6753 a channel could only be
opened with the default forwarding policies, so the switch automatically
had the "correct" default values. Since #6753 added the ability to
specify forwarding policies at channel open time, we announced those
policies to the network but never updated the switch to inform it about
the changed policies (previously changing the policies was only possible
through the UpdateChannelPolicy RPC which did call the switch).
2023-04-18 09:40:18 +02:00
Elle Mouton
bad80ff583
multi: make tower MaxUpdates configurable
This is helpful in an itest environment where we want to quickly
saturate a session.
2023-03-20 16:51:51 +02:00
Elle Mouton
26e628c0fe
watchtowers: handle closable sessions
Add a routine to the tower client that informs towers of sessions they
can delete and also deletes any info about the session from the client
DB.
2023-03-20 16:51:51 +02:00
Elle Mouton
16008c0032
watchtower: handle channel closures
Add a channel-close handler that waits for channel close events and
marks channels as closed in the tower client DB.
2023-03-20 16:51:25 +02:00
yyforyongyu
f22b25a1bf
discovery+server: add more trace log 2023-03-08 21:02:53 +08:00
bitromortac
a73581610e
routing+lnrpc: make capacity factor configurable
We make the capacity factor configurable via an lnd.conf routerrpc
apriori parameter. The capacity factor trades off increased success
probability with a reduced set of channel candidates, which may lead to
increased fees. To let users choose whether the factor is active or not,
we add a config setting where a capacity fraction of 1.0 disables the
factor. We limit the capacity fraction to values between 0.75 and 1.0.
Lower values may discard too many channels.
2023-02-24 15:28:55 +01:00
yyforyongyu
2ddf079889
discovery+server.go: add FindChannel to fix itest flake 2023-02-23 21:56:13 +08:00
yyforyongyu
6618ab493a
multi: enhance loggings and fix logging format
Also adds TODO for a possible bug.
2023-02-23 21:56:08 +08:00
yyforyongyu
c3d1d3c4f1
multi: make SubBatchDelay configurable
This commit adds a new config option `--gossip.sub-batch-delay` so we
can speed up our itest.
2023-02-17 14:10:09 +08:00
bitromortac
58d5131e31
lnd+routerrpc: configure server with new estimator
We add new lnd.conf configuration options for both probability
estimators. Note that this is a breaking change for the existing apriori
parameters.
2023-02-14 13:34:25 +01:00
bitromortac
16986ee5c7
lnd+routing+rpc: switch mc to (external) estimator
We use a more general `Estimator` interface for probability estimation
in missioncontrol.

The estimator is created outside of `NewMissionControl`, passed in as a
`MissionControlConfig` field, to facilitate usage of externally supplied
estimators.
2023-02-14 13:34:25 +01:00
bitromortac
b0a998af8d
routing: rename apriori estimator
* we rename the current probability estimator to be the "apriori"
  probability estimator to distinguish from a different implementation
  later
* the AprioriEstimator is exported to later be able to type switch
* getLocalPairProbability -> LocalPairProbabiltiy (later part of an
  exported interface)
* getPairProbability -> getPairProbabiltiy (later part of an exported
  interface)
2023-02-07 16:18:38 +01:00
Orbital
c0f44a17b7
lnd: Add ability to encrypt TLS key on disk 2023-01-26 13:32:11 -06:00
positiveblue
824e792dc2
config: expose the InvoiceDB interface in DatabaseInstances
By now the only implementation is still the one in channeldb but other
project can use their custom implementations if needed.
2023-01-16 07:31:13 -08:00
bruwbird
274938ed45
fix typo liveliness 2022-11-25 21:52:00 +09:00
yyforyongyu
84fd911b47
multi: fix make lint
Fixes new lint errors caught by the latest version.
2022-11-18 20:48:23 +08:00
yyforyongyu
e6bebc4fe7
lnd: make MailboxDeliveryTimeout configurable 2022-11-03 18:29:08 +08:00
yyforyongyu
502a8f3210
lnd: fix sweeper batch window logging 2022-11-03 18:29:08 +08:00
yyforyongyu
851c82b80e
multi: rename HTLCExpiry to MailboxDeliveryTimeout for clarity 2022-11-03 18:29:08 +08:00
Joost Jager
511fb00777
htlcswitch: add final htlc event to notifier 2022-10-27 16:42:36 +02:00
Joost Jager
28256b7ea8
htlcswitch: keep final htlc outcome 2022-10-27 16:42:36 +02:00
Joost Jager
a0a50fa844
htlcswitch: auto-fail held htlcs
Make the interceptable switch aware of htlc expiry and fail back htlcs in-time
to prevent the counterparty from force-closing the channel.
2022-10-18 18:06:49 +02:00
Joost Jager
74eeb95e8c
htlcswitch: add error return value to NewInterceptableSwitch
Prepares for parameter validation.
2022-10-18 18:04:34 +02:00
Joost Jager
a6df9567ba
htlcswitch: add dedicated block subscription to interceptable switch
Preparation for making the interceptable switch aware of expiring htlcs.
2022-10-18 18:04:33 +02:00
Joost Jager
4a3e90f4d0
htlcswitch: add InterceptableSwitchConfig
Preparation for adding more config options.
2022-10-18 18:04:33 +02:00
eugene
bb956e127e
server+htlcswitch: check waiting-close fwdpkgs in reforwardResponses
Previously, the Switch would not check waiting-close channels' fwdpkgs
for settles or fails to reforward. This could result in a force close
in a rare edge case if a restart occurred at the wrong time. Now,
waiting-close fwdpkgs are checked and the issue is avoided.
2022-09-30 14:40:38 -04:00
Orbital
073c990c75
multi: Add --tor.encryptkey flag functionality to encrypt the Tor private key on disk
It's possible that a user might not want the Tor private key to sit on the disk in plaintext (it is a private key after all). So this commit adds a new flag to encrypt the Tor private key on disk using the wallet's seed. When the --tor.encryptkey flag is used, LND will still write the Tor key to the same file, however it will now be encrypted intead of plaintext. This essentially uses the same method to encrypt the Tor private key as is used to encrypt the Static Channel Backup file.
2022-09-30 01:53:46 -05:00
eugene
2def3fc542
server.go: add peerChan to peerConnectedListeners in NotifyWhenOnline
This fixes a bug where a caller would:
- call NotifyWhenOnline and pass in a channel
- the server's mutex is held and the pubStr is checked in peersByPub
- the peer object is in the peersByPub map
- the peer object has its quit channel closed
- QuitSignal is called in the select statement, and the function
  returns
- the caller is still waiting for the channel to be sent on forever
  since it was never sent on or added to the peerConnectedListeners
  slice.

This patch fixes the above bug by adding the channel to the
peerConnectedListeners slice if the QuitSignal select case is called.
2022-09-21 10:50:25 -04:00
yyforyongyu
2f27a52f7f
server+lncfg: make sweepr batch window duration configurable 2022-09-01 10:44:29 +08:00
Olaoluwa Osuntokun
2cc75db6f8
server: default sweep addrs to P2TR
This change covers sweep addresses for: the breach arbitrator, and watch
tower clients.
2022-08-11 17:26:07 -07:00
Olaoluwa Osuntokun
89529fbb4f
feature+lncfg: add config option to turn of anysegwit 2022-08-10 18:44:37 -07:00
Olaoluwa Osuntokun
1e556aa189
multi: thread through the new max fee field for co-op close
In this commit, we parse the new max fee field, and pass it through the
switch, all the way to the peer where it's ultimately passed into the
chan closer state machine.
2022-07-26 17:23:16 -07:00
eugene
b9ef26061a
server+netann+peer: put peer's alias in Update, proper config for link
This commit modifies the netann subsystem to use the peer's alias
for ChannelUpdates where appropriate (i.e. in case we are sending
the alias to the peer). It also modifies the loadActiveChannels
function in the peer package to handle upgrading a channel when the
scid-alias feature bit is turned on.
2022-07-07 17:10:30 -04:00
eugene
1aa9626606
server+funding: allow scid-alias, zero-conf chantypes, scid-alias
feature-bit channels

This allows opening zero-conf chan-type, scid-alias chan-type, and
scid-alias feature-bit channels. scid-alias chan-type channels are
required to be private. Two paths are available for opening a zero-conf
channel:

* explicit chan-type negotiation
* LDK carve-out where chan-types are not used, LND is on the
  receiving end, and a ChannelAcceptor is used to enable zero-conf

When a zero-conf channel is negotiated, the funding manager:
* sends a FundingLocked with an alias
* waits for a FundingLocked from the remote peer
* calls addToRouterGraph to persist the channel using our alias in
  the graph. The peer's alias is used to send them a ChannelUpdate.
* wait for six confirmations. If public, the alias edge in the
  graph is deleted and replaced (not atomically) with the confirmed
  edge. Our policy is also read-and-replaced, but the counterparty's
  policy won't exist until they send it to us.

When a scid-alias-feature channel is negotiated, the funding manager:
* sends a FundingLocked with an alias:
* calls addToRouterGraph, sends ChannelUpdate with the confirmed SCID
  since it exists.
* when six confirmations occurs, the edge is deleted and re-inserted
  since the peer may have sent us an alias ChannelUpdate that we are
  storing in the graph.

Since it is possible for a user to toggle the scid-alias-feature-bit
to on while channels exist in the funding manager, care has been taken
to ensure that an alias is ALWAYS sent in the funding_locked message
if this happens.
2022-07-07 17:10:28 -04:00
eugene
13c15e8038
server+htlcswitch: prevent privacy leaks, allow alias routing
This intent of this change is to prevent privacy leaks when routing
with aliases and also to allow routing when using an alias. The
aliases are our aliases.

Introduces are two maps:

* aliasToReal:
  This is an N->1 mapping for a channel. The keys are the set of
  aliases and the value is the confirmed, on-chain SCID.

* baseIndex:
  This is also an N->1 mapping for a channel. The keys are the set
  of aliases and the value is the "base" SCID (whatever is in the
  OpenChannel.ShortChannelID field). There is also a base->base
  mapping, so not all keys are aliases.

The above maps are populated when a link is added to the switch and
when the channel has confirmed on-chain. The maps are not removed
from if the link is removed, but this is fine since forwarding won't
occur.

* getLinkByMapping
  This function is introduced to adhere to the spec requirements that
  using the confirmed SCID of a private, scid-alias-feature-bit
  channel does not work. Lnd implements a stricter version of the spec
  and disallows this behavior if the feature-bit was negotiated, rather
  than just the channel type. The old, privacy-leak behavior is
  preserved.

The spec also requires that if we must fail back an HTLC, the
ChannelUpdate must use the SCID of whatever was in the onion, to avoid
a privacy leak. This is also done by passing in the relevant SCID to
the mailbox and link. Lnd will also cancel back on the "incoming" side
if the InterceptableSwitch was used or if the link failed to decrypt
the onion. In this case, we are cautious and replace the SCID if an
alias exists.
2022-07-07 17:10:28 -04:00
eugene
59fea192b7
server+routing: pass isAlias to router
This allows the router to determine what is and isn't an alias from
lnd's definition of an alias. Any ChannelAnnouncement that has an
alias ShortChannelID field is not verified on-chain. To prevent a
DoS vector from existing, the gossiper ensures that only the local
lnd node can send its ChannelAnnouncements to the router with an
alias ShortChannelID.
2022-07-07 17:10:28 -04:00
eugene
01f28ba540
server+discovery: alias-handling in gossiper
An OptionalMsgField has been added that allows outside subsystems
to provide a short channel id we should insert into a ChannelUpdate
that we then sign and send to our peer.

When the gossiper receives a ChannelUpdate, it will query the
alias manager by the passed-in FindBaseByAlias function to determine
if the short channel id in the ChannelUpdate points to a known
channel. If this lookup returns an error, we'll fallback to using
the original id in the ChannelUpdate when querying the router.
The lookup and potential fallback must occur in order to properly
lock the multimutex, query the correct router channels, and rate
limit the correct short channel id. An unfortunate side effect of
receiving ChannelUpdates from our peer that reference on of our
aliases rather than the real SCID is that we must store this policy.
Yet it is not broadcast-able. Care has been taken to ensure the
gossiper does not broadcast *any* ChannelUpdate with an alias SCID.

The cachedNetworkMsg uses the new processedNetworkMsg struct. This
is necessary so that delete-and-reinsert in the funding manager
doesn't process a ChannelUpdate twice and end up in a deadlock since
the err chan is no longer being used.
2022-07-07 17:10:28 -04:00
eugene
15b871de36
aliasmgr: new data store containing our, peer's aliases
This introduces the a store for managing all things alias-related.

There are two maps:

* baseToSet:
  This stores the "base" short channel id as the key. The value is
  the set of all aliases issued for this channel. The "base" SCID is
  whatever is stored in the OpenChannel's ShortChannelID member. For
  everything other than zero-conf channels, this is the confirmed SCID.
  For zero-conf channels, this is the very first alias assigned. This is
  used mostly by the Switch to retrieve a set of aliases and determine
  if it is safe to forward.

* aliasToBase:
  This stores the reverse mapping of baseToSet. Each key is an alias
  SCID and the value is the "base" SCID. This is exclusively used by
  the gossiper to determine if an alias in a ChannelUpdate our peer
  sends actually references a channel we know of.

The functions make use of the above two maps:

* AddLocalAlias:
  This persists the {alias, base} pair in the database. The baseToSet
  map is populated. The aliasToBase is optionally populated depending on
  where this function is called from. Upgrade cases, where the
  scid-alias feature bit is toggled and channels already exist, will
  not persist to the gossip map. This is mainly to simplify the tangle
  of logic that would otherwise occur.

* GetAliases:
  This fetches the set of aliases by using the passed-in base SCID. This
  is used in the Switch and other places where the alias set is needed.

* FindBaseSCID:
  This fetches the base given an alias. This is used in the gossiper to
  determine validity of a peer's ChannelUpdate that contains an alias.

* DeleteSixConfs:
  This removes the aliasToBase map entry for the given "base". This is
  used when the gossiper mappings are no longer needed, i.e. when the
  channel has six confirmations and is public.

* PutPeerAlias:
  Stores the peer's alias.

* GetPeerAlias:
  Fetches the peer's alias.

* RequestAlias:
  Generates an alias for us in the range 16000000:0:0 and
  16250000:16777215:65535
2022-07-07 17:10:27 -04:00
eugene
a493caf3c0
server+lncfg: protocol flag to enable scid-alias, zero-conf feature bits
This allows the zero-conf and scid-alias feature bits to be toggled
using the config. The feature bits are off by default to protect users
from accidentally incurring the risk of a zero-conf channel.
2022-07-07 17:10:26 -04:00
eugene
f7681cb51d
server.go: replace call to removePeer with Disconnect in DisconnectPeer
Without this, calls to DisconnectPeer would bypass the
peerTerminationWatcher and allow subsequent connect requests to
go through before the peer's links were fully shut down. This could
lead to force closes.
2022-06-29 13:50:00 -04:00
Turtle
747161a1f4 lnd: add config option for specifying particular peers to connect to 2022-04-19 12:37:44 -05:00
Elle Mouton
c54cc6e841
multi: announce Keysend feature bit
In this commit, we add the keysend feature bit to our NodeAnnouncement
if the accept-keysend option is set.
2022-04-14 14:01:19 +02:00
Joost Jager
721fb4ee88
contractcourt: add onchain interception 2022-04-13 11:31:33 +02:00
Joost Jager
7265a5e42b
beacon: add constructor 2022-04-13 11:31:29 +02:00
Joost Jager
13dff2fb3e
htlcswitch: interceptor expiry check 2022-04-12 08:27:06 +02:00
positiveblue
ae2aa5671f
lnrpc/peers: handle feature bit changes in updateNodeAnnouncement 2022-04-02 19:10:25 -07:00
positiveblue
e4e0935816
lnrpc/peers: skeleton logic for updateNodeAnnouncement
Basic logic for the endpoint:

- Get the current nodeAnn information
- Calculate modifications
- Apply modifications
- Return changes
2022-04-01 18:36:21 -07:00
yyforyongyu
1c8c0b4fa0
multi: make PendingCommitInterval configurable 2022-03-24 10:01:42 +08:00
Joost Jager
ae314ec794
htlcswitch: add an always on mode to interceptable switch
Co-authored-by: Juan Pablo Civile <elementohb@gmail.com>
2022-03-17 17:39:37 +01:00
Joost Jager
169f0c0bf4
routerrpc+htlcswitch: move intercepted htlc tracking to switch
In this commit we move the tracking of the outstanding intercepted htlcs
to InterceptableSwitch. This is a preparation for making the htlc
interceptor required.

Required interception involves tracking outstanding htlcs across
multiple grpc client sessions. The per-session routerrpc
forwardInterceptor object is therefore no longer the best place for
that.
2022-03-15 08:44:57 +01:00
Oliver Gugger
7dfe4018ce
multi: use btcd's btcec/v2 and btcutil modules
This commit was previously split into the following parts to ease
review:
 - 2d746f68: replace imports
 - 4008f0fd: use ecdsa.Signature
 - 849e33d1: remove btcec.S256()
 - b8f6ebbd: use v2 library correctly
 - fa80bca9: bump go modules
2022-03-09 19:02:37 +01:00
yyforyongyu
72548ea463
server: start htlcSwitch before chainArb 2022-02-11 21:17:03 +08:00
Oliver Gugger
895a2e497b
multi: formatting and comment fixes 2022-02-10 11:02:02 +01:00
Oliver Gugger
b77c1fb200
Merge pull request #6149 from bhandras/graph_import_rpc
lnd: add `devrpc` sub server and `devrpc.ImportGraph` to import graph dumps
2022-01-28 10:24:59 +01:00
eugene
ebaffb953a server+contractcourt: hand-off BreachCloseInfo to channel arbitrator
This also changes the chain_watcher and breacharbiter handoff. The
new logic ensures that the channel is only marked as pending closed
when the channel arbitrator has persisted the resolutions and commit
set.
2022-01-25 15:42:20 -05:00
eugene
f99933fa69 server+contractcourt: add breachResolver that subscribes to breacharbiter
Introduces a breachResolver that subscribes to the breacharbiter to
determine if the final justice transaction has confirmed and can
clean itself up.
2022-01-25 15:42:20 -05:00
Andras Banki-Horvath
825422a82a
lncfg: move ParseHexColor to lncfg 2022-01-24 17:42:54 +01:00
Dimitris Apostolou
530a2059e5
multi: Fix typos [skip ci] 2022-01-24 12:19:02 +02:00
carla
0ae38457de
server: disable chain health check if we're running without backend
There is no chain backend to check, so this check will always fail.
This commit disables it when we're running without a backend.
2022-01-20 14:21:36 +02:00
Olaoluwa Osuntokun
3481286ea0
lnwire+peer: clamp pong bytes, make ping handler more effcieint
This was not properly enforced and would be a spec violation on the
peer's end. Also re-use a pong buffer to save on heap allocations if
there are a lot of peers. The pong buffer is only read from, so this
is concurrent safe.
2022-01-13 15:01:18 -08:00
Oliver Gugger
da59c1fa62
multi: add health check for remote signer 2022-01-06 14:35:25 +01:00
yyforyongyu
85b626e6a7
server: fix peers not ignored during bootstrapping
This commit fixes the issue where duplicate peers are used both in
making persistent connections and bootstrap connections. When we init
bootstrapping, we need to ignore peers that have connections already
made so far plus peers which we are attempting to make connections with,
hence the persistent peers.
2021-12-23 15:14:37 +08:00
yyforyongyu
46050fc631
multi: enhance logging for debugging peer connection 2021-12-23 15:14:37 +08:00
Olaoluwa Osuntokun
55d983dee7
server: defer ticker stop to avoid goroutine leak 2021-11-04 17:53:36 -07:00
Elle Mouton
6ec9c3c58f
server: stagger multi addr connection attempts
In this commit, we stagger the connection attempts to the multiple
addresses of a peer.
2021-11-04 13:27:33 +02:00
Elle Mouton
b9b7ea2a6a
server: use one func for peer re-connection
Let the connectToPersistentPeer func handle all connection attempts to
persistent peers so that that logic is in once place.
2021-11-04 13:08:50 +02:00
Elle Mouton
789f00746b
server: cleanup persistentPeerAddr when pruned
Delete all the stored addresses from the persistentPeerAddr map when we
prune the persistent peer.
2021-11-04 13:05:40 +02:00
Oliver Gugger
0a2ccfc52b
multi: use single read transaction for path finding
This commit partially reverts bf27d05a.
To avoid creating multiple database transactions during a single path
finding operation, we create an explicit transaction when the cached
graph is instantiated.
We cache the source node to avoid needing to look that up for every path
finding session.
The database transaction will be nil in case of the in-memory graph.
2021-10-22 09:32:49 +02:00