Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
fcbed37
build: initialize Docker release caches
starius Aug 12, 2026
7bda2a7
build: support Docker releases from Git worktrees
starius Aug 12, 2026
3f413a6
Merge pull request #11464 from starius/backport-builder-fixes-v0.21.x
ziggie1984 Oct 30, 2026
f371413
lnwallet: reject force close for restored channels
Roasbeef Oct 26, 2026
7fb32f4
docs: add release note for restored channels
Roasbeef Nov 4, 2026
3fa0f25
lnwallet: fix lint issues in force close changes
Roasbeef Nov 4, 2026
c7dec71
channeldb: scope confirmation hints by script
Roasbeef Oct 23, 2026
83afb5d
docs: rename release note fragment to PR number
Roasbeef Nov 4, 2026
53d7c93
contractcourt: handle replacement fee rejections
Roasbeef Nov 4, 2026
4fa0db1
lnwallet: reject oversized unsigned acked update logs
Roasbeef Oct 23, 2026
6cf06dd
docs: release note for update log limit
Roasbeef Nov 4, 2026
86e2a9f
docs: rename release note fragment to PR number
Roasbeef Nov 4, 2026
8222814
lnwallet: fix lint issues in update log limits
Roasbeef Nov 4, 2026
bd4bcef
scidalias: reject peer aliases for other channels
Roasbeef Oct 26, 2026
5b9c14a
docs: add release note for alias validation
Roasbeef Nov 4, 2026
815db8f
peer: decouple link failure delivery
Roasbeef Oct 21, 2026
ec818ce
itest: cover link failure force close
Roasbeef Oct 22, 2026
1c3e41e
funding: preserve batch state after publish errors
Roasbeef Oct 26, 2026
6a7e05a
docs: add release note for funding batch state
Roasbeef Nov 4, 2026
362ae92
Merge pull request #11503 from lightningnetwork/backport-11478-to-v0.…
ziggie1984 Nov 5, 2026
8751aa6
Merge pull request #11509 from lightningnetwork/backport-11479-to-v0.…
ziggie1984 Nov 5, 2026
cb3b344
Merge pull request #11491 from lightningnetwork/backport-11480-to-v0.…
ziggie1984 Nov 5, 2026
6fab86d
Merge pull request #11494 from lightningnetwork/backport-11481-to-v0.…
ziggie1984 Nov 5, 2026
6eb7f50
chainntnfs: wrap ConfirmHintCache comments at 80 columns
ziggie1984 Nov 5, 2026
b22adc8
Merge pull request #11511 from lightningnetwork/backport-11482-to-v0.…
ziggie1984 Nov 5, 2026
625492d
Merge pull request #11513 from lightningnetwork/backport-11484-to-v0.…
ziggie1984 Nov 5, 2026
95316f0
Merge pull request #11496 from lightningnetwork/backport-11483-to-v0.…
ziggie1984 Nov 5, 2026
3851f43
Merge pull request #11521 from lightningnetwork/backport-11497-to-v0.…
ziggie1984 Nov 5, 2026
34970e1
itest: use btcd v1 module paths in conf hint poison test
litbot-9000 Nov 5, 2026
63228bf
Merge pull request #11526 from lightningnetwork/backport-fix-itest-bt…
Roasbeef Nov 5, 2026
a57505d
sweep: retry transient mempool errors
yyforyongyu Oct 30, 2026
a6f7f62
invoices: add side-effect free AMP HTLC preimage lookup
ziggie1984 Oct 14, 2026
cb7af25
docs: note sweep rejection retries
yyforyongyu Nov 2, 2026
b7ebb79
sweep: clarify retry event semantics
yyforyongyu Nov 5, 2026
94b248a
sweep: bound broadcast result waits
yyforyongyu Nov 5, 2026
f053ff3
sweep: track already accepted transactions
yyforyongyu Nov 5, 2026
2d17023
contractcourt: claim settled AMP HTLCs on-chain
ziggie1984 Oct 14, 2026
4f33e36
invoices: resolve replayed HTLCs before spontaneous payment checks
ziggie1984 Oct 14, 2026
2885c26
contractcourt: defer incoming preimage lookup
ziggie1984 Oct 31, 2026
09acf8d
invoices: limit early replay lookup
ziggie1984 Nov 1, 2026
4834ed4
contractcourt: expand AMP lookup coverage
ziggie1984 Nov 1, 2026
a77ab9d
contractcourt: cover AMP on-chain recovery
ziggie1984 Nov 1, 2026
8756c0c
docs: add release note
ziggie1984 Nov 4, 2026
35f97f8
Merge pull request #11519 from lightningnetwork/backport-11492-to-v0.…
ziggie1984 Nov 6, 2026
5491516
build: pin btcwallet rejection mappings
ziggie1984 Nov 9, 2026
cc13b39
Merge pull request #11525 from lightningnetwork/backport-11472-to-v0.…
ziggie1984 Nov 10, 2026
c5c3f4d
sweep: bound wallet input selection
ziggie1984 Nov 7, 2026
006c3ed
sweep: retry weight-rejected transactions
ziggie1984 Nov 7, 2026
07a809d
docs: add bounded wallet selection release note
ziggie1984 Nov 7, 2026
131ed4d
wtwire: bound inbound message decoding
Roasbeef Oct 29, 2026
0fc87f6
wtpolicy: apply dust limits per output script
Roasbeef Oct 29, 2026
4e721f2
sweep: retry inconclusive spend checks
Roasbeef Oct 29, 2026
1d5f15d
sweep: keep fee curves within budget
Roasbeef Oct 29, 2026
fad9f5c
kvdb/etcd: retain transaction read errors
Roasbeef Oct 29, 2026
7cf796e
chancloser: preserve cooperative close variants
Roasbeef Oct 29, 2026
3d6caf6
chainntnfs: adjust spend and dispatch log levels
Roasbeef Nov 10, 2026
4296c22
lnwallet+chanstate: keep persisted HTLC data readable
Roasbeef Nov 10, 2026
de65704
discovery: limit zombie marking to channel-level failures
Roasbeef Nov 10, 2026
c009f00
lnwallet: reject a zero CSV delay
Roasbeef Nov 10, 2026
0f9b8bb
docs: add release notes for #11440
Roasbeef Nov 10, 2026
b6de7cc
htlcswitch: preserve add indexes during replay
ziggie1984 Nov 10, 2026
fc14781
htlcswitch: clean circuits after failed handoff
ziggie1984 Nov 10, 2026
d8838fb
docs: add forwarding replay release note
ziggie1984 Nov 10, 2026
4f2295a
Merge pull request #11544 from lightningnetwork/backport-11542-to-v0.…
ziggie1984 Nov 10, 2026
3a62d5b
Merge pull request #11537 from lightningnetwork/backport-11485-to-v0.…
ziggie1984 Nov 10, 2026
71fddf6
htlcswitch: use btcd v1 btcutil path in forward replay test
ziggie1984 Nov 10, 2026
455b09d
Merge pull request #11548 from ziggie1984/fix-htlcswitch-btcutil-impo…
ziggie1984 Nov 10, 2026
4b2cbfb
Merge pull request #11539 from lightningnetwork/backport-11440-to-v0.…
ziggie1984 Nov 10, 2026
6ab0e4b
build: bump version to v0.21.7
ziggie1984 Nov 11, 2026
cbd711f
peer: reestablish pending channels on reconnect
vincenzopalazzo Nov 10, 2026
64d66c0
docs: add release notes for #11540
vincenzopalazzo Nov 10, 2026
84cefa3
Merge pull request #11560 from lightningnetwork/backport-11540-to-v0.…
ziggie1984 Nov 11, 2026
9fda429
Merge pull request #11557 from ziggie1984/bump-v0.21.7-final
ziggie1984 Nov 11, 2026
0331976
peer: fix pending reestablish backport checks
ziggie1984 Nov 11, 2026
94d11ef
build: bump version to v0.21.8
ziggie1984 Nov 11, 2026
e9d54f9
Merge pull request #11564 from ziggie1984/fix-v0.21-pending-reestabli…
yyforyongyu Nov 11, 2026
59dd790
Merge pull request #11565 from ziggie1984/bump-v0.21.8-final-stacked
yyforyongyu Nov 11, 2026
769835b
Merge lnd v0.21.8-beta into Lightning Fork
Kilombino Nov 12, 2026
3291e8f
go.mod: btcwallet-blake2b v0.16.20-blake2b.4 (upstream ver-0-16.19 re…
Kilombino Nov 12, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,11 @@ release: clean-mobile
./scripts/release.sh build-release "$(VERSION_TAG)" "$(BUILD_SYSTEM)" "$(RELEASE_TAGS)" "$(RELEASE_LDFLAGS)" "$(GO_VERSION)"

#? docker-release: Same as release but within a docker container to support reproducible builds on BSD/MacOS platforms
docker-release:
docker-release-cache:
$(call check_docker_release_cache,$(DOCKER_RELEASE_GOCACHE))
$(call check_docker_release_cache,$(DOCKER_RELEASE_GOMODCACHE))

docker-release: docker-release-cache
@$(call print, "Building release helper docker image.")
if [ "$(tag)" = "" ]; then echo "Must specify tag=<commit_or_tag>!"; exit 1; fi

Expand Down
2 changes: 1 addition & 1 deletion build/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const (
AppMinor uint = 21

// AppPatch defines the application patch for this binary.
AppPatch uint = 06
AppPatch uint = 8

// AppPreRelease MUST only contain characters from semanticAlphabet per
// the semantic versioning spec.
Expand Down
19 changes: 10 additions & 9 deletions chainntnfs/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -840,20 +840,21 @@ type SpendHintCache interface {
}

// ConfirmHintCache is an interface whose duty is to cache confirm hints for
// transactions. A confirm hint is defined as the earliest height in the chain
// at which a transaction could have been included in a block.
// confirmation requests. A confirm hint is defined as the earliest height in
// the chain at which a transaction matching the request could have been
// included in a block.
type ConfirmHintCache interface {
// CommitConfirmHint commits a confirm hint for the transactions to the
// cache.
// CommitConfirmHint commits a confirm hint for the confirmation
// requests to the cache.
CommitConfirmHint(height uint32, confRequests ...ConfRequest) error

// QueryConfirmHint returns the latest confirm hint for a transaction
// hash. ErrConfirmHintNotFound is returned if a confirm hint does not
// exist within the cache for the transaction hash.
// QueryConfirmHint returns the latest confirm hint for a confirmation
// request. ErrConfirmHintNotFound is returned if a confirm hint does
// not exist within the cache for the request.
QueryConfirmHint(confRequest ConfRequest) (uint32, error)

// PurgeConfirmHint removes the confirm hint for the transactions from
// the cache.
// PurgeConfirmHint removes the confirm hints for the confirmation
// requests from the cache.
PurgeConfirmHint(confRequests ...ConfRequest) error
}

Expand Down
13 changes: 5 additions & 8 deletions chainntnfs/txnotifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -934,14 +934,14 @@ func (n *TxNotifier) dispatchConfDetails(
// already been dispatched, then we can skip dispatching to this
// client.
if details == nil {
Log.Debugf("Skipped dispatching nil conf details for request "+
Log.Tracef("Skipped dispatching nil conf details for request "+
"%v, conf_id=%v", ntfn.ConfRequest, ntfn.ConfID)

return nil
}

if ntfn.dispatched {
Log.Debugf("Skipped dispatched conf details for request %v "+
Log.Tracef("Skipped dispatched conf details for request %v "+
"conf_id=%v", ntfn.ConfRequest, ntfn.ConfID)

return nil
Expand Down Expand Up @@ -1337,11 +1337,8 @@ func (n *TxNotifier) updateSpendDetails(spendRequest SpendRequest,

// Return an error if the witness data is not present in the spending
// transaction.
//
// NOTE: if the witness stack is empty, we will do a critical log which
// shuts down the node.
if !details.HasSpenderWitness() {
Log.Criticalf("Found spending tx for outpoint=%v, but the "+
Log.Errorf("Found spending tx for outpoint=%v, but the "+
"transaction %v does not have witness",
spendRequest.OutPoint, details.SpendingTx.TxHash())

Expand Down Expand Up @@ -1391,7 +1388,7 @@ func (n *TxNotifier) dispatchSpendDetails(ntfn *SpendNtfn, details *SpendDetail)
// If there are no spend details to dispatch or if the notification has
// already been dispatched, then we can skip dispatching to this client.
if details == nil || ntfn.dispatched {
Log.Debugf("Skipping dispatch of spend details(%v) for "+
Log.Tracef("Skipping dispatch of spend details(%v) for "+
"request %v, dispatched=%v", details, ntfn.SpendRequest,
ntfn.dispatched)
return nil
Expand Down Expand Up @@ -1793,7 +1790,7 @@ func (n *TxNotifier) NotifyHeight(height uint32) error {
// If the `confDetails` has already been sent before, we'll
// skip it and continue processing the next one.
if ntfn.dispatched {
Log.Debugf("Skipped dispatched conf details for "+
Log.Tracef("Skipped dispatched conf details for "+
"request %v conf_id=%v", ntfn.ConfRequest,
ntfn.ConfID)

Expand Down
57 changes: 54 additions & 3 deletions channeldb/channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"errors"
"fmt"
"io"
"math"
"net"
"strconv"
"strings"
Expand Down Expand Up @@ -3155,6 +3156,14 @@ func SerializeHtlcs(b io.Writer, htlcs ...HTLC) error {
copy(onionAndExtraData, htlc.OnionBlob[:])
copy(onionAndExtraData[lnwire.OnionPacketSize:], htlc.ExtraData)

// Refuse to write an HTLC that the reader would reject, as a
// single unreadable HTLC makes the whole channel unreadable.
if len(onionAndExtraData) > maxVarBytesLen {
return fmt.Errorf("htlc onion and extra data too "+
"large: %d > max %d", len(onionAndExtraData),
maxVarBytesLen)
}

if err := WriteElements(b,
htlc.Signature, htlc.RHash, htlc.Amt, htlc.RefundTimeout,
htlc.OutputIndex, htlc.Incoming, onionAndExtraData,
Expand Down Expand Up @@ -3346,6 +3355,11 @@ type CommitDiff struct {

// serializeLogUpdates serializes provided list of updates to a stream.
func serializeLogUpdates(w io.Writer, logUpdates []LogUpdate) error {
if len(logUpdates) > math.MaxUint16 {
return fmt.Errorf("too many log updates: %d exceeds %d",
len(logUpdates), math.MaxUint16)
}

numUpdates := uint16(len(logUpdates))
if err := binary.Write(w, byteOrder, numUpdates); err != nil {
return err
Expand All @@ -3361,8 +3375,9 @@ func serializeLogUpdates(w io.Writer, logUpdates []LogUpdate) error {
return nil
}

// deserializeLogUpdates deserializes a list of updates from a stream.
func deserializeLogUpdates(r io.Reader) ([]LogUpdate, error) {
// deserializeLogUpdateStream deserializes a list of updates from a stream
// that may contain further data after the list.
func deserializeLogUpdateStream(r io.Reader) ([]LogUpdate, error) {
var numUpdates uint16
if err := binary.Read(r, byteOrder, &numUpdates); err != nil {
return nil, err
Expand All @@ -3380,6 +3395,42 @@ func deserializeLogUpdates(r io.Reader) ([]LogUpdate, error) {
return logUpdates, nil
}

// deserializeLogUpdates deserializes a list of updates stored on its own under
// a bucket key.
func deserializeLogUpdates(r *bytes.Reader) ([]LogUpdate, error) {
updates, err := deserializeLogUpdateStream(r)
if err != nil || r.Len() == 0 {
return updates, err
}

// Older versions wrote the complete list after a wrapped uint16 count.
// Recover those entries so a reconnect cannot silently drop a settle.
declaredCount := len(updates)
for r.Len() > 0 {
var update LogUpdate
if err := ReadElements(
r, &update.LogIndex, &update.UpdateMsg,
); err != nil {
return nil, fmt.Errorf(
"unable to read trailing log update: %w", err,
)
}

updates = append(updates, update)
}

if len(updates) <= math.MaxUint16 ||
len(updates)%(math.MaxUint16+1) != declaredCount {

return nil, fmt.Errorf(
"log update count mismatch: declared %d, found %d",
declaredCount, len(updates),
)
}

return updates, nil
}

func serializeCommitDiff(w io.Writer, diff *CommitDiff) error { // nolint: dupl
if err := serializeChanCommit(w, &diff.Commitment); err != nil {
return err
Expand Down Expand Up @@ -3450,7 +3501,7 @@ func deserializeCommitDiff(r io.Reader) (*CommitDiff, error) {
}
d.CommitSig = commitSig

d.LogUpdates, err = deserializeLogUpdates(r)
d.LogUpdates, err = deserializeLogUpdateStream(r)
if err != nil {
return nil, err
}
Expand Down
7 changes: 6 additions & 1 deletion channeldb/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ import (
"github.com/lightningnetwork/lnd/tlv"
)

// maxVarBytesLen is the largest variable length byte slice ReadElement will
// decode. Writers of persisted state must stay within it, or the record they
// write can never be read back.
const maxVarBytesLen = 66000

// UnknownElementType is an error returned when the codec is unable to encode or
// decode a particular type.
type UnknownElementType struct {
Expand Down Expand Up @@ -379,7 +384,7 @@ func ReadElement(r io.Reader, element interface{}) error {
}

case *[]byte:
bytes, err := wire.ReadVarBytes(r, 0, 66000, "[]byte")
bytes, err := wire.ReadVarBytes(r, 0, maxVarBytesLen, "[]byte")
if err != nil {
return err
}
Expand Down
27 changes: 16 additions & 11 deletions channeldb/height_hint.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ var (
spendHintBucket = []byte("spend-hints")

// confirmHintBucket is the name of the bucket which houses the height
// hints for transactions. Each height hint represents the earliest
// height at which its corresponding transaction could have been
// confirmed within.
// hints for confirmation requests. Each height hint represents the
// earliest height at which a transaction matching its corresponding
// request could have been confirmed.
confirmHintBucket = []byte("confirm-hints")
)

Expand Down Expand Up @@ -175,7 +175,8 @@ func (c *HeightHintCache) PurgeSpendHint(
})
}

// CommitConfirmHint commits a confirm hint for the transactions to the cache.
// CommitConfirmHint commits a confirm hint for the confirmation requests to the
// cache.
func (c *HeightHintCache) CommitConfirmHint(height uint32,
confRequests ...chainntnfs.ConfRequest) error {

Expand Down Expand Up @@ -213,9 +214,9 @@ func (c *HeightHintCache) CommitConfirmHint(height uint32,
})
}

// QueryConfirmHint returns the latest confirm hint for a transaction hash.
// QueryConfirmHint returns the latest confirm hint for a confirmation request.
// ErrConfirmHintNotFound is returned if a confirm hint does not exist within
// the cache for the transaction hash.
// the cache for the request.
func (c *HeightHintCache) QueryConfirmHint(
confRequest chainntnfs.ConfRequest) (uint32, error) {

Expand Down Expand Up @@ -251,8 +252,8 @@ func (c *HeightHintCache) QueryConfirmHint(
return hint, nil
}

// PurgeConfirmHint removes the confirm hint for the transactions from the
// cache.
// PurgeConfirmHint removes the confirm hints for the confirmation requests from
// the cache.
func (c *HeightHintCache) PurgeConfirmHint(
confRequests ...chainntnfs.ConfRequest) error {

Expand Down Expand Up @@ -290,12 +291,16 @@ func confHintKey(r *chainntnfs.ConfRequest) ([]byte, error) {
return r.PkScript.Script(), nil
}

var txid bytes.Buffer
if err := WriteElement(&txid, r.TxID); err != nil {
// A confirmation request matches both the txid and its output script.
// Keep their hints separate so an unmatched script cannot advance the
// hint for a transaction that already confirmed.
var key bytes.Buffer
if err := WriteElement(&key, r.TxID); err != nil {
return nil, err
}
key.Write(r.PkScript.Script())

return txid.Bytes(), nil
return key.Bytes(), nil
}

// spendHintKey returns the key that will be used to index the spend request's
Expand Down
40 changes: 40 additions & 0 deletions channeldb/height_hint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,46 @@ func TestHeightHintCacheConfirms(t *testing.T) {
}
}

// TestHeightHintCacheConfirmsPerScript ensures that a request for an output
// script that never confirms cannot advance another script's cached hint.
func TestHeightHintCacheConfirmsPerScript(t *testing.T) {
t.Parallel()

hintCache := initHintCache(t)
txid := chainhash.Hash{1}
script := func(value byte) []byte {
return append([]byte{0x00, 0x20}, bytes.Repeat(
[]byte{value}, 32,
)...)
}

confirmed, err := chainntnfs.NewConfRequest(&txid, script(2))
require.NoError(t, err)
unconfirmed, err := chainntnfs.NewConfRequest(&txid, script(3))
require.NoError(t, err)
unknown, err := chainntnfs.NewConfRequest(&txid, script(4))
require.NoError(t, err)

require.NoError(t, hintCache.CommitConfirmHint(100, confirmed))
require.NoError(t, hintCache.CommitConfirmHint(105, unconfirmed))

hint, err := hintCache.QueryConfirmHint(confirmed)
require.NoError(t, err)
require.EqualValues(t, 100, hint)

hint, err = hintCache.QueryConfirmHint(unconfirmed)
require.NoError(t, err)
require.EqualValues(t, 105, hint)

_, err = hintCache.QueryConfirmHint(unknown)
require.ErrorIs(t, err, chainntnfs.ErrConfirmHintNotFound)

require.NoError(t, hintCache.PurgeConfirmHint(unconfirmed))
hint, err = hintCache.QueryConfirmHint(confirmed)
require.NoError(t, err)
require.EqualValues(t, 100, hint)
}

// TestHeightHintCacheSpends ensures that the height hint cache properly caches
// spend hints for outpoints.
func TestHeightHintCacheSpends(t *testing.T) {
Expand Down
40 changes: 40 additions & 0 deletions channeldb/kv_commitment_log_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package channeldb

import (
"bytes"
"math"
"testing"

"github.com/lightningnetwork/lnd/lnwire"
"github.com/stretchr/testify/require"
)

func TestSerializeLogUpdatesCountLimit(t *testing.T) {
updates := make([]LogUpdate, math.MaxUint16+1)
fee := &lnwire.UpdateFee{FeePerKw: 1000}
for i := range updates {
updates[i] = LogUpdate{
LogIndex: uint64(i),
UpdateMsg: fee,
}
}

var buf bytes.Buffer
require.NoError(t, serializeLogUpdates(
&buf, updates[:math.MaxUint16],
))

decoded, err := deserializeLogUpdateStream(
bytes.NewReader(buf.Bytes()),
)
require.NoError(t, err)
require.Len(t, decoded, math.MaxUint16)
require.Equal(
t, uint64(math.MaxUint16-1), decoded[len(decoded)-1].LogIndex,
)

buf.Reset()
err = serializeLogUpdates(&buf, updates)
require.ErrorContains(t, err, "too many log updates")
require.Zero(t, buf.Len())
}
Loading
Loading