18414 Commits

Author SHA1 Message Date
Olaoluwa Osuntokun
333492e657 lnwallet: implement special case for OP_RETURN in rbf-coop
In this commit, we implement a special case for OP_RETURN scripts
outlined in the spec. If a party decides that its output will be too
small even after the dust check, then they can opt to set it to zero by sending an `OP_RETURN` as their script.
2025-03-18 11:44:20 -05:00
Olaoluwa Osuntokun
e6d7a1a2ec protofsm: update state machine w/ new spec flow
In this commit, we implement the latest version of the RBF loop as
described in the spec. We remove the self loop back based on sending or
receiving shutdown. Instead, from the ClosePending state, we can trigger
a new loop by sending SendOfferEvent (we bump), or OfferReceivedEvent
(they bump).

We also update the rbf state machine w/ the new close addr logic. This
log ensures that the remote party always sends our current address, and
that if they send a new address, we'll update our view of it, and
counter sign the correct transaction.

We also add a CloseErr state. With this new state, we can ensure that
we're able to properly report errors back to the RPC client, and also
optionally force a reconnection or send a warning to the remote party.
2025-03-18 11:44:20 -05:00
Olaoluwa Osuntokun
14eca4406e lnwire: update closing_complete and closing_sig to latest spec draft
Both these messages now carry the address of both parties, so you can
update an address without needing to send shutdown again.
2025-03-18 11:44:20 -05:00
Olaoluwa Osuntokun
835d7623d4 lnwallet/chancloser: ignore spurious channel flushed events
If we go to close while the channel is already flushed, we might get an extra event, so we can safely ignore it and do a self state transition.
2025-03-18 11:44:20 -05:00
Olaoluwa Osuntokun
27b24ab86a lnwallet/chancloser: add fee rate to ClosePending
This'll be useful to communicate what the new fee rate is to an RPC caller.
2025-03-18 11:44:20 -05:00
yyforyongyu
8b2ade7ec9 lnwallet+protofsm: fix logging 2025-03-18 11:44:20 -05:00
Olaoluwa Osuntokun
baf0d83c37 peer: update chooseDeliveryScript to gen script if needed
In this commit, we update `chooseDeliveryScript` to generate a new
script if needed. This allows us to fold in a few other lines that
always followed this function into this expanded function.

The tests have been updated accordingly.
2025-03-18 11:44:20 -05:00
Olaoluwa Osuntokun
8432e706d3 multi: extract new DeriveHeightHint() function, use for new rbf closer
With this commit, we make sure we set the right height hint, even if the
channel is a zero conf channel.
2025-03-18 11:44:20 -05:00
Olaoluwa Osuntokun
b2794b07cb lnwallet/chancloser: enforce pubkey binding for msg mapper 2025-03-18 11:44:20 -05:00
Olaoluwa Osuntokun
ed8a672bd3 protofsm: update StateMachine to meet new msgmux.Endpoint interface 2025-03-18 11:44:20 -05:00
Olaoluwa Osuntokun
bf3007a2ce multi: thread thru RPC caller context from CloseChannel 2025-03-18 11:44:20 -05:00
Olaoluwa Osuntokun
127d3bed66 input: add new ScriptIsOpReturn helper func 2025-03-18 11:44:20 -05:00
Olaoluwa Osuntokun
29afeb42fb lnd: register protofsm logger 2025-03-18 11:44:20 -05:00
Olaoluwa Osuntokun
a4064c70dc protofsm: don't return error on broadcast fail
We don't return an error on broadcast fail as the broadcast might have
failed due to insufficient fees, or inability to be replaced, which may
happen when one side attempts to unnecessarily bump their coop close
fee.
2025-03-18 11:44:20 -05:00
Olaoluwa Osuntokun
daed552bf1 peer: make a DaemonAdapter impl for lnd
Similar to the last commit, in this commit, we make a daemon adapter
impl for lnd. We'll use this for any future protofsm based state
machine.
2025-03-18 11:44:20 -05:00
Olaoluwa Osuntokun
c32d4f9695 peer: add an implementation of chancloser.ChanObserver
In this commit, we add an implementation of a new interface the rbf coop
state machine needs. We take care to accept interfaces everywhere, to
make this easier to test, and decouple from the concrete types we'll end
up using elsewhere.
2025-03-18 11:44:20 -05:00
Olaoluwa Osuntokun
1d2c22d140 protofsm: add String() method to ProtocolState 2025-03-18 11:44:20 -05:00
Olaoluwa Osuntokun
01382f4c2a htlcswitch: change LinkDirection to be a type alias
In this commit, we change LinkDirection to be a type alias. This makes
creating wrapper structs/interfaces easier, as we don't need to leak
htlcswitch.LinkDirection, instead we can accept a bool.
2025-03-18 11:44:20 -05:00
Olaoluwa Osuntokun
82ac5fa912 feature: set optional bit for rbf-coop close by default 2025-03-18 11:44:20 -05:00
Olaoluwa Osuntokun
752fc86c7d lnwire: add feature bits for new rbf coop close 2025-03-18 11:44:20 -05:00
Olaoluwa Osuntokun
c292acfe74
Merge pull request #9605 from yyforyongyu/fix-unlock-wallet
cmd: fix error parsed from status
2025-03-18 11:37:35 -05:00
András Bánki-Horváth
3e8339cebc
Merge pull request #9606 from bhandras/skip-migration-rename
config: rename skip-sql-invoice-migration to skip-native-sql-migration
2025-03-18 13:56:45 +01:00
Andras Banki-Horvath
55595954ad
config: rename skip-sql-invoice-migration to skip-native-sql-migration
In future releases we will use this flag to make potentially failing kv
to native SQL migrations optional. For this reason it is better to
rename it to avoid confusion.
2025-03-17 16:45:18 +01:00
yyforyongyu
e62aa7d43a
docs: update release notes 2025-03-17 22:59:56 +08:00
yyforyongyu
2d6148291f
cmd: fix error parsed from status
The `codes.Unimplemented` is only returned when the RPCs are not built.
When the wallet is in an unexpected state, `codes.Unknown` is returned
instead, so we need to catch it properly to make sure we return the
right error msg.
2025-03-17 22:59:56 +08:00
Oliver Gugger
053d63e110
Merge pull request #9546 from hieblmi/macaroon-ip-cidr-constraint
macaroons: ip range constraint
2025-03-14 10:22:43 -06:00
Oliver Gugger
c4a77d1b1c
Merge pull request #9502 from guggero/bandwidth-manager-fix
routing: don't set custom amount if manager isn't handling
2025-03-13 13:42:51 -06:00
Oliver Gugger
0044975293
docs: add release notes 2025-03-13 12:27:07 -05:00
Oliver Gugger
dac5de5ce9
htlcswitch+routing: return IsHandled from AuxBandwidth
To make it more clear whether the external traffic shaper is handling a
channel or not, we return an explicit boolean.
2025-03-13 12:26:50 -05:00
Slyghtning
bef0268e07
docs: update release notes 2025-03-13 09:57:41 -05:00
Slyghtning
1681be6d65
lncli: ip range caveat for macaroons 2025-03-13 09:57:41 -05:00
Slyghtning
26a4562263
itest: test for ip range checks for macaroons 2025-03-13 09:57:41 -05:00
Slyghtning
ea9a5a2a71
macaroons: add ip range checker 2025-03-13 09:57:39 -05:00
Oliver Gugger
6531d45050
Merge pull request #9458 from Crypt-iQ/banning_010072025
multi+server.go: add initial permissions for some peers
2025-03-12 08:14:31 -06:00
Eugene Siegel
6309b8a0f4
release-notes: update for 0.19.0 2025-03-11 20:42:35 -04:00
Eugene Siegel
a4acfcb0ef
sample-lnd.conf: update for num-restricted-slots 2025-03-11 20:42:35 -04:00
Eugene Siegel
d5ecad3834
itest: new test to check server access perms 2025-03-11 20:42:35 -04:00
Eugene Siegel
68ec766b61
funding+server.go: modify notifications to pass through server
This modifies the various channelnotifier notification functions
to instead hit the server and then call the notification routine.
This allows us to accurately modify the server's maps.
2025-03-11 20:42:35 -04:00
Eugene Siegel
6eb746fbba
server.go+accessman.go: introduce caches for access permissions
Here we introduce the access manager which has caches that will
determine the access control status of our peers. Peers that have
had their funding transaction confirm with us are protected. Peers
that only have pending-open channels with us are temporary access
and can have their access revoked. The rest of the peers are granted
restricted access.
2025-03-11 20:42:34 -04:00
Eugene Siegel
4cfc92f420
channelnotifier: add FundingTimeout and NotifyFundingTimeout
This signal will be used in the server.go code to potentially
demote temporary-access peers to restricted-access peers.
2025-03-11 20:42:34 -04:00
Eugene Siegel
15f17633aa
channeldb: FetchPermAndTempPeers to load access perms on startup
We introduce a new func FetchPermAndTempPeers that returns two maps.
The first map indicates the nodes that will have "protected" access
to the server. The second map indicates the nodes that have
"temporary" access to the server. This will be used in a future
commit in the server.go code.
2025-03-11 20:42:34 -04:00
Oliver Gugger
5d8309ea6b
Merge pull request #9596 from JoeGruffins/testingbtcwalletchange
deps: Update btcwallet to v0.16.10.
2025-03-11 11:31:25 -06:00
Oliver Gugger
04c76101dd
Merge pull request #9595 from yyforyongyu/fix-gossip-syncer
multi: fix flakes and gossip syncer
tor/v1.1.6
2025-03-11 09:33:05 -06:00
JoeGruff
c8d032afa9 deps: Update btcwallet to v0.16.10. 2025-03-11 11:11:29 +09:00
Oliver Gugger
a673826dee
Merge pull request #9563 from yyforyongyu/fix-unit-test
chanbackup: fix test flake in `TestUpdateAndSwap`
2025-03-10 16:01:57 -06:00
Oliver Gugger
97bba57520
Merge pull request #9597 from guggero/rebase-fix
contractcourt: fix rebase issue with removed variadic option
2025-03-10 15:46:51 -06:00
Oliver Gugger
0e9b7c5fa2
contractcourt: fix rebase issue with removed variadic option
The optional variadic functional parameters probably got lost during a
rebase.
2025-03-10 21:52:02 +01:00
yyforyongyu
faf8ce161a
docs: update release notes 2025-03-10 17:03:00 +08:00
yyforyongyu
d0abfbbaff
itest: remove redundant resume action
Removed a redundant resume action found in
`testForwardInterceptorRestart`, which was put there likely due to a
mistake.
2025-03-10 16:58:16 +08:00
yyforyongyu
51daa13cd7
routerrpc: improve logging in forwardInterceptor 2025-03-10 16:58:16 +08:00