channeldb: add now function
Needed for time control in unit tests.
This commit is contained in:
3 files changed
+10
-5
No files matched your search
@@ -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,
|
||||
|
||||
Reference in new issue
Block a user