Skip to content

Commit 87bb996

Browse files
authored
Merge pull request #103 from Roasbeef/amp-sqlite-bug-fixes
challenger+config: fix bugs related to config parsing and AMP invoice handling
2 parents 510d409 + c1dea36 commit 87bb996

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

challenger/lnd.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,12 @@ func (l *LndChallenger) Start() error {
102102
// updates for new invoices and/or newly settled invoices.
103103
l.invoicesMtx.Lock()
104104
for _, invoice := range invoiceResp.Invoices {
105+
// Some invoices like AMP invoices may not have a payment hash
106+
// populated.
107+
if invoice.RHash == nil {
108+
continue
109+
}
110+
105111
if invoice.AddIndex > addIndex {
106112
addIndex = invoice.AddIndex
107113
}
@@ -207,6 +213,12 @@ func (l *LndChallenger) readInvoiceStream(
207213
default:
208214
}
209215

216+
// Some invoices like AMP invoices may not have a payment hash
217+
// populated.
218+
if invoice.RHash == nil {
219+
continue
220+
}
221+
210222
hash, err := lntypes.MakeHash(invoice.RHash)
211223
if err != nil {
212224
log.Errorf("Error parsing invoice hash: %v", err)

config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ type Config struct {
161161
ServeStatic bool `long:"servestatic" description:"Flag to enable or disable static content serving."`
162162

163163
// DatabaseBackend is the database backend to be used by the server.
164-
DatabaseBackend string `long:"dbbackend" description:"The database backend to use for storing all asset related data." choice:"sqlite" choice:"postgres"`
164+
DatabaseBackend string `long:"dbbackend" description:"The database backend to use for storing all asset related data." choice:"sqlite" choice:"postgres" yaml:"dbbackend"`
165165

166166
// Sqlite is the configuration section for the SQLite database backend.
167167
Sqlite *aperturedb.SqliteConfig `group:"sqlite" namespace:"sqlite"`

0 commit comments

Comments
 (0)