Skip to content

Commit f674960

Browse files
authored
Merge pull request #7017 from Roasbeef/v0-15-3-branch
release: create release branch for v0.15.3
2 parents 08a957f + 34cd2f5 commit f674960

39 files changed

+1575
-886
lines changed

aliasmgr/aliasmgr.go

+66-34
Original file line numberDiff line numberDiff line change
@@ -87,18 +87,22 @@ type Manager struct {
8787
// negotiated option-scid-alias feature bit.
8888
aliasToBase map[lnwire.ShortChannelID]lnwire.ShortChannelID
8989

90+
// peerAlias is a cache for the alias SCIDs that our peers send us in
91+
// the funding_locked TLV. The keys are the ChannelID generated from
92+
// the FundingOutpoint and the values are the remote peer's alias SCID.
93+
// The values should match the ones stored in the "invoice-alias-bucket"
94+
// bucket.
95+
peerAlias map[lnwire.ChannelID]lnwire.ShortChannelID
96+
9097
sync.RWMutex
9198
}
9299

93100
// NewManager initializes an alias Manager from the passed database backend.
94101
func NewManager(db kvdb.Backend) (*Manager, error) {
95102
m := &Manager{backend: db}
96-
m.baseToSet = make(
97-
map[lnwire.ShortChannelID][]lnwire.ShortChannelID,
98-
)
99-
m.aliasToBase = make(
100-
map[lnwire.ShortChannelID]lnwire.ShortChannelID,
101-
)
103+
m.baseToSet = make(map[lnwire.ShortChannelID][]lnwire.ShortChannelID)
104+
m.aliasToBase = make(map[lnwire.ShortChannelID]lnwire.ShortChannelID)
105+
m.peerAlias = make(map[lnwire.ChannelID]lnwire.ShortChannelID)
102106

103107
err := m.populateMaps()
104108
return m, err
@@ -115,6 +119,10 @@ func (m *Manager) populateMaps() error {
115119
// populate the Manager's actual maps.
116120
aliasMap := make(map[lnwire.ShortChannelID]lnwire.ShortChannelID)
117121

122+
// This map caches the ChannelID/alias SCIDs stored in the database and
123+
// is used to populate the Manager's cache.
124+
peerAliasMap := make(map[lnwire.ChannelID]lnwire.ShortChannelID)
125+
118126
err := kvdb.Update(m.backend, func(tx kvdb.RwTx) error {
119127
baseConfBucket, err := tx.CreateTopLevelBucket(confirmedBucket)
120128
if err != nil {
@@ -152,12 +160,34 @@ func (m *Manager) populateMaps() error {
152160
aliasMap[aliasScid] = baseScid
153161
return nil
154162
})
163+
if err != nil {
164+
return err
165+
}
166+
167+
invAliasBucket, err := tx.CreateTopLevelBucket(
168+
invoiceAliasBucket,
169+
)
170+
if err != nil {
171+
return err
172+
}
173+
174+
err = invAliasBucket.ForEach(func(k, v []byte) error {
175+
var chanID lnwire.ChannelID
176+
copy(chanID[:], k)
177+
alias := lnwire.NewShortChanIDFromInt(
178+
byteOrder.Uint64(v),
179+
)
180+
181+
peerAliasMap[chanID] = alias
182+
183+
return nil
184+
})
185+
155186
return err
156187
}, func() {
157188
baseConfMap = make(map[lnwire.ShortChannelID]struct{})
158-
aliasMap = make(
159-
map[lnwire.ShortChannelID]lnwire.ShortChannelID,
160-
)
189+
aliasMap = make(map[lnwire.ShortChannelID]lnwire.ShortChannelID)
190+
peerAliasMap = make(map[lnwire.ChannelID]lnwire.ShortChannelID)
161191
})
162192
if err != nil {
163193
return err
@@ -176,6 +206,9 @@ func (m *Manager) populateMaps() error {
176206
m.aliasToBase[aliasSCID] = baseSCID
177207
}
178208

209+
// Populate the peer alias cache.
210+
m.peerAlias = peerAliasMap
211+
179212
return nil
180213
}
181214

@@ -242,7 +275,9 @@ func (m *Manager) AddLocalAlias(alias, baseScid lnwire.ShortChannelID,
242275

243276
// GetAliases fetches the set of aliases stored under a given base SCID from
244277
// write-through caches.
245-
func (m *Manager) GetAliases(base lnwire.ShortChannelID) []lnwire.ShortChannelID {
278+
func (m *Manager) GetAliases(
279+
base lnwire.ShortChannelID) []lnwire.ShortChannelID {
280+
246281
m.RLock()
247282
defer m.RUnlock()
248283

@@ -310,7 +345,10 @@ func (m *Manager) DeleteSixConfs(baseScid lnwire.ShortChannelID) error {
310345
func (m *Manager) PutPeerAlias(chanID lnwire.ChannelID,
311346
alias lnwire.ShortChannelID) error {
312347

313-
return kvdb.Update(m.backend, func(tx kvdb.RwTx) error {
348+
m.Lock()
349+
defer m.Unlock()
350+
351+
err := kvdb.Update(m.backend, func(tx kvdb.RwTx) error {
314352
bucket, err := tx.CreateTopLevelBucket(invoiceAliasBucket)
315353
if err != nil {
316354
return err
@@ -320,36 +358,30 @@ func (m *Manager) PutPeerAlias(chanID lnwire.ChannelID,
320358
byteOrder.PutUint64(scratch[:], alias.ToUint64())
321359
return bucket.Put(chanID[:], scratch[:])
322360
}, func() {})
323-
}
324-
325-
// GetPeerAlias retrieves a peer's alias SCID by the channel's ChanID.
326-
func (m *Manager) GetPeerAlias(chanID lnwire.ChannelID) (
327-
lnwire.ShortChannelID, error) {
361+
if err != nil {
362+
return err
363+
}
328364

329-
var alias lnwire.ShortChannelID
365+
// Now that the database state has been updated, we can update it in
366+
// our cache.
367+
m.peerAlias[chanID] = alias
330368

331-
err := kvdb.Update(m.backend, func(tx kvdb.RwTx) error {
332-
bucket, err := tx.CreateTopLevelBucket(invoiceAliasBucket)
333-
if err != nil {
334-
return err
335-
}
369+
return nil
370+
}
336371

337-
aliasBytes := bucket.Get(chanID[:])
338-
if aliasBytes == nil {
339-
return nil
340-
}
372+
// GetPeerAlias retrieves a peer's alias SCID by the channel's ChanID.
373+
func (m *Manager) GetPeerAlias(chanID lnwire.ChannelID) (lnwire.ShortChannelID,
374+
error) {
341375

342-
alias = lnwire.NewShortChanIDFromInt(
343-
byteOrder.Uint64(aliasBytes),
344-
)
345-
return nil
346-
}, func() {})
376+
m.RLock()
377+
defer m.RUnlock()
347378

348-
if alias == hop.Source {
349-
return alias, errNoPeerAlias
379+
alias, ok := m.peerAlias[chanID]
380+
if !ok || alias == hop.Source {
381+
return lnwire.ShortChannelID{}, errNoPeerAlias
350382
}
351383

352-
return alias, err
384+
return alias, nil
353385
}
354386

355387
// RequestAlias returns a new ALIAS ShortChannelID to the caller by allocating

build/version.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ const (
4444
AppMinor uint = 15
4545

4646
// AppPatch defines the application patch for this binary.
47-
AppPatch uint = 2
47+
AppPatch uint = 3
4848

4949
// AppPreRelease MUST only contain characters from semanticAlphabet
5050
// per the semantic versioning spec.
51-
AppPreRelease = "beta"
51+
AppPreRelease = "beta.rc1"
5252
)
5353

5454
func init() {

cmd/lncli/walletrpc_active.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,11 @@ func parseAddrType(addrTypeStr string) (walletrpc.AddressType, error) {
8282
return walletrpc.AddressType_NESTED_WITNESS_PUBKEY_HASH, nil
8383
case "np2wkh-p2wkh":
8484
return walletrpc.AddressType_HYBRID_NESTED_WITNESS_PUBKEY_HASH, nil
85+
case "p2tr":
86+
return walletrpc.AddressType_TAPROOT_PUBKEY, nil
8587
default:
8688
return 0, errors.New("invalid address type, supported address " +
87-
"types are: p2wkh, np2wkh, and np2wkh-p2wkh")
89+
"types are: p2wkh, p2tr, np2wkh, and np2wkh-p2wkh")
8890
}
8991
}
9092

docs/release-notes/release-notes-0.15.0.md

+6
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ were created after introducing the Taproot key
3434
derivation](https://github.com/lightningnetwork/lnd/pull/6524) to simplify
3535
detecting Taproot compatibility of a seed.
3636

37+
**NOTE** for users running a remote signing setup: A manual account import is
38+
necessary when upgrading from `lnd v0.14.x-beta` to `lnd v0.15.x-beta`, see [the
39+
remote signing documentation for more
40+
details](../remote-signing.md#migrating-a-remote-signing-setup-from-014x-to-015x).
41+
Please upgrade to `lnd v0.15.3-beta` or later directly!
42+
3743
## MuSig2
3844

3945
The [`signrpc.Signer` RPC service now supports EXPERIMENTAL MuSig2

docs/release-notes/release-notes-0.15.1.md

+6
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ supports the feature.](https://github.com/lightningnetwork/lnd/pull/6633)
4444
The [wallet also creates P2TR change addresses by
4545
default](https://github.com/lightningnetwork/lnd/pull/6810) in most cases.
4646

47+
**NOTE** for users running a remote signing setup: A manual account import is
48+
necessary when upgrading from `lnd v0.14.x-beta` to `lnd v0.15.x-beta`, see [the
49+
remote signing documentation for more
50+
details](../remote-signing.md#migrating-a-remote-signing-setup-from-014x-to-015x).
51+
Please upgrade to `lnd v0.15.3-beta` or later directly!
52+
4753
## `lncli`
4854

4955
* [Add `payment_addr` flag to
+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Release Notes
2+
3+
## RPC/REST Server
4+
5+
- A `POST` URL mapping [was added to the REST version of the `QueryRoutes` call
6+
(`POST /v1/graph/routes`)](https://github.com/lightningnetwork/lnd/pull/6926)
7+
to make it possible to specify `route_hints` over REST.
8+
9+
## Bug Fixes
10+
11+
* [A bug has been fixed where the responder of a zero-conf channel could forget
12+
about the channel after a hard-coded 2016 blocks.](https://github.com/lightningnetwork/lnd/pull/6998)
13+
14+
* [A bug where LND wouldn't send a ChannelUpdate during a channel open has
15+
been fixed.](https://github.com/lightningnetwork/lnd/pull/6892)
16+
17+
* [A bug has been fixed that caused fee estimation to be incorrect for taproot
18+
inputs when using the `SendOutputs` call.](https://github.com/lightningnetwork/lnd/pull/6941)
19+
20+
* [A bug has been fixed that could cause lnd to underpay for co-op close
21+
transaction when or both of the outputs used a P2TR
22+
addresss.](https://github.com/lightningnetwork/lnd/pull/6957)
23+
24+
## Taproot
25+
26+
* [Add `p2tr` address type to account
27+
import](https://github.com/lightningnetwork/lnd/pull/6966).
28+
29+
**NOTE** for users running a remote signing setup: A manual account import is
30+
necessary when upgrading from `lnd v0.14.x-beta` to `lnd v0.15.x-beta`, see [the
31+
remote signing documentation for more
32+
details](../remote-signing.md#migrating-a-remote-signing-setup-from-014x-to-015x).
33+
34+
# Contributors (Alphabetical Order)
35+
36+
* Eugene Siegel
37+
* Jordi Montes
38+
* Olaoluwa Osuntokun
39+
* Oliver Gugger

docs/remote-signing.md

+22
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,28 @@ To migrate an existing node, follow these steps:
153153
a watch-only one (by purging all private key material from it) by adding the
154154
`remotesigner.migrate-wallet-to-watch-only=true` configuration entry.
155155

156+
## Migrating a remote signing setup from 0.14.x to 0.15.x
157+
158+
If you were running a remote signing setup with `lnd v0.14.x-beta` and want to
159+
upgrade to `lnd v0.15.x-beta`, you need to manually import the newly added
160+
Taproot account to the watch-only node, otherwise you will encounter errors such
161+
as `account 0 not found` when doing on-chain operations that require creating
162+
(change) P2TR addresses.
163+
164+
**NOTE**: For this to work, you need to upgrade to at least `lnd v0.15.3-beta`
165+
or later!
166+
167+
The upgrade process should look like this:
168+
1. Upgrade the "signer" node to `lnd v0.15.x-beta` and unlock it.
169+
2. Run `lncli wallet accounts list | grep -A5 TAPROOT` on the **"signer"** node
170+
and copy the `xpub...` value from `extended_public_key`.
171+
3. Upgrade the "watch-only" node to `lnd v0.15.x-beta` and unlock it.
172+
4. Run `lncli wallet accounts import --address_type p2tr <xpub...> default` on
173+
the **"watch-only"** node (notice the `default` account name at the end,
174+
that's important).
175+
5. Run `lncli newaddress p2tr` on the "watch-only" node to test that everything
176+
works as expected.
177+
156178
## Example initialization script
157179

158180
This section shows an example script that initializes the watch-only wallet of

funding/manager.go

+2-4
Original file line numberDiff line numberDiff line change
@@ -2457,7 +2457,7 @@ func (f *Manager) waitForFundingWithTimeout(
24572457
// If we are not the initiator, we have no money at stake and will
24582458
// timeout waiting for the funding transaction to confirm after a
24592459
// while.
2460-
if !ch.IsInitiator {
2460+
if !ch.IsInitiator && !ch.IsZeroConf() {
24612461
f.wg.Add(1)
24622462
go f.waitForTimeout(ch, cancelChan, timeoutChan)
24632463
}
@@ -3200,9 +3200,7 @@ func (f *Manager) waitForZeroConfChannel(c *channeldb.OpenChannel,
32003200
// is already confirmed, the chainntnfs subsystem will return with the
32013201
// confirmed tx. Otherwise, we'll wait here until confirmation occurs.
32023202
confChan, err := f.waitForFundingWithTimeout(c)
3203-
if err == ErrConfirmationTimeout {
3204-
return f.fundingTimeout(c, pendingID)
3205-
} else if err != nil {
3203+
if err != nil {
32063204
return fmt.Errorf("error waiting for zero-conf funding "+
32073205
"confirmation for ChannelPoint(%v): %v",
32083206
c.FundingOutpoint, err)

go.mod

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ require (
99
github.com/btcsuite/btcd/btcutil/psbt v1.1.5
1010
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1
1111
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f
12-
github.com/btcsuite/btcwallet v0.15.1
13-
github.com/btcsuite/btcwallet/wallet/txauthor v1.2.3
12+
github.com/btcsuite/btcwallet v0.16.1
13+
github.com/btcsuite/btcwallet/wallet/txauthor v1.3.2
1414
github.com/btcsuite/btcwallet/wallet/txrules v1.2.0
1515
github.com/btcsuite/btcwallet/walletdb v1.4.0
1616
github.com/btcsuite/btcwallet/wtxmgr v1.5.0
@@ -66,7 +66,7 @@ require (
6666
github.com/aead/siphash v1.0.1 // indirect
6767
github.com/andybalholm/brotli v1.0.3 // indirect
6868
github.com/beorn7/perks v1.0.1 // indirect
69-
github.com/btcsuite/btcwallet/wallet/txsizes v1.1.0 // indirect
69+
github.com/btcsuite/btcwallet/wallet/txsizes v1.2.3 // indirect
7070
github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd // indirect
7171
github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792 // indirect
7272
github.com/btcsuite/winsvc v1.0.0 // indirect

go.sum

+7-4
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,17 @@ github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtyd
9898
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f h1:bAs4lUbRJpnnkd9VhRV3jjAVU7DJVjMaK+IsvSeZvFo=
9999
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA=
100100
github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg=
101-
github.com/btcsuite/btcwallet v0.15.1 h1:SKfh/l2Bgz9sJwHZvfiVbZ8Pl3N/8fFcWWXzsAPz9GU=
102-
github.com/btcsuite/btcwallet v0.15.1/go.mod h1:7OFsQ8ypiRwmr67hE0z98uXgJgXGAihE79jCib9x6ag=
103-
github.com/btcsuite/btcwallet/wallet/txauthor v1.2.3 h1:M2yr5UlULvpqtxUqpMxTME/pA92Z9cpqeyvAFk9lAg0=
101+
github.com/btcsuite/btcwallet v0.16.1 h1:nD8qXJeAU8c7a0Jlx5jwI2ufbf/9ouy29XGapRLTmos=
102+
github.com/btcsuite/btcwallet v0.16.1/go.mod h1:NCO8+5rIcbUm5CtVNSQM0xrtK4iYprlyuvpGzhkejaM=
104103
github.com/btcsuite/btcwallet/wallet/txauthor v1.2.3/go.mod h1:T2xSiKGpUkSLCh68aF+FMXmKK9mFqNdHl9VaqOr+JjU=
104+
github.com/btcsuite/btcwallet/wallet/txauthor v1.3.2 h1:etuLgGEojecsDOYTII8rYiGHjGyV5xTqsXi+ZQ715UU=
105+
github.com/btcsuite/btcwallet/wallet/txauthor v1.3.2/go.mod h1:Zpk/LOb2sKqwP2lmHjaZT9AdaKsHPSbNLm2Uql5IQ/0=
105106
github.com/btcsuite/btcwallet/wallet/txrules v1.2.0 h1:BtEN5Empw62/RVnZ0VcJaVtVlBijnLlJY+dwjAye2Bg=
106107
github.com/btcsuite/btcwallet/wallet/txrules v1.2.0/go.mod h1:AtkqiL7ccKWxuLYtZm8Bu8G6q82w4yIZdgq6riy60z0=
107-
github.com/btcsuite/btcwallet/wallet/txsizes v1.1.0 h1:wZnOolEAeNOHzHTnznw/wQv+j35ftCIokNrnOTOU5o8=
108108
github.com/btcsuite/btcwallet/wallet/txsizes v1.1.0/go.mod h1:pauEU8UuMFiThe5PB3EO+gO5kx87Me5NvdQDsTuq6cs=
109+
github.com/btcsuite/btcwallet/wallet/txsizes v1.2.2/go.mod h1:q08Rms52VyWyXcp5zDc4tdFRKkFgNsMQrv3/LvE1448=
110+
github.com/btcsuite/btcwallet/wallet/txsizes v1.2.3 h1:PszOub7iXVYbtGybym5TGCp9Dv1h1iX4rIC3HICZGLg=
111+
github.com/btcsuite/btcwallet/wallet/txsizes v1.2.3/go.mod h1:q08Rms52VyWyXcp5zDc4tdFRKkFgNsMQrv3/LvE1448=
109112
github.com/btcsuite/btcwallet/walletdb v1.3.5/go.mod h1:oJDxAEUHVtnmIIBaa22wSBPTVcs6hUp5NKWmI8xDwwU=
110113
github.com/btcsuite/btcwallet/walletdb v1.3.6-0.20210803004036-eebed51155ec/go.mod h1:oJDxAEUHVtnmIIBaa22wSBPTVcs6hUp5NKWmI8xDwwU=
111114
github.com/btcsuite/btcwallet/walletdb v1.4.0 h1:/C5JRF+dTuE2CNMCO/or5N8epsrhmSM4710uBQoYPTQ=

lnrpc/autopilotrpc/autopilot.pb.json.go

-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lnrpc/chainrpc/chainnotifier.pb.json.go

-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lnrpc/devrpc/dev.pb.json.go

-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lnrpc/gen_protos.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ function generate() {
4141
# Generate the JSON/WASM client stubs.
4242
falafel=$(which falafel)
4343
pkg="lnrpc"
44-
opts="package_name=$pkg,js_stubs=1,build_tags=// +build js"
44+
opts="package_name=$pkg,js_stubs=1"
4545
protoc -I/usr/local/include -I. -I.. \
4646
--plugin=protoc-gen-custom=$falafel\
4747
--custom_out=. \
@@ -61,7 +61,7 @@ function generate() {
6161
manual_import="github.com/lightningnetwork/lnd/lnrpc"
6262
fi
6363

64-
opts="package_name=$package,manual_import=$manual_import,js_stubs=1,build_tags=// +build js"
64+
opts="package_name=$package,manual_import=$manual_import,js_stubs=1"
6565
pushd $package
6666
protoc -I/usr/local/include -I. -I.. \
6767
--plugin=protoc-gen-custom=$falafel\

0 commit comments

Comments
 (0)