Skip to content

Commit a239f94

Browse files
committed
multi: update lnd dependency to v0.14.1-beta
1 parent 050253e commit a239f94

20 files changed

+734
-219
lines changed

cmd/chantools/deletepayments.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ If only the failed payments should be deleted (and not the successful ones), the
2525
2626
CAUTION: Running this command will make it impossible to use the channel DB
2727
with an older version of lnd. Downgrading is not possible and you'll need to
28-
run lnd v0.13.1-beta or later after using this command!'`,
28+
run lnd v0.14.1-beta or later after using this command!'`,
2929
Example: `chantools deletepayments --failedonly \
3030
--channeldb ~/.lnd/data/graph/mainnet/channel.db`,
3131
RunE: cc.Execute,

cmd/chantools/dropchannelgraph.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ without removing any other data.
3333
3434
CAUTION: Running this command will make it impossible to use the channel DB
3535
with an older version of lnd. Downgrading is not possible and you'll need to
36-
run lnd v0.13.1-beta or later after using this command!'`,
36+
run lnd v0.14.1-beta or later after using this command!'`,
3737
Example: `chantools dropchannelgraph \
3838
--channeldb ~/.lnd/data/graph/mainnet/channel.db
3939

cmd/chantools/dumpchannels.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,12 @@ func (c *dumpChannelsCommand) Execute(_ *cobra.Command, _ []string) error {
5353
defer func() { _ = db.Close() }()
5454

5555
if c.Closed {
56-
return dumpClosedChannelInfo(db)
56+
return dumpClosedChannelInfo(db.ChannelStateDB())
5757
}
58-
return dumpOpenChannelInfo(db)
58+
return dumpOpenChannelInfo(db.ChannelStateDB())
5959
}
6060

61-
func dumpOpenChannelInfo(chanDb *channeldb.DB) error {
61+
func dumpOpenChannelInfo(chanDb *channeldb.ChannelStateDB) error {
6262
channels, err := chanDb.FetchAllChannels()
6363
if err != nil {
6464
return err
@@ -77,7 +77,7 @@ func dumpOpenChannelInfo(chanDb *channeldb.DB) error {
7777
return nil
7878
}
7979

80-
func dumpClosedChannelInfo(chanDb *channeldb.DB) error {
80+
func dumpClosedChannelInfo(chanDb *channeldb.ChannelStateDB) error {
8181
channels, err := chanDb.FetchClosedChannels(false)
8282
if err != nil {
8383
return err

cmd/chantools/forceclose.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,13 @@ func (c *forceCloseCommand) Execute(_ *cobra.Command, _ []string) error {
9292
if err != nil {
9393
return err
9494
}
95-
return forceCloseChannels(c.APIURL, extendedKey, entries, db, c.Publish)
95+
return forceCloseChannels(
96+
c.APIURL, extendedKey, entries, db.ChannelStateDB(), c.Publish,
97+
)
9698
}
9799

98100
func forceCloseChannels(apiURL string, extendedKey *hdkeychain.ExtendedKey,
99-
entries []*dataformat.SummaryEntry, chanDb *channeldb.DB,
101+
entries []*dataformat.SummaryEntry, chanDb *channeldb.ChannelStateDB,
100102
publish bool) error {
101103

102104
channels, err := chanDb.FetchAllChannels()

cmd/chantools/migratedb.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ needs to read the database content.
2525
2626
CAUTION: Running this command will make it impossible to use the channel DB
2727
with an older version of lnd. Downgrading is not possible and you'll need to
28-
run lnd v0.13.1-beta or later after using this command!'`,
28+
run lnd v0.14.1-beta or later after using this command!'`,
2929
Example: `chantools migratedb \
3030
--channeldb ~/.lnd/data/graph/mainnet/channel.db`,
3131
RunE: cc.Execute,

cmd/chantools/removechannel.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ channel was never confirmed on chain!
3131
3232
CAUTION: Running this command will make it impossible to use the channel DB
3333
with an older version of lnd. Downgrading is not possible and you'll need to
34-
run lnd v0.13.1-beta or later after using this command!`,
34+
run lnd v0.14.1-beta or later after using this command!`,
3535
Example: `chantools removechannel \
3636
--channeldb ~/.lnd/data/graph/mainnet/channel.db \
3737
--channel 3149764effbe82718b280de425277e5e7b245a4573aa4a0203ac12cee1c37816:0`,
@@ -78,14 +78,16 @@ func (c *removeChannelCommand) Execute(_ *cobra.Command, _ []string) error {
7878
return err
7979
}
8080

81-
return removeChannel(db, &wire.OutPoint{
81+
return removeChannel(db.ChannelStateDB(), &wire.OutPoint{
8282
Hash: *hash,
8383
Index: uint32(index),
8484
})
8585
}
8686

87-
func removeChannel(db *channeldb.DB, chanPoint *wire.OutPoint) error {
88-
dbChan, err := db.FetchChannel(*chanPoint)
87+
func removeChannel(db *channeldb.ChannelStateDB,
88+
chanPoint *wire.OutPoint) error {
89+
90+
dbChan, err := db.FetchChannel(nil, *chanPoint)
8991
if err != nil {
9092
return err
9193
}

cmd/chantools/rescueclosed.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ func (c *rescueClosedCommand) Execute(_ *cobra.Command, _ []string) error {
126126
return err
127127
}
128128

129-
commitPoints, err := commitPointsFromDB(db)
129+
commitPoints, err := commitPointsFromDB(db.ChannelStateDB())
130130
if err != nil {
131131
return fmt.Errorf("error reading commit points from "+
132132
"db: %v", err)
@@ -176,7 +176,9 @@ func (c *rescueClosedCommand) Execute(_ *cobra.Command, _ []string) error {
176176
}
177177
}
178178

179-
func commitPointsFromDB(chanDb *channeldb.DB) ([]*btcec.PublicKey, error) {
179+
func commitPointsFromDB(chanDb *channeldb.ChannelStateDB) ([]*btcec.PublicKey,
180+
error) {
181+
180182
var result []*btcec.PublicKey
181183

182184
channels, err := chanDb.FetchAllChannels()

cmd/chantools/rescuefunding.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,9 @@ func (c *rescueFundingCommand) Execute(_ *cobra.Command, _ []string) error {
169169
}
170170

171171
// First, make sure the channel can be found in the DB.
172-
pendingChan, err := db.FetchChannel(*databaseOp)
172+
pendingChan, err := db.ChannelStateDB().FetchChannel(
173+
nil, *databaseOp,
174+
)
173175
if err != nil {
174176
return fmt.Errorf("error loading pending channel %s "+
175177
"from DB: %v", databaseOp, err)

cmd/chantools/root.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import (
2626

2727
const (
2828
defaultAPIURL = "https://blockstream.info/api"
29-
version = "0.9.6"
29+
version = "0.10.0"
3030
na = "n/a"
3131

3232
Commit = ""
@@ -211,7 +211,7 @@ func (f *inputFlags) parseInputType() ([]*dataformat.SummaryEntry, error) {
211211
return nil, fmt.Errorf("error opening channel DB: %v",
212212
err)
213213
}
214-
target = &dataformat.ChannelDBFile{DB: db}
214+
target = &dataformat.ChannelDBFile{DB: db.ChannelStateDB()}
215215
return target.AsSummaryEntries()
216216

217217
default:

cmd/chantools/zombierecovery_makeoffer.go

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ import (
1515
"github.com/btcsuite/btcd/chaincfg"
1616
"github.com/btcsuite/btcd/wire"
1717
"github.com/btcsuite/btcutil/psbt"
18+
"github.com/btcsuite/btcwallet/wallet/txrules"
1819
"github.com/guggero/chantools/lnd"
1920
"github.com/lightningnetwork/lnd/input"
2021
"github.com/lightningnetwork/lnd/keychain"
21-
"github.com/lightningnetwork/lnd/lnwallet"
2222
"github.com/lightningnetwork/lnd/lnwallet/chainfee"
2323
"github.com/spf13/cobra"
2424
)
@@ -330,11 +330,31 @@ channelLoop:
330330
return fmt.Errorf("error distributing fees, unhandled case")
331331
}
332332

333+
// Our output.
334+
pkScript, err := lnd.GetP2WPKHScript(ourPayoutAddr, chainParams)
335+
if err != nil {
336+
return fmt.Errorf("error parsing our payout address: %v", err)
337+
}
338+
ourTxOut := &wire.TxOut{
339+
PkScript: pkScript,
340+
Value: ourSum,
341+
}
342+
343+
// Their output
344+
pkScript, err = lnd.GetP2WPKHScript(theirPayoutAddr, chainParams)
345+
if err != nil {
346+
return fmt.Errorf("error parsing their payout address: %v", err)
347+
}
348+
theirTxOut := &wire.TxOut{
349+
PkScript: pkScript,
350+
Value: theirSum,
351+
}
352+
333353
// Don't create dust.
334-
if ourSum <= int64(lnwallet.DefaultDustLimit()) {
354+
if txrules.IsDustOutput(ourTxOut, txrules.DefaultRelayFeePerKb) {
335355
ourSum = 0
336356
}
337-
if theirSum <= int64(lnwallet.DefaultDustLimit()) {
357+
if txrules.IsDustOutput(theirTxOut, txrules.DefaultRelayFeePerKb) {
338358
theirSum = 0
339359
}
340360

@@ -346,28 +366,10 @@ channelLoop:
346366
// And now create the PSBT.
347367
tx := wire.NewMsgTx(2)
348368
if ourSum > 0 {
349-
pkScript, err := lnd.GetP2WPKHScript(ourPayoutAddr, chainParams)
350-
if err != nil {
351-
return fmt.Errorf("error parsing our payout address: "+
352-
"%v", err)
353-
}
354-
tx.TxOut = append(tx.TxOut, &wire.TxOut{
355-
PkScript: pkScript,
356-
Value: ourSum,
357-
})
369+
tx.TxOut = append(tx.TxOut, ourTxOut)
358370
}
359371
if theirSum > 0 {
360-
pkScript, err := lnd.GetP2WPKHScript(
361-
theirPayoutAddr, chainParams,
362-
)
363-
if err != nil {
364-
return fmt.Errorf("error parsing their payout "+
365-
"address: %v", err)
366-
}
367-
tx.TxOut = append(tx.TxOut, &wire.TxOut{
368-
PkScript: pkScript,
369-
Value: theirSum,
370-
})
372+
tx.TxOut = append(tx.TxOut, theirTxOut)
371373
}
372374
for _, txIn := range inputs {
373375
tx.TxIn = append(tx.TxIn, &wire.TxIn{

0 commit comments

Comments
 (0)