diff --git a/channeldb/db.go b/channeldb/db.go index cf811aa6..c3f63234 100644 --- a/channeldb/db.go +++ b/channeldb/db.go @@ -137,7 +137,8 @@ type DB struct { *bbolt.DB dbPath string graph *ChannelGraph - now func() time.Time + + Now func() time.Time } // Open opens an existing channeldb. Any necessary schemas migrations due to @@ -171,7 +172,7 @@ func Open(dbPath string, modifiers ...OptionModifier) (*DB, error) { chanDB := &DB{ DB: bdb, dbPath: dbPath, - now: time.Now, + Now: time.Now, } chanDB.graph = newChannelGraph( chanDB, opts.RejectCacheSize, opts.ChannelCacheSize, diff --git a/channeldb/invoice_test.go b/channeldb/invoice_test.go index 46687e25..82d96082 100644 --- a/channeldb/invoice_test.go +++ b/channeldb/invoice_test.go @@ -337,7 +337,7 @@ func TestDuplicateSettleInvoice(t *testing.T) { if err != nil { t.Fatalf("unable to make test db: %v", err) } - db.now = func() time.Time { return time.Unix(1, 0) } + db.Now = func() time.Time { return time.Unix(1, 0) } // We'll start out by creating an invoice and writing it to the DB. amt := lnwire.NewMSatFromSatoshis(1000) diff --git a/channeldb/invoices.go b/channeldb/invoices.go index d06ef46a..c1fd4533 100644 --- a/channeldb/invoices.go +++ b/channeldb/invoices.go @@ -1244,7 +1244,7 @@ func (d *DB) updateInvoice(hash lntypes.Hash, invoices, settleIndex *bbolt.Bucke // Update invoice state. invoice.State = update.State - now := d.now() + now := d.Now() // Update htlc set. for key, htlcUpdate := range update.Htlcs {