channeldb: add now function

Needed for time control in unit tests.
This commit is contained in:
Joost Jager committed 2019-09-04 19:20:29 +02:00
1 parent c8fa51f865
commit 53eea09b63
3 files changed
+10 -5

No files matched your search

+2
View File
@@ -129,6 +129,7 @@ type DB struct {
*bbolt.DB
dbPath string
graph *ChannelGraph
now func() time.Time
}
// Open opens an existing channeldb. Any necessary schemas migrations due to
@@ -162,6 +163,7 @@ func Open(dbPath string, modifiers ...OptionModifier) (*DB, error) {
chanDB := &DB{
DB: bdb,
dbPath: dbPath,
now: time.Now,
}
chanDB.graph = newChannelGraph(
chanDB, opts.RejectCacheSize, opts.ChannelCacheSize,