Commit Graph
20027 Commits
Author SHA1 Message Date
ziggieXXX 7bbf26c0e2 Merge pull request #10469 from Roasbeef/lnwire-timestamp-validation
lnwire: enforce non-zero timestamp in gossip messages
2026-01-12 13:57:12 +01:00
Olaoluwa Osuntokun cad1b957bf discovery: enforce non-zero timestamp in gossip messages
In this commit, we add validation for channel updates and node
announcements to ensure that we reject gossip messages with zero
timestamps at the discovery layer.

From BOLT 7:
  "MUST set timestamp to greater than 0, AND to greater than any
  previously-sent channel_update for this short_channel_id."

This validation is performed in the gossip handlers (handleNodeAnnouncement
and handleChanUpdate) rather than at the wire protocol level. This approach
ensures we can still decode messages from disk or embedded in onion errors
while rejecting invalid gossip from peers.

Remote peers sending zero-timestamp gossip will have their ban score
incremented.
2026-01-09 17:10:37 -08:00
ziggieXXX 39a1421d15 Merge pull request #10296 from hieblmi/estimate-inputs
estimatefee: tx fee estimate for selected inputs
2026-01-07 11:45:24 +01:00
Slyghtning 202e473c7f docs: update release notes 2026-01-07 10:30:04 +01:00
Slyghtning 422aa7d182 itest: estimate on-chain fee with selected inputs 2026-01-07 10:30:03 +01:00
Slyghtning 44aa5efc66 cmd: EstimateFee for explicit inputs 2026-01-07 10:25:30 +01:00
Slyghtning 280929ba1e rpcserver: return inputs in EstimateFeeResponse 2026-01-07 10:25:29 +01:00
Slyghtning e5456d39f2 cmd: make types.go accessible in lnd package 2026-01-07 10:25:29 +01:00
Slyghtning 049f2c738d lnrpc: transaction inputs in EstimateFeeRequest 2026-01-07 10:25:28 +01:00
ziggieXXX d5d151cee9 Merge pull request #10462 from ziggie1984/fix-prune-node-race
channeldb: fix race condition in link node pruning
2026-01-07 08:54:33 +01:00
ziggieXXX 99d07fdb78 Merge pull request #10367 from elnosh/rename-endorsement-accountable
multi: rename experimental endorsement signal to accountable
2026-01-06 18:02:22 +01:00
Yong d3ce622bde Merge pull request #10403 from gijswijs/fix-flatmap
Fix FlatMap implementation in Result type
2026-01-06 22:37:18 +08:00
elnosh 6f49bea52b server: remove accountability signal experiment period
In the previous iteration with endorsement
signaling, the recommendation was for the sender to
set it to 1 and that could have had privacy concerns
when first deploying given that the default was to
downgrade the signal to 0. In the latest proposal
the recommended default for both sending and
forwarding nodes is to set `accountable` to 0.
As a result, the dates have been removed given
that there are no privacy risks associated
with relaying the signal with zero values.
2026-01-06 09:12:34 -05:00
elnosh 34329c684e multi: rename experimental endorsement signal to accountable
Renames the endorsement signal to accountable to
match the latest proposal https://github.com/lightning/blips/pull/67
2026-01-06 09:12:31 -05:00
ziggie d9fb9092b6 multi: make sure previous inconsitent states are fixed
We make sure that nodes previously suffering from this error will
have a consitent db view when restarting their node.
2026-01-06 14:34:52 +01:00
ziggie 51f3c6f528 channeldb: fix race condition in link node pruning
This commit fixes a critical race condition in MarkChanFullyClosed and
pruneLinkNode where link nodes could be incorrectly deleted despite
having pending or open channels.

The race occurred because the check for open channels and the link node
deletion happened in separate database transactions:

  Thread A: TX1 checks open channels → [] (empty)
  Thread A: TX1 commits
  Thread B: Opens new channel with same peer
  Thread A: TX2 deletes link node (using stale data)
  Result: Link node deleted despite pending channel existing

This creates a TOCTOU (time-of-check to time-of-use) vulnerability where
database state changes between reading the channel count and deleting
the node.

Fix for MarkChanFullyClosed:
- Move link node deletion into the same transaction as the channel
  closing check, making the check-and-delete operation atomic

Fix for pruneLinkNode:
- Add double-check within the write transaction to verify no channels
  were opened since the caller's initial check
- Maintains performance by keeping early return for common case
- Prevents deletion if channels exist at delete time

This ensures the invariant: "link node exists iff channels exist"
is never violated, preventing database corruption and potential
connection issues.
2026-01-06 10:52:41 +01:00
Gijs van Dam e7b9515edd fn: fix Result[T].FlatMap
For a Result[T], FlatMap should apply f when the result is Ok, and
propagate the error unchanged when it's Err. The original code returns r
on Ok and tries to use r.left when Err, which is wrong. This commit
fixes that.

Secondly, the group of FlatMap/AndThen and OrElse functions and methods
are now properly tested with new unit tests.

fixes #10401
2026-01-06 10:51:49 +01:00
ziggieXXX 801de79cf1 Merge pull request #10476 from ziggie1984/fix-endorsement-testcases
itest: fix endorsement itests
2026-01-05 16:57:46 +01:00
ziggie 5f30797738 itest: fix endorsement itests
Due to the signaling period expiring tests had to be adopted bc
they were not taking the activation time period into account.
2026-01-05 14:28:14 +01:00
ziggieXXX ac006d73cf Merge pull request #10356 from Abdulkbk/ispublicnode-perf
graph: fix inefficient query for IsPublicNode
2026-01-05 10:32:56 +01:00
ziggieXXX eea4840086 Merge pull request #10249 from erickcestari/fix-scid-tlv-length
lnwire+tlv+route: enforce TLV length validation and add tests
2025-12-30 19:31:32 +01:00
Erick Cestari 523002984b docs: add release-notes 2025-12-29 19:19:53 -03:00
Erick Cestari 5a7925008e multi: enforce strict TLV length checks
This commit improves TLV decoding safety and consistency across multiple
packages by enforcing fixed-length requirements and adding unit tests to
prevent malformed TLV records from being accepted.

Changes include:

- lnwire:
  * Enforce 8-byte length in Fee TLV decoder.
  * Enforce PubNonceSize in Musig2Nonce TLV decoder.
  * Enforce 8-byte length in ShortChannelID TLV decoder.
  * Added roundtrip and invalid length tests for Fee, Musig2Nonce,
    and ShortChannelID records.

- routing/route:
  * Enforce Vertex TLV length (33 bytes).
  * Added encode/decode and invalid length tests for Vertex.

- tlv:
  * Enforce correct length in DBytes33 decoder (33 bytes).
  * Added tests ensuring all fixed-size primitive decoders reject
    incorrect TLV lengths.

By strictly validating TLV lengths, we prevent malformed or corrupted
TLV records from being silently accepted, improving protocol safety.
2025-12-29 19:18:49 -03:00
Abdullahi Yunus 68f558c865 docs: add release note 2025-12-24 18:08:46 +01:00
Abdullahi Yunus ac2cec462c graph: use UNION for isPublicNode query
In this commit we updated the IsPublicV1Node query to use UNION
instead of OR, since sqlite struggles to efficiently use
multiple indexes in a single query involving OR conditions across
different columns.

We use UNION ALL since the query doesn't care about duplicates.
2025-12-23 21:04:36 +01:00
Abdullahi Yunus 86cde4b93f graphdb: add benchmark for isPublicNode query
In this commit we add a benchmark to test the performance of
IsPublicNode query.
2025-12-23 21:04:36 +01:00
Yong 013f5c93ed Merge pull request #10455 from ziggie1984/fix-onchain-timeout-terminal
Fix flaky itest multihop testcase
2025-12-22 23:10:09 +08:00
ziggie c493f7d9dd itest: accept NO_ROUTE or TIMEOUT in testLocalClaimOutgoingHTLC
Fix flaky test due to race between channel closure propagation and
payment timeout. Both failure reasons are correct depending on timing.
2025-12-19 00:27:20 +01:00
Yong 91423ee519 Merge pull request #10449 from ziggie1984/bugfix/setsource-node-sql
server: fix timestamp comparison in setSelfNode
2025-12-16 16:58:25 +08:00
ziggie e5b0704d73 docs: add release-notes for LND 20.1 2025-12-16 08:21:11 +01:00
ziggie 865e1556d4 server: fix timestamp comparison in setSelfNode
Fix bug where setSelfNode compared only the seconds component of
timestamps instead of the full timestamp. This caused the node to
attempt persisting an older timestamp than what existed in the
database during restart, resulting in "sql: no rows in result set"
errors.
2025-12-16 08:21:11 +01:00
Olaoluwa Osuntokun 04f6108051 Merge pull request #10446 from ziggie1984/bugfix/backport-workflow
ci: fix some minor issues in the backport ci job
2025-12-15 10:59:36 -08:00
ziggieXXX 06cc0f3aa3 Merge pull request #10448 from ziggie1984/bugfix/fix-comment-lsp-heuristic
routerrpc: fix comment in lsp heuristic
2025-12-15 15:10:09 +01:00
Yong 0cc84d0b00 Merge pull request #10353 from starius/fix-rbf_coop_test
chancloser: stabilize remote RBF coop tests
2025-12-15 14:56:00 +08:00
Boris Nagaev d47d86ce0c chancloser: stabilize remote RBF coop tests
CI started panicking in TestRbfChannelFlushingTransitions/early_offer /
TestRbfCloseClosingNegotiationRemote (see GitHub Actions run
https://github.com/lightningnetwork/lnd/actions/runs/19155841408/job/54756127218?pr=10352)
because the cached remote offer could fire before the test harness
registered its mock CloseSigner expectations. When that happened,
the mock complained that CreateCloseProposal was unexpected:

panic:
assert: mock: I don't know what to return because the method call was unexpected.

Fix this by having assertSingleRemoteRbfIteration take a sendEvent callback
that receives the context and initial offer, so tests can install expectations
first and then fire the event via SendEvent (or the early-offer test's custom
flush sender).

Reproduction (on master)
------------------------
1. Modify lnwallet/chancloser/rbf_coop_test.go
   Add time.Sleep(10 * time.Millisecond) before the first call of
   closeHarness.assertSingleRemoteRbfIteration (in function
   TestRbfChannelFlushingTransitions).

2. go test ./lnwallet/chancloser -run TestRbfChannelFlushingTransitions/early_offer

3. The panic reproduces immediately.
2025-12-14 20:03:43 -03:00
ziggie 5580c40cb0 routerrpc: fix comment in lsp heuristic 2025-12-14 09:25:30 +01:00
ziggie dbb3a9e953 ci: fix some minor issues in the backport ci job
-Due to a newer version we need to use add_labels instead of just
 labels

-The backport PR will now also copy the milestones in case the
 milstones were set
2025-12-14 09:00:02 +01:00
ziggieXXX 9fcd7c2972 Merge pull request #10435 from ziggie1984/test-backport-workflow
Backport workflow
2025-12-13 00:16:24 +01:00
ziggie 4af13745e5 docs: add comprehensive backport workflow documentation
This commit adds detailed documentation for the automated backport
workflow and updates the contribution guidelines to reference it.

New documentation (docs/backport-workflow.md):
- Complete overview of the automated backport process
- Step-by-step usage instructions with examples
- Detailed explanation of workflow triggers and label format
- Technical details about workflow implementation
- Conflict resolution procedures and best practices
- Multiple backport scenarios and examples
- Comprehensive troubleshooting guide

Updated contribution guidelines (docs/code_contribution_guidelines.md):
- Replaced detailed backport instructions with brief overview
- Added reference to the new detailed documentation
- Keeps contribution guidelines focused and concise

The detailed documentation provides:
- How to use backport labels correctly
- What happens when labels are added before/after merge
- How the workflow validates branches and handles errors
- Step-by-step conflict resolution instructions
- Solutions for common problems and edge cases
- Examples of valid vs invalid label formats

This documentation ensures contributors and maintainers have clear
guidance on using the automated backport workflow effectively.
2025-12-12 22:48:51 +01:00
ziggie 7ecdb9b807 ci: add automated backport workflow
This commit introduces an automated GitHub Actions workflow to streamline
the backporting process for merged PRs from master to release branches.

Key features:
- Triggers on merged PRs with labels matching 'backport-v*' pattern
  (e.g., backport-v0.20.x-branch)
- Validates that target branches exist before attempting backport
- Creates separate backport PRs for each target branch
- Automatically adds 'no-changelog' label to backport PRs
- Handles merge conflicts by creating draft PRs with conflict markers
- Supports multiple simultaneous backports via multiple labels

Workflow steps:
1. Checkout repository with full git history
2. Validate all target branches exist in the remote repository
3. For each valid backport label:
   - Create a new branch (backport-<pr-num>-to-<target-branch>)
   - Cherry-pick commits from the master PR
   - Create a new PR targeting the release branch
   - Link back to the original PR
4. If conflicts occur, create a draft PR for manual resolution

Label format:
- Valid: backport-v0.20.x-branch, backport-v0.19.x-branch
- Invalid: backport candidate, backport-candidate, backport-needed

This automation reduces manual work and ensures consistency in the
backporting process while maintaining full visibility and control
for maintainers.
2025-12-12 22:48:51 +01:00
Elle 363aeb5f15 Merge pull request #10410 from ellemouton/bypassBuilderForMissingEdges
localchans: populate FundingScript for missing edges
2025-12-12 10:22:14 +02:00
ziggieXXX f4b3ed73e3 Merge pull request #10440 from ziggie1984/bugfix/itest-race
funding: fix race in itest for zero-conf funding
2025-12-12 00:05:27 +01:00
Elle Mouton da9868b06d docs: update release notes 2025-12-11 18:13:47 +02:00
Elle Mouton 710c676662 localchans: populate funding script for missing edges
When creating a missing edge, we need to populate the funding script too
so that the graph builder can update its ChainView appropriately. We use
the MakeFundingScript helper from the funding package which ensures that
we are using the same logic for creating a funding script as is used for
any of the channels that we own.
2025-12-11 18:13:47 +02:00
Elle Mouton 66bc0b8f8e funding: export MakeFundingScript
So that we can re-use this helper else where.
2025-12-11 17:54:57 +02:00
ziggie fe9a3e103b funding: fix race in itest for zero-conf funding
Fix a race condition where forwarding through a public zero-conf channel
could fail with UnknownNextPeer when using the confirmed SCID. The issue
occurred because ReportShortChanID (which updates the switch's baseIndex
to handle the confirmed SCID) was called AFTER addToGraph (which announces
the confirmed SCID to the network).

With slow backends like postgres, addToGraph takes significant time,
creating a window where other nodes learn about the confirmed SCID from
gossip and attempt to route through it, but the receiving node's switch
hasn't been updated yet to handle forwards using the confirmed SCID.

The fix reorders operations to call ReportShortChanID before addToGraph,
ensuring the switch is ready to handle the confirmed SCID before it's
announced to the network. Forwards using either the alias or confirmed
SCID will work since getLinkByMapping uses baseIndex to map both to the
same link in forwardingIndex.

Fixes flaky test: zero_conf-channel_policy_update_public_zero_conf
2025-12-10 19:44:18 +01:00
Yong 1e15efc473 Merge pull request #10439 from ziggie1984/bugfix/probing
Always add the payment address when probing an invoice
2025-12-10 22:39:58 +08:00
ziggie ac30443cc1 docs: add release-notes for LND 20.1 2025-12-10 09:49:57 +01:00
ziggie 1c4bcc3b7d routerrpc: fix payment address deep copy
using copy for a slice of size 0 will not copy anything so we need
to first initialize the slice before we do the deep copy.
2025-12-10 09:49:57 +01:00
Elle 3d7ff866f8 Merge pull request #10436 from ellemouton/musigRegisterAggNonce 2025-12-10 09:58:58 +02:00