channeldb: export now function

To allow mocking when testing other packages.
This commit is contained in:
Joost Jager committed 2019-12-04 14:51:31 +01:00
1 parent 1371e5affc
commit e234f88b82
3 files changed
+5 -4

No files matched your search

+3 -2
View File
@@ -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,