From 599eb2ee993d42a8eae88c75d53347db02838950 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Tue, 4 Jul 2023 17:21:46 -0700 Subject: [PATCH 1/2] challenger: skip trying to load+parse AMP invoices AMP invoiecs don't have a payment hash, as it's based on payment addr and set id. --- challenger/lnd.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/challenger/lnd.go b/challenger/lnd.go index 9e10a02..00bd53e 100644 --- a/challenger/lnd.go +++ b/challenger/lnd.go @@ -102,6 +102,12 @@ func (l *LndChallenger) Start() error { // updates for new invoices and/or newly settled invoices. l.invoicesMtx.Lock() for _, invoice := range invoiceResp.Invoices { + // Some invoices like AMP invoices may not have a payment hash + // populated. + if invoice.RHash == nil { + continue + } + if invoice.AddIndex > addIndex { addIndex = invoice.AddIndex } @@ -207,6 +213,12 @@ func (l *LndChallenger) readInvoiceStream( default: } + // Some invoices like AMP invoices may not have a payment hash + // populated. + if invoice.RHash == nil { + continue + } + hash, err := lntypes.MakeHash(invoice.RHash) if err != nil { log.Errorf("Error parsing invoice hash: %v", err) From c1dea365a1ab2a7b7d1d51ee79330fc5c4176bc1 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Tue, 4 Jul 2023 17:23:19 -0700 Subject: [PATCH 2/2] config: fix config parsing for new dbbackend option For the yaml parser, since the public attribute differs from the name of the yaml field, we need to specify the `yaml` flag. --- config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.go b/config.go index c607d21..928a2a6 100644 --- a/config.go +++ b/config.go @@ -161,7 +161,7 @@ type Config struct { ServeStatic bool `long:"servestatic" description:"Flag to enable or disable static content serving."` // DatabaseBackend is the database backend to be used by the server. - DatabaseBackend string `long:"dbbackend" description:"The database backend to use for storing all asset related data." choice:"sqlite" choice:"postgres"` + DatabaseBackend string `long:"dbbackend" description:"The database backend to use for storing all asset related data." choice:"sqlite" choice:"postgres" yaml:"dbbackend"` // Sqlite is the configuration section for the SQLite database backend. Sqlite *aperturedb.SqliteConfig `group:"sqlite" namespace:"sqlite"`