Commit Graph
100 Commits
Author SHA1 Message Date
yyforyongyu 765714e750 htlcswitch: add processLocalUpdateFulfillHTLC 2025-07-03 19:50:29 +08:00
yyforyongyu c42bf9b545 htlcswitch: log err in the end in handleUpstreamMsg 2025-07-03 19:50:29 +08:00
yyforyongyu 87b490dfc4 htlcswitch: add processRemoteError and processRemoteUpdateFee 2025-07-03 19:50:29 +08:00
yyforyongyu 4017104475 htlcswitch: add processRemoteRevokeAndAck 2025-07-03 19:50:29 +08:00
yyforyongyu 04abf96f60 htlcswitch: add processRemoteCommitSig 2025-07-03 19:50:29 +08:00
yyforyongyu ad1566ee3f htlcswitch: add processRemoteUpdateFailHTLC 2025-07-03 19:50:29 +08:00
yyforyongyu e883a51a63 htlcswitch: add processRemoteUpdateFailMalformedHTLC 2025-07-03 19:50:28 +08:00
yyforyongyu f9df5a9f51 htlcswitch: add processRemoteUpdateFulfillHTLC 2025-07-03 19:50:28 +08:00
yyforyongyu 212262bf88 htlcswitch: add processRemoteUpdateAddHTLC 2025-07-03 19:50:28 +08:00
yyforyongyu 83f658f714 htlcswitch: remove TODO and nolint
This old TODO is no longer relevant.
2025-07-03 19:50:28 +08:00
yyforyongyu 3af8281370 htlcswitch: add handler resumeLink 2025-07-03 19:50:25 +08:00
yyforyongyu ca770bb4af htlcswitch: notify channel active after reforwarding
The channel should only be considered active when its pending tasks are
finished, which includes,
1. sync channel state via reestablish.
2. send previous shutdown msg.
3. reset the mailbox's packets.
4. reforwarding logs loaded from restart.

When the above tasks are finished, the channel can be considered as
fully resumed from its previous disconnection.
2025-07-03 18:31:13 +08:00
yyforyongyu 09022b5f56 htlcswitch: add handler toggleBatchTicker 2025-07-03 18:31:12 +08:00
yyforyongyu cccb447439 htlcswitch: add handler handleUpdateFee 2025-07-03 18:31:12 +08:00
yyforyongyu e8b2035484 htlcswitch: add handler handleQuiescenceReq 2025-07-03 18:31:12 +08:00
yyforyongyu 30f9257a6b htlcswitch: add handler handleHtlcResolution 2025-07-03 18:31:12 +08:00
yyforyongyu 43ea309f2c lnrpc: update description for RoutingPolicy.CustomRecords 2025-07-01 19:59:51 +08:00
yyforyongyu 9ed32bddf3 docs: update release notes for 0.20 2025-07-01 19:59:50 +08:00
yyforyongyu 650e72518c rpcserver: remove duplicate info from RoutingPolicy
We remove the inbound fee record from `RoutingPolicy.CustomRecords` as
we already have fields `InboundFeeBaseMsat` and `InboundFeeRateMilliMsat`.
2025-07-01 19:59:50 +08:00
yyforyongyu 624dc6c26a lntest: assert CustomRecords fields on channel policy
Make sure the `CustomRecords` field is asserted.
2025-07-01 19:59:50 +08:00
yyforyongyu bef90c6a84 watchtower: fix logging and add comments 2025-06-27 19:01:33 +08:00
yyforyongyu c64e3a6c34 lnwire: fix linter 2025-06-25 14:53:22 +08:00
yyforyongyu 828486e35a lnwire: fix unit test for DynCommit 2025-06-25 14:53:20 +08:00
yyforyongyu 8456aef9eb gitignore: ignore test data from rapid 2025-06-25 02:50:51 +08:00
yyforyongyu 42089b19d6 lnwire: add DynCommit message to match spec 2025-06-25 01:10:54 +08:00
yyforyongyu 0e247641d7 itest: document and fix a wallet utxo flake 2025-06-23 22:18:54 +08:00
yyforyongyu 2c73a3fa7c itest: remove extra UTXO used in sweeping tests
Given #8786 is now fixed, we no longer need extra UTXOs in these tests.
2025-06-23 22:18:31 +08:00
Yong 09df5894d0 Merge pull request #9947 from yyforyongyu/export-itest-db
lntest: add a flag to export data generated during the test
2025-06-23 21:33:31 +08:00
yyforyongyu 3b84088d4a multi: enable passing flag basedir to make itest 2025-06-23 17:29:26 +08:00
yyforyongyu 343ae963b0 lntest: add a new basedir flag to keep test data 2025-06-23 17:29:26 +08:00
yyforyongyu 0d20e96e96 lntest: create GenBaseDir to generate the base dir 2025-06-23 17:28:48 +08:00
Yong 5ebb29309e Merge pull request #9977 from starius/itest-bitcoind-neutrino
lntest: enable neutrino testing with bitcoind
2025-06-23 17:08:18 +08:00
Yong a3209a5bfa Merge pull request #9950 from starius/describegraph-authproofs2
lnrpc: add auth_proof to graph APIs
2025-06-20 14:54:03 +08:00
yyforyongyu e47091063a config: update docs for num-restricted-slots 2025-06-19 20:29:38 +08:00
yyforyongyu 250a61af6d lnd: remove peer from peerChanInfo when necessary
We now remove the peer from `peerChanInfo` if this peer doesn't have
channels with us. Also patched a unit test for `removePeerAccess`.
2025-06-19 20:23:46 +08:00
yyforyongyu 32d8e2123d channeldb+lnd: rename peerCounts to peerChanInfo for clarity 2025-06-19 16:48:13 +08:00
yyforyongyu 03de0f9e4b funding+lnd: make sure accessman won't interrupt funding flow
If there's an error occured when updating the peer's status after the
channel status is changed, we now make sure we log the error instead of
letting it interrupt the channel open/close flow.
2025-06-19 16:05:59 +08:00
yyforyongyu 0dc10ba692 accessman+lnd: rename checkIncomingConnBanScore for clarity 2025-06-19 16:05:59 +08:00
yyforyongyu 869e541b7c docs: add release notes for improved accessman 2025-06-19 16:05:59 +08:00
yyforyongyu 9caa5f220d itest+lntest: add more itest for accessman 2025-06-19 16:05:59 +08:00
yyforyongyu e003cb5d4a accessman: make sure to decrement PendingOpenCount 2025-06-19 16:05:56 +08:00
yyforyongyu b0aa4ae2de chainio: use package logger instead of instance logger
There's no guarantee that the `b.beat` is initialized when the
dispatcher shuts down, especially with the case in the remote signer
where no chainbackend is created.
2025-06-18 19:43:27 +08:00
yyforyongyu 856ec463ff accessman: skip incrementing num of slots for existing peer
When a peer is already existing, we should skip incrementing the
`numRestricted` count.

Also patched unit test for method `addPeerAccess`.
2025-06-18 17:19:10 +08:00
yyforyongyu 0f9332b1d6 lnd: add string representation for peerAccessStatus 2025-06-18 17:19:10 +08:00
yyforyongyu 0c5bb49561 lnd: only restrict slots for inbound connections
For outbound connections, since they are initialized by the users, we
can relax on the restriction. A future global limit may be added - as
for now, we will let them to be managed by the users.
2025-06-18 17:19:10 +08:00
yyforyongyu 00db8c6359 lnd: move peer perms assignment into peerConnected
When the callback is called in `scheduledPeerConnection`, it is
referencing the old `access` variable which was created when the peer
was first connected. However, if this peer opens a channel with us and
goes offline, or another inbound connection is made from this peer, we
may still use the old `access` value. To fix it, we need to make sure we
always get the fresh perm by calling `assignPeerPerms` inside
`peerConnected`.
2025-06-18 17:19:10 +08:00
yyforyongyu d8d468f459 accessman: reduce lock span by excluding ctx 2025-06-18 17:19:10 +08:00
yyforyongyu 124aabcdb7 accessman+lnd: check if a peer is found in peerScores
We need to also check this map to make sure the peer exists or not.
2025-06-18 17:19:09 +08:00
yyforyongyu 836b527a4e accessman: skip restriction for existing peers
When a peer already has a connection with us, there's no need to check
for available slots as we will either close the old conn or refuse the
new conn.
2025-06-18 17:19:09 +08:00
yyforyongyu 599650fa2d lncfg+lnd: add new dev config unsafeconnect
This flag is added so we can use it in the itest to mimic racing inbound
and outbound connections.
2025-06-18 17:19:09 +08:00
yyforyongyu cc7ed5a9d2 lncfg: fix typo 2025-06-18 17:19:09 +08:00
yyforyongyu 2defb116cc docs: update release notes 2025-06-17 21:44:15 +08:00
yyforyongyu 755bb09a73 htlcswitch: skip decoding hop if the htlc is already acked
We now move the check earlier in the loop so we don't even need to
decode the hop for already processed ADDs.
2025-06-17 11:39:38 +08:00
yyforyongyu e3f95dcd09 htlcswitch: remove batchReplayBkt
This commit removes the `batchReplayBkt` as its only effect is to allow
reforwarding htlcs during startup.

Normally for every incoming htlc added, their shared secret is used as
the key to be saved into the `sharedHashBucket`, which will be used for
check for replays. In addition, the fwdPkg's ID, which is SCID+height is
also saved to the bucket `batchReplayBkt`. Since replays of HTLCs cannot
happen at the same commitment height, when a replay happens,
`batchReplayBkt` simply doesn't have this info, and we again rely on
`sharedHashBucket` to detect it. This means most of the time the
`batchReplayBkt` is a list of SCID+height with empty values.

The `batchReplayBkt` was previously used as a mechanism to check for
reforwardings during startup - when reforwarding htlcs, it quries this
bucket and finds an empty map, knowing this is a forwarding and skips
the check in `sharedHashBucket`. Given now we use a bool flag to
explicitly skip the replay check, this bucket is no longer useful.
2025-06-17 11:39:38 +08:00
yyforyongyu 3b9c4eb232 htlcswitch: exit early if the fwdPkg is already completed 2025-06-17 11:39:38 +08:00
yyforyongyu fb95458a1b htlcswitch: skip checking replays for reforwarded packets
We now rely on the forwarding package's state to decide whether a given
packet is a reforwarding or not. If we know it's a reforwarding packet,
there's no need to check for replays in the `sharedHashes` bucket, which
behaves the same as if we are querying the `batchReplayBkt`.
2025-06-17 11:39:37 +08:00
Yong a5c4a7c547 Merge pull request #9921 from yyforyongyu/fix-notification
Use spent height as the rescan start height in `RegisterSpendNtfn`
2025-06-16 20:50:53 +08:00
Yong 94064bed3a Merge pull request #9815 from mohamedawnallah/preventCurrentNodeAnnMutation
server.go: prevent partial mutation of `currentNodeAnn` in `server.genNodeAnnouncement` on `netann.SignNodeAnnouncement` failures
2025-06-16 12:05:44 +08:00
yyforyongyu 46c5715ae5 graph: fix nil pointer deference in ForEachChannelCacheable 2025-06-16 12:02:24 +08:00
Yong fe405426ca Merge pull request #9356 from funyug/add-filters-fwdhistory
lnrpc: add incoming/outgoing channel ids filter to forwarding history request
2025-06-14 08:36:51 +08:00
yyforyongyu adf27196d2 docs: update release notes 2025-06-12 08:30:55 +08:00
yyforyongyu 881e044fe3 chainntnfs: use spent height as height hint if found
Previously when deciding whether a UTXO is spent or not, we accept a
height hint as the starting block to look for the spending tx in the
rescan process. When it's already found spent before the rescan starts,
we will update the height hint to be the spent height, only if the
latter is greater. This means if the user-specified hint is greater than
the actual spending height, this UTXO will never be found as spent. We
now fix it by always using the spent height as the hint.
2025-06-12 08:30:55 +08:00
yyforyongyu 6fb81b2250 chainntnfs: patch debug logs and fix StartHeight
Make sure we patch the `StartHeight` for btcd notifier.
2025-06-12 08:30:54 +08:00
yyforyongyu 870e16bdd7 channeldb+lnwallet: fix typo 2025-06-06 19:55:59 +08:00
yyforyongyu 2cd97fcd6d docs: add release note entry 2025-06-06 19:55:59 +08:00
yyforyongyu 4efd99774e channeldb: add customized encoding for HtlcIndex 2025-06-06 19:55:59 +08:00
yyforyongyu f5ffe82280 lnwallet+channeldb: use BigSizeT to save space 2025-06-06 19:55:58 +08:00
yyforyongyu 26960e36ce htlcswitch+lntest: add more debug logs 2025-06-06 19:40:35 +08:00
yyforyongyu e0b6acb584 docs: update release notes 2025-06-03 22:43:34 +08:00
yyforyongyu 04db1a1c3f lnd: increase DefaultNumRestrictedSlots to 100 2025-06-03 22:43:15 +08:00
yyforyongyu a232c57c8c accessman: patch unit tests 2025-06-03 22:43:14 +08:00
yyforyongyu 704bb736a5 accessman: only check ban score for restricted peers
If a peer has, or used to have a channel with us there's no need to
check for the ban score.
2025-06-03 22:43:14 +08:00
yyforyongyu 142e8dfe26 docs: add release notes 19.1 2025-05-26 21:02:05 +08:00
yyforyongyu 1a877463c7 docs: add release notes template 2025-05-26 19:41:25 +08:00
yyforyongyu 7f375ccd2e gomod: update btcwallet 2025-05-26 19:41:24 +08:00
yyforyongyu f97f60d3d4 lntest+itest: add testBumpFeeExternalInput 2025-05-26 19:41:24 +08:00
yyforyongyu 4cef7b30fe itest: add new file lnd_bump_fee.go
Move bumpfee RPC related tests into one file - these tests focus on
testing the behaivor of the RPC only without any force close context.
2025-05-26 19:41:24 +08:00
Yong f21e3f3ee5 Merge pull request #9772 from yyforyongyu/show-all-inputs
sweep: return all inputs in `PendingSweeps`
2025-04-30 02:24:52 +08:00
yyforyongyu b610678703 docs: update release notes 2025-04-29 14:15:36 +08:00
yyforyongyu 8f936aa9eb itest: update num of sweeps in AssertNumPendingSweeps
Since we now return all sweeps, we need to update the call to include
immature sweeps.
2025-04-29 14:15:31 +08:00
yyforyongyu d991f5659a commands: add new field MaturityHeight 2025-04-29 13:49:22 +08:00
yyforyongyu 94463c6844 walletrpc: add new field MaturityHeight 2025-04-28 21:44:10 +08:00
yyforyongyu 0807ce61a1 sweep: return all inputs from PendingSweeps
Previously we'd skip returning immature inputs to stay backwards
compatible. This has the downside as the node operator cannot take
actions on this input, like some customized batching strategy via
`bumpfee` RPC.

After this change, it means when calling `bumpfee` RPC, it will now
update the params for the immature input instead of returning an error
saying `output does not belong to wallet`.

We also add a `MaturityHeight` field so the user knows when this input
will be swept.
2025-04-28 21:44:10 +08:00
yyforyongyu 3d69d70eba docs: update release notes 2025-04-17 09:36:32 +08:00
yyforyongyu 07583f94ff gomod: update btcwallet 2025-04-17 09:36:28 +08:00
yyforyongyu ab2361b8fb lnd: log lockedBalance in WalletBalance 2025-04-17 09:32:29 +08:00
yyforyongyu 9d7b55ed4f itest: add wallet-related itest 2025-04-17 09:32:28 +08:00
yyforyongyu 0daadb05bf lntest: add SendAllCoins and remove standby nodes context
Standby nodes are no longer used so we update `AssertNumUTXOs` to remove
the confusing check.
2025-04-17 09:32:28 +08:00
Yong 4cf18ee45c Merge pull request #9703 from yyforyongyu/fix-attempt-hash
Patch htlc attempt hash for legacy payments
2025-04-14 21:12:26 +08:00
yyforyongyu 45029d9b6c docs: add development_guidelines.md
This file focuses on the requirements and steps needed to make an
acceptable PR.
2025-04-14 17:08:56 +08:00
yyforyongyu 79ab2b2daf docs: update release notes 2025-04-11 21:52:15 +08:00
yyforyongyu 106e1e91f0 routing: patch the hash field for legacy payments
For legacy payments, the hash field will be nil, and we need to use the
payment identifier instead. We have multiple ways to fix this:

A trivial solution is we can simply call `sharder.GetHash` in
`collectResult`, and pass this hash to `attempt.Circuit()`, which ends
up multiple methods taking the hash. This is bad as it's confusing why
the methods of `HTLCAttempt` need to take another hash value, while
itself already has the info via `HTLCAttempt.Hash`. We don't want an
exceptional case to influence our main flow.

We can then patch the field `HTLCAttempt.Hash`, and set it to the
payment hash if it's nil, which can be done in `collectResult`. This is
also less optimal as it means every htlc attempts, either legacy or not,
now need to bear this context.

The best way to do this is to patch the field in
`reloadInflightAttempts`. As we are sure any new payments made won't be
legacy, and the only source of legacy payments comes from reloading
existing payments.
2025-04-11 21:52:15 +08:00
yyforyongyu 8689eeede4 routing: add regression test to catch the panic 2025-04-11 21:52:14 +08:00
Yong 15dbc43f51 Merge pull request #9627 from yyforyongyu/sweep-under-budget
Sweep inputs even the budget cannot be covered
2025-03-27 13:31:25 +08:00
yyforyongyu ec2f3add6e sweep: remove dead code 2025-03-26 18:24:48 +08:00
yyforyongyu c7bea07d58 sweep: start the sweeping if there are normal inputs
We now start the sweeping process if there are normal inputs to
partially cover the budget.
2025-03-26 18:24:47 +08:00
yyforyongyu b6daa3bad4 docs: update release notes 2025-03-26 18:24:47 +08:00
yyforyongyu 43409c7840 rpcserver: use HtlcIndex as the unique key 2025-03-26 18:24:47 +08:00
yyforyongyu 70dec8e169 lnd: log sync status in GetInfo
This is added to fix a flake found in starting the node.
2025-03-26 18:24:47 +08:00
yyforyongyu 8ad122bd03 itest: add testBumpFeeLowBudget 2025-03-26 18:24:47 +08:00