Skip to content

Commit b1286e7

Browse files
committed
multi: update lnd to 0.12.1-beta, add deletepayments command
1 parent b0fd539 commit b1286e7

File tree

7 files changed

+86
-334
lines changed

7 files changed

+86
-334
lines changed

cmd/chantools/deletepayments.go

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
package main
2+
3+
import (
4+
"fmt"
5+
6+
"github.com/guggero/chantools/lnd"
7+
"github.com/spf13/cobra"
8+
)
9+
10+
type deletePaymentsCommand struct {
11+
ChannelDB string
12+
FailedOnly bool
13+
14+
cmd *cobra.Command
15+
}
16+
17+
func newDeletePaymentsCommand() *cobra.Command {
18+
cc := &deletePaymentsCommand{}
19+
cc.cmd = &cobra.Command{
20+
Use: "deletepayments",
21+
Short: "Remove all (failed) payments from a channel DB",
22+
Long: `This command removes all payments from a channel DB.
23+
If only the failed payments should be deleted (and not the successful ones), the
24+
--failedonly flag can be specified.
25+
26+
CAUTION: Running this command will make it impossible to use the channel DB
27+
with an older version of lnd. Downgrading is not possible and you'll need to
28+
run lnd v0.12.1-beta or later after using this command!'`,
29+
Example: `chantools deletepayments --failedonly \
30+
--channeldb ~/.lnd/data/graph/mainnet/channel.db`,
31+
RunE: cc.Execute,
32+
}
33+
cc.cmd.Flags().StringVar(
34+
&cc.ChannelDB, "channeldb", "", "lnd channel.db file to dump "+
35+
"channels from",
36+
)
37+
cc.cmd.Flags().BoolVar(
38+
&cc.FailedOnly, "failedonly", false, "don't delete all "+
39+
"payments, only failed ones",
40+
)
41+
42+
return cc.cmd
43+
}
44+
45+
func (c *deletePaymentsCommand) Execute(_ *cobra.Command, _ []string) error {
46+
// Check that we have a channel DB.
47+
if c.ChannelDB == "" {
48+
return fmt.Errorf("channel DB is required")
49+
}
50+
db, err := lnd.OpenDB(c.ChannelDB, false)
51+
if err != nil {
52+
return fmt.Errorf("error opening rescue DB: %v", err)
53+
}
54+
defer func() { _ = db.Close() }()
55+
56+
return db.DeletePayments(c.FailedOnly, false)
57+
}

cmd/chantools/dropchannelgraph.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ forcing the lnd node to do a full graph sync.
2929
3030
CAUTION: Running this command will make it impossible to use the channel DB
3131
with an older version of lnd. Downgrading is not possible and you'll need to
32-
run lnd v0.12.0-beta or later after using this command!'`,
32+
run lnd v0.12.1-beta or later after using this command!'`,
3333
Example: `chantools dropchannelgraph \
3434
--channeldb ~/.lnd/data/graph/mainnet/channel.db`,
3535
RunE: cc.Execute,

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.12.0-beta or later after using this command!'`,
28+
run lnd v0.12.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: 1 addition & 1 deletion
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.12.0-beta or later after using this command!`,
34+
run lnd v0.12.1-beta or later after using this command!`,
3535
Example: `chantools removechannel \
3636
--channeldb ~/.lnd/data/graph/mainnet/channel.db \
3737
--channel 3149764effbe82718b280de425277e5e7b245a4573aa4a0203ac12cee1c37816:0`,

cmd/chantools/root.go

Lines changed: 2 additions & 1 deletion
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.8.5"
29+
version = "0.8.6"
3030
na = "n/a"
3131

3232
Commit = ""
@@ -81,6 +81,7 @@ func main() {
8181
rootCmd.AddCommand(
8282
newChanBackupCommand(),
8383
newCompactDBCommand(),
84+
newDeletePaymentsCommand(),
8485
newDeriveKeyCommand(),
8586
newDropChannelGraphCommand(),
8687
newDumpBackupCommand(),

go.mod

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,26 @@ require (
1111
github.com/btcsuite/btcwallet/walletdb v1.3.4
1212
github.com/coreos/bbolt v1.3.3
1313
github.com/davecgh/go-spew v1.1.1
14+
github.com/frankban/quicktest v1.11.2 // indirect
15+
github.com/fsnotify/fsnotify v1.4.9 // indirect
1416
github.com/gogo/protobuf v1.2.1
15-
github.com/gohugoio/hugo v0.79.1 // indirect
16-
github.com/jessevdk/go-flags v1.4.0 // indirect
17+
github.com/google/go-cmp v0.5.3 // indirect
1718
github.com/lightningnetwork/lnd v0.11.1-beta
1819
github.com/ltcsuite/ltcd v0.0.0-20191228044241-92166e412499 // indirect
1920
github.com/miekg/dns v1.1.26 // indirect
21+
github.com/pkg/errors v0.9.1 // indirect
2022
github.com/spf13/cobra v1.1.1
2123
github.com/stretchr/testify v1.6.1
2224
go.etcd.io/bbolt v1.3.5-0.20200615073812-232d8fc87f50
2325
golang.org/x/crypto v0.0.0-20200709230013-948cd5f35899
26+
golang.org/x/net v0.0.0-20200202094626-16171245cfb2 // indirect
27+
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e // indirect
28+
golang.org/x/sys v0.0.0-20200501145240-bc7a7d42d5c3 // indirect
29+
golang.org/x/text v0.3.4 // indirect
30+
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
31+
gopkg.in/yaml.v2 v2.4.0 // indirect
2432
)
2533

26-
replace github.com/lightningnetwork/lnd => github.com/guggero/lnd v0.11.0-beta.rc4.0.20210101121045-2ae6e51765fe
34+
replace github.com/lightningnetwork/lnd => github.com/guggero/lnd v0.11.0-beta.rc4.0.20210609102733-8d0a492ec962
2735

2836
go 1.13

0 commit comments

Comments
 (0)