Commit Graph

160 Commits

Author SHA1 Message Date
yyforyongyu
3ed579d06f
funding: make failFundingFlow takes both channel IDs
This commit adds a new struct `chanIdentifier` which wraps the pending
channel ID and active channel ID. This struct is then used in
`failFundingFlow` so the channel ID can be access there.
2023-08-09 01:29:18 +08:00
yyforyongyu
e46bd8e177
multi: add AddPendingChannel to peer interface
The funding manager has been updated to use `AddPendingChannel`. Note
that we track the pending channel before it's confirmed as the peer may
have a block height in the future(from our view), thus they may start
operating in this channel before we consider it as fully open.

The mocked peers have been updated to implement the new interface method.
2023-08-09 00:17:22 +08:00
Slyghtning
47bcf7af69
funding: add all parameters to batch open channel 2023-07-26 09:49:22 +02:00
Slyghtning
e4f0e58214
lnd: handles selected outpoints in parseOpenChannelReq 2023-07-24 13:06:59 +02:00
Olaoluwa Osuntokun
86e7b4e1e0
Merge pull request #7794 from yyforyongyu/prepare-channel-ready-fix
brontide: refactor peer to prepare channel ready fix
2023-07-04 12:39:59 -07:00
yyforyongyu
a66d42c682
funding: use SyncMap to simplify map usage 2023-06-27 20:19:37 +08:00
ziggie
39f9673bc7
lnd: update defaultMaxLocalCSVDelay
Make sure our default local csv delay maximum is symetric
compared  to the remote default csv maximum.
2023-06-26 23:39:45 +02:00
Oliver Gugger
cf1f44ab10
Merge pull request #7689 from guggero/housekeeping
Housekeeping (fix small issues, take over stale contributor PRs)
2023-06-13 17:42:53 +02:00
Oliver Gugger
56dba2df03
multi: update linter, fix new issues 2023-06-13 11:58:33 +02:00
Maxwell Sayles
9dea695079 funding: make MaxWaitNumBlocksFundingConf public to be used to compute
`FundingExpiryBlocks`.
2023-06-12 10:04:04 -07:00
shaurya947
db44924c5a
lnwallet: add Memo to InitFundingReserveMsg
We also pass the value of Memo from funding/manager.go.
2023-05-18 13:02:30 -04:00
shaurya947
7c6faa4c98
funding: add Memo to InitFundingMsg struct
We add byte-array field called Memo to the InitFundingMsg struct.
We also provide a value for this from
rpcserver.go#parseOpenChannelReq().
2023-05-18 13:02:30 -04:00
Matt Morehouse
a8a50f32f5
funding: fix channel type negotiation bug
The bug manifests when a nil ChannelType is passed to the funding
manager in InitFundingMsg. A default value for ChannelType is selected
and sent in the OpenChannel message. However, a nil ChannelType is
stored in the reservation context. This causes our ChannelType checks in
handleFundingAccept to be bypassed.

Usually this makes us end up in the "peer unexpectedly sent explicit
ChannelType" case, where we can still recover by reselecting a default
ChannelType and verifying it matches the one the peer sent. But if the
peer sends a nil ChannelType, we miss it.

While fixing the bug, I also tried to simplify the negotiation logic, as
the complexity is likely what hid the bug in the first place.

Now negotiateCommitmentType only returns the ChannelType to be used in
OpenChannel/AcceptChannel and the CommitmentType to pass to the wallet.
It will even return a nil ChannelType when we're supposed to use implicit
negotiation, so we don't need to manually set it to nil for OpenChannel
and AcceptChannel.
2023-05-17 11:28:40 -05:00
Matt Morehouse
0ae9c63d64
funding: make expectsChanType a pointer
This allows us to expect chanType to be nil, which will be possible
after the next commit.
2023-05-17 11:27:41 -05:00
Matt Morehouse
34186dee19
funding: remove incorrect and repetitive comments
We don't actually do the logging described in the first comment, and the
second comment block repeats much of the first comment block.
2023-05-17 11:27:41 -05:00
Matt Morehouse
e59cd7f91d
funding: stop naming commit types chanType
negotiateCommitmentType returns both a chanType and a commitType, so it
is really confusing when the commitType is called chanType instead.
2023-05-17 11:27:41 -05:00
Matt Morehouse
ec85b5be72
funding: rename channelType parameter
This prevents us from confusing the channelType parameter with the
chanType local.
2023-05-17 11:27:41 -05:00
Oliver Gugger
8df4edef1b
Merge pull request #7624 from ellemouton/marshalBytesAndStringTxid
multi: populate both string and byte TXID in lnrpc.Outpoint
2023-05-08 17:32:54 +02: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
Elle Mouton
ef17b12a86
funding: update "funding locked" in error string
Replace a few uncaught instances of "funding locked" found in error
strings with "channel_ready"
2023-04-27 20:03:44 +02:00
Elle Mouton
9ea3f55694
multi: update "funding locked" comments
Replace a few un-caught instances of "funding locked" in some comments
with "channel_ready"
2023-04-27 20:02:34 +02:00
Elle Mouton
7b186716a1
multi: populate both string and byte TXID in lnrpc.Outpoint
This commit adds a a new `MarshalOutPoint` helper in the `lnrpc` package
that can be used to convert a `wire.Outpoint` to an `lnrpc.Outpoint`.
By using this helper, we are less likely to forget to populate both the
string and byte form of the TXID.
2023-04-24 16:19:26 +02:00
Elle Mouton
784dc8d530
funding: use default fwding policy if persisted values not found
In this commit, a bug is fixed in the funding manager that could result
in the funding process erroring out if the persisted initial forwarding
policy is not found. This could occur if a node restarts after opening a
channel that is not yet fully confirmed and also upgrades their node
from a pre-0.16 version to 0.16 since the values are only expected to be
persisted after 0.16.
2023-04-19 11:51:32 +02: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
Oliver Gugger
68881f5c20
funding: refactor manager test 2023-04-18 09:40:17 +02:00
Torakushi
0445fef7ad
funding: use p2tr by default for batch_open_channel
In LND v0.15.1, batch_open_channel used p2tr by default
for change output. However, in a later version, a breaking
change has been fixed in FundPSBT to make the change type
configurable (default to p2wkh). As batch_open_channel
uses FundPsbt, we need to put back p2tr as default for
change output
2023-04-17 17:37:51 +02:00
Slyghtning
94900acaa0 funding unit: fundmax sanity check for new channel commitment types. 2023-04-05 23:10:04 +02:00
Slyghtning
5d88693852 lnd+lnwallet: fundmax flag for openchannel 2023-04-05 23:09:11 +02:00
Bjarne Magnussen
0e5b3e77cb lnd: handles the FundMax field inside parseOpenChannelReq
Adds handling of the `FundMax` field when parsing an
`OpenChannelRequest` with `rpcServer.parseOpenChannelReq`.
2023-04-05 23:05:07 +02:00
yyforyongyu
dc3f83c670
funding+lnwire: rename and fix make lint
Fix linter and rename `funding_locked.go` to `channel_ready.go`
2023-03-17 18:21:59 +08:00
yyforyongyu
d4ad5f362f
funding: replace fundingLocked found in docs
This commit is created by running,
```shell
find . -name "*.go" -exec sed -i '' 's/fundingLocked/channelReady/g' {} \;
```
2023-03-17 18:21:59 +08:00
yyforyongyu
465285efb8
funding: replace fundingLocked with channelReady 2023-03-17 18:21:59 +08:00
yyforyongyu
6b9217acfc
multi: replace FundingLocked related docs
This commit replaces `FundingLocked` found in docs using the following
command,
```shell
find . -name "*.go" -exec sed -i '' 's/FundingLocked/ChannelReady/g' {} \;
find . -name "*.go" -exec sed -i '' 's/FundingLock/ChannelReady/g' {} \;
```
2023-03-17 18:21:59 +08:00
yyforyongyu
f8a8326141
multi: replace FundingLocked and funding_locked strings
This commit is created by running the following commands,
```shell
find . -name "*.go" -exec sed -i '' 's/\"FundingLocked/\"ChannelReady/g' {} \;
find . -name "*.go" -exec sed -i '' 's/FundingLocked\"/ChannelReady\"/g' {} \;
find . -name "*.go" -exec sed -i '' 's/\ funding_locked/\ channel_ready/g' {} \;
```
2023-03-17 18:21:59 +08:00
yyforyongyu
015446559b
funding+lnwire: rename FundingLocked related tests
This commit is created by running the following commands,

```shell
gofmt -d -w -r 'fundingLockedAlice -> channelReadyAlice' .
gofmt -d -w -r 'fundingLockedBob -> channelReadyBob' .
gofmt -d -w -r 'assertHandleFundingLocked -> assertHandleChannelReady' .
gofmt -d -w -r 'assertFundingLockedSent -> assertChannelReadySent' .
gofmt -d -w -r 'aliceFundingLocked -> aliceChannelReady' .
gofmt -d -w -r 'bobFundingLocked -> bobChannelReady' .
gofmt -d -w -r 'FuzzFundingLocked -> FuzzChannelReady' .
gofmt -d -w -r 'newMsgFundingLocked -> newMsgChannelReady' .
gofmt -d -w -r 'TestFundingManagerReceiveFundingLockedTwice -> TestFundingManagerReceiveChannelReadyTwice' .
gofmt -d -w -r 'TestFundingManagerRestartAfterReceivingFundingLocked -> TestFundingManagerRestartAfterReceivingChannelReady' .
```
2023-03-17 18:21:59 +08:00
yyforyongyu
539cae1999
multi: rename fundingLockedMsg to channelReadyMsg
This commit is created by running,
```shell
gofmt -d -w -r 'fundingLockedMsg -> channelReadyMsg' .
```
2023-03-17 18:21:59 +08:00
yyforyongyu
112dc1faca
funding: rename FundingLocked related functions and variables
This commit is created by running the following commands,
```shell
gofmt -d -w -r 'sendFundingLocked -> sendChannelReady' .

gofmt -d -w -r 'handleFundingLockedMtx -> handleChannelReadyMtx' .

gofmt -d -w -r 'handleFundingLockedBarriers -> handleChannelReadyBarriers' .

gofmt -d -w -r 'receivedFundingLocked -> receivedChannelReady' .

gofmt -d -w -r 'handleFundingLocked -> handleChannelReady' .

gofmt -d -w -r 'fundingLockedSent -> channelReadySent' .

gofmt -d -w -r 'checkPeerFundingLockInterval -> checkPeerChannelReadyInterval' .
```
2023-03-17 18:21:58 +08:00
yyforyongyu
2dc08a2a76
multi: rename NewFundingLocked to NewChannelReady
This commit is created by the following command,

```shell
gofmt -d -w -r 'NewFundingLocked -> NewChannelReady' .
```
2023-03-17 18:21:58 +08:00
yyforyongyu
1b7c56b2ed
multi: rename FundingLocked to ChannelReady
This commit is created by running,

```shell
gofmt -d -w -r 'FundingLocked -> ChannelReady' .

gco master channeldb/migration
```
2023-03-17 18:21:58 +08:00
yyforyongyu
3f6315242a
funding: fix itest flake with pending channels 2023-02-24 01:35:16 +08:00
yyforyongyu
edba938996
multi: add new build tag integration
This commit adds a new build tag `integration` and removes the old tag
`rpctest` for clarity. Multiple unnecessary usages of `build !rpctest`
is also removed.
2023-02-23 21:56:09 +08:00
bitromortac
dd5273c88c
multi: rename due to required maxHTLC bit
We rename `ChanUpdateOptionMaxHtlc` to `ChanUpdateRequiredMaxHtlc`
as with the latest changes it is now required.

Similarly, rename `validateOptionalFields` to
`ValidateChannelUpdateFields`, export it to use it in a later commit.
2023-02-21 11:10:39 +01:00
Oliver Gugger
e4f3a35c0c
funding: fix peer key serialization in log message 2023-02-07 22:15:09 +01:00
yyforyongyu
f9ede5af73
funding+lnwallet: add more debug logs 2023-01-17 07:26:57 +08:00
Slyghtning
b47cf7e871 funding: code style cleanup for the funding package 2023-01-12 22:40:51 +10:30
Elle Mouton
d4a49b08f5
funding: check error to avoid panic during test
This commit, the error returned from `getInitialFwdingPolicy` is checked
in order to avoid a nil pointer dereference panic during the
TestFundingManagerCustomChannelParameters test.
2022-12-22 10:06:42 +02:00
Oliver Gugger
55b53555e9
multi: improve readability of goroutine defers
This commit fixes the readability of some of the defer calls in
goroutines by making sure the defer stands out properly.
2022-11-21 13:54:24 +01:00
yyforyongyu
5805363867
funding: mark tx label before notifying channel open event 2022-11-15 18:58:26 +08:00
yyforyongyu
4b558c3af5
funding: decrease checking interval to be 10ms in itest
When waiting for the peer to send us FundingLocked, we check whether
we've received this message periodically. This commit changes the
checking interval from 1s to 10ms in itest, which allows us to still
stop the CPU spike while responding to the message quickly.
2022-11-10 13:59:14 +08:00
yyforyongyu
8761a9a056
funding: wait for one sec if funding locked is not received 2022-11-02 02:02:49 +08:00
Tony Giorgio
09537596fc
funding+lnwire: remove ErrSynchronizingChain 2022-10-28 10:06:59 -05:00
positiveblue
4d4d8e480c
multi: stop casting peer warning messages as errors
Split the logic for processing `error` and `warning` messages from our
peers.
2022-10-26 08:09:08 -07:00
Oliver Gugger
d2d3cf3408
Merge pull request #6956 from ellemouton/configureChanReserve
multi: configurable remote chan reserve
2022-10-13 15:39:40 +02:00
Eng Zer Jun
19b1eb9617
funding: replace defer cleanup with t.Cleanup
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2022-10-13 17:47:03 +08:00
Matt Morehouse
768854aac9
funding: create waitForPeerOnline helper
Simplifies and deduplicates the code.
2022-10-11 11:59:01 -05:00
Elle Mouton
eeed3e6f39
funding: fix formatting of comments of InitFundingMsg 2022-10-07 14:57:05 +02:00
Roei Erez
6467b0ee12
funding: enable configurable channel reserve
In this commit, the channel reserve of an initiated channel is made to
be optionally configurable.
2022-10-07 14:57:05 +02:00
Elle Mouton
10f0eddd51
multi: verify channel constraints on funding request
In this commit, the sanity checks in the CommitConstraints method is
moved out into a helper function called VerifyConstraints. This is done
so that the sanity checks can be performed more easily else where in the
code base. The new helper method is then called in the
handleInitFundingMsg method of the funding manager before the
OpenChannelMessage is sent.
2022-10-07 14:57:05 +02:00
eugene
79e618268d
funding: ignore maxWaitNumBlocksFundingConf for zero conf channels
This is so that if the funding transaction hasn't been confirmed
in 2016 blocks, the channel isn't marked as closed by the responder.
2022-10-06 19:34:54 -04:00
Slyghtning
6ea89a51af unit: openchannel fee update and db tests 2022-09-29 08:31:48 -04:00
Slyghtning
e87412bd63 funding+channeldb: handle and persist channel fees 2022-09-29 08:21:06 -04:00
Matt Morehouse
54474d5cd7
funding: fix potential data race
localDiscoverySignals needs to be guarded by its mutex.  I was unable to
write a test case that would trigger a race under the race detector, but
better safe than sorry.
2022-09-19 10:55:45 -05:00
Eng Zer Jun
4f1e4ff87a
funding: use T.TempDir to create temporary test directory
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2022-08-24 08:58:16 +08:00
eugene
16067ca908
funding: defer sending channel_update until received funding_locked
This is required by BOLT#07 as otherwise the counter-party will
discard the channel_update as they may not consider the channel
"ready" or reorg-safe. Most other implementations besides eclair
have work-arounds for this, but it is nice to be spec-compliant.
2022-08-12 17:48:25 -04:00
eugene
c2a4a9adbc
multi: add zeroconfacceptor that default rejects if no rpc acceptors
This is a safety mechanism so that zero-conf channels are not accepted
by default if no rpc acceptor exists.
2022-08-12 16:30:42 -04:00
Olaoluwa Osuntokun
a1cd7734d8
Merge pull request #6633 from Roasbeef/segwit-any-shutdown
multi: send P2TR addrs by default for co-op close, add new `option_any_segwit` feature bit
2022-08-11 17:05:31 -07:00
Olaoluwa Osuntokun
99d37f254e
funding: send taproot addrs as upfront shutdown if ShutdownAnySegwitOptional is active 2022-08-10 18:44:33 -07:00
Olaoluwa Osuntokun
3263dbf96a
Merge pull request #6816 from Crypt-iQ/zero-conf-doc
docs: add zero-conf channels doc
2022-08-10 18:37:51 -07:00
eugene
5bd6498029
funding: remove TODO 2022-08-10 14:25:09 -04:00
Olaoluwa Osuntokun
08f1c2e93a
chainntfns: add new option for conf notifications to send block
In this commit, we add a new option for the existing confirmation
notification system that optionally allows the caller to specify that a
block should be included as well.

The only quirk w/ the implementation here is the neutrino backend:
usually we get filtered blocks, we so need to first fetch the block
again so we can deliver the full block to the notifier. On the notifier
end, it'll only be checking for the transactions we care about, to
sending a full block doesn't affect the correctness.

We also extend the `testBatchConfirmationNotification` test to assert
that a block is only included if the caller specifies it.
2022-08-01 19:59:21 -07:00
eugene
a01017cffd
funding: revert earlier change for LDK compatibility
This removes the requirement that the zero-conf channel acceptor
flow use anchors. Also adds a fail-early check for minimum depth
zero in the non zero conf case. It would fail later, but it makes
more sense to fail immediately when receiving AcceptChannel.
2022-07-07 17:10:31 -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
c9f5912601
channeldb: BigSize migration, store zero-conf, scid-alias bits
This introduces a BigSize migration that is used to expand the width
of the ChannelStatus and ChannelType fields. Three channel "types"
are added - ZeroConfBit, ScidAliasChanBit, and ScidAliasFeatureBit.
ScidAliasChanBit denotes that the scid-alias channel type was
negotiated for the channel. ScidAliasFeatureBit denotes that the
scid-alias feature bit was negotiated during the *lifetime* of the
channel. Several helper functions on the OpenChannel struct are
exposed to aid callers from different packages.

The RefreshShortChanID has been renamed to Refresh.

A new function BroadcastHeight is used to guard access to the
mutable FundingBroadcastHeight member. This prevents data races.
2022-07-07 17:10:27 -04:00
Tommy Volk
9a10c80bcb multi: move many t.Fatalf calls to require.NoError 2022-06-17 04:26:55 +00: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
1aaa1d89bb
funding: fix make lint 2022-02-11 21:17:03 +08:00
yyforyongyu
1ad6bbfbc2
multi: add logs when subservers are starting
Also unified the log messages.
2022-02-11 21:17:03 +08:00
Oliver Gugger
895a2e497b
multi: formatting and comment fixes 2022-02-10 11:02:02 +01:00
Dimitris Apostolou
530a2059e5
multi: Fix typos [skip ci] 2022-01-24 12:19:02 +02:00
yyforyongyu
1c3cabee7f
funding: add explicit log to avoid confusion 2022-01-05 04:27:32 +08:00
yyforyongyu
6f4a9d8661
funding: add String method for channelOpeningState
The newly added String method can be helpful in reading logs.
2022-01-05 04:27:32 +08:00
Olaoluwa Osuntokun
99f79ea507 funding: always send a channel type in explicit mode
In this commit, we switch to always sending a channel type when we're in
explicit mode. This is compatible with prior versions of lnd as they
won't send a channel type, and we'll just arrive at the same type via
the existing implicit funding.

Fixes https://github.com/lightningnetwork/lnd/issues/6067
2021-12-15 16:36:28 -08:00
Olaoluwa Osuntokun
f630cfd4d7 funding: ensure a local funding w/ explicit type can't be downgraded
In this commit, we fix an API inconsistency introduced by a recent fix.
Without this commit, it would be possible for a local user to attempt an
explicit funding type, but then _fallback_ to implicit negotiation if
the remote party didn't have the bit set.

We resolve this by adding a new bit of information to ensure that if
we're the funder and want explicit chan negotiation, we don't settle
for anything less. A new test case has been added to exercise this
behavior.

To recap for posterity, the following issues were found and fixed in the
negotiation logic:

  1. If the remote party sent a channel type (in accept channel), but we
     didn't, then we would error out. We no longer error out and instead
     ensure the channel type they sent matches what we derived via
     implicit funding.

  2. If the remote party _did not_ have the bit set, but they sent a
     chan type (in open channel), we would error out. We no longer error
     out, but instead will fall back to implicit negotiation.

Ultimately we want to eventually flip the explicit funding bit to
_required_ to eliminate any other future ambiguities and also ensure
that it isn't possible to inadvertently fall back to implicit funding,
when the _user_ expects explicit funding.
2021-11-24 14:32:55 -06:00
Oliver Gugger
328e3361ff
funding: don't fail flow on channel type 2021-11-24 17:51:44 +01:00
Oliver Gugger
6ee7913662
funding: don't negotiate on known types 2021-11-24 17:51:44 +01:00
Wilmer Paulino
564ec0fd9b
funding+lnwallet: support funding new script enforced leased channels 2021-10-19 18:30:22 -07:00
Oliver Gugger
6093393e2f
multi: refactor SignMessage to specify hashing 2021-10-14 15:42:44 +02:00
Oliver Gugger
e79d59dd4c
multi: use key locator for lnwallet.MessageSigner
To simplify the message signing API even further, we refactor the
lnwallet.MessageSigner interface to use a key locator instead of the
public key to identify which key should be signed with.
2021-10-08 12:06:52 +02:00
Oliver Gugger
51d19dad87
Merge pull request #5363 from guggero/psbt-no-final-tx
Allow skipping `PsbtFinalize` step during channel funding to support external broadcast
2021-10-04 12:37:51 +02:00
Oliver Gugger
692ea25295
Merge pull request #5642 from guggero/in-memory-graph
In-memory graph cache for faster pathfinding
2021-10-04 11:20:23 +02:00
Oliver Gugger
1608faf199
multi: allow skipping the PSBT finalize step
The FundingPsbtFinalize step is a safety measure that assures the final
signed funding transaction has the same TXID as was registered during
the funding flow and was used for the commitment transactions.
This step is cumbersome to use if the whole funding process is completed
external to lnd. We allow the finalize step to be skipped for such
cases. The API user/script will need to make sure things are verified
(and possibly cleaned up) properly.
2021-10-04 11:17:08 +02:00
Oliver Gugger
0b4e03f5fc
multi: add golang 1.17 compatible build tags
With go 1.17 a change to the build flags was implemented:
https://go.googlesource.com/proposal/+/master/design/draft-gobuild.md

The formatter now automatically adds the forward-compatible build tag
format and the linter checks for them, so we need to include them in our
code.
2021-09-29 17:31:37 -07:00
eugene
950063840a
funding+lnwallet: validate ChannelReserve is above DustLimit
This is necessary and is implied by BOLT#02. Both ChannelReserve
parameters should be above both DustLimit parameters. Otherwise,
it is possible for one side to have nothing at stake.
2021-09-29 13:33:12 -04:00
eugene
fdcd726f9a
multi: replace DefaultDustLimit with script-specific DustLimitForSize
This commit updates call-sites to use the proper dust limits for
various script types. This also updates the default dust limit used
in the funding flow to be 354 satoshis instead of 573 satoshis.
2021-09-29 13:33:10 -04:00
Andras Banki-Horvath
11cf4216e4
multi: move all channelstate operations to ChannelStateDB 2021-09-29 17:00:03 +02:00
Oliver Gugger
c1f686f860
channeldb+funding: move opening channel state to DB
The funding manager doesn't need to know the details of the underlying
storage of the opening channel state, so we move the actual store and
retrieval into the channel database.
2021-09-29 17:00:02 +02:00
Oliver Gugger
84035f1fb2
funding: add batch funding function 2021-09-02 12:13:42 +02:00
Olaoluwa Osuntokun
ad758d8499
funding: use explicit commitment type negotiation when possible
In this commit, we modify the existing logic that defaults to implicit
commitment type negotiation to support explicit negotiation if the new
feature bit is set. This change allows us to ditch the notion of a
"default" commitment type, as we'll now use feature bits to signal our
understanding of a commiment type, but allow peers to select which
commitment type they actually wish to use.

In addition, this explicit negotiation removes the need for using the
required bit of any commitment types. Instead, if an implementation
wishes to no longer support a commitment type, they should simply stop
advertising the optional bit.
2021-08-30 19:17:37 -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
Olaoluwa Osuntokun
5a9f499dd5
rpc: add new commitment_type field to OpenChannelRequest
This field will be examined later down the stack along with the set of
feature bits to determine if explicit channel commitment type
negotiation is possible or not.
2021-08-30 19:17:28 -07:00