@@ -35,13 +35,13 @@ var (
35
35
ErrConfirmHintNotFound = errors .New ("confirm hint not found" )
36
36
)
37
37
38
- // Config contains the HeightHintCache configuration
39
- type Config struct {
40
- // HeightHintCacheQueryDisable prevents reliance on the Height Hint Cache.
41
- // This is necessary to recover from an edge case when the height
42
- // recorded in the cache is higher than the actual height of a spend,
43
- // causing a channel to become "stuck" in a pending close state.
44
- HeightHintCacheQueryDisable bool
38
+ // CacheConfig contains the HeightHintCache configuration
39
+ type CacheConfig struct {
40
+ // QueryDisable prevents reliance on the Height Hint Cache. This is
41
+ // necessary to recover from an edge case when the height recorded in
42
+ // the cache is higher than the actual height of a spend, causing a
43
+ // channel to become "stuck" in a pending close state.
44
+ QueryDisable bool
45
45
}
46
46
47
47
// SpendHintCache is an interface whose duty is to cache spend hints for
@@ -83,7 +83,7 @@ type ConfirmHintCache interface {
83
83
// ConfirmHintCache interfaces backed by a channeldb DB instance where the hints
84
84
// will be stored.
85
85
type HeightHintCache struct {
86
- cfg Config
86
+ cfg CacheConfig
87
87
db * channeldb.DB
88
88
}
89
89
@@ -93,7 +93,7 @@ var _ SpendHintCache = (*HeightHintCache)(nil)
93
93
var _ ConfirmHintCache = (* HeightHintCache )(nil )
94
94
95
95
// NewHeightHintCache returns a new height hint cache backed by a database.
96
- func NewHeightHintCache (cfg Config , db * channeldb.DB ) (* HeightHintCache , error ) {
96
+ func NewHeightHintCache (cfg CacheConfig , db * channeldb.DB ) (* HeightHintCache , error ) {
97
97
cache := & HeightHintCache {cfg , db }
98
98
if err := cache .initBuckets (); err != nil {
99
99
return nil , err
@@ -158,8 +158,8 @@ func (c *HeightHintCache) CommitSpendHint(height uint32,
158
158
// cache for the outpoint.
159
159
func (c * HeightHintCache ) QuerySpendHint (spendRequest SpendRequest ) (uint32 , error ) {
160
160
var hint uint32
161
- if c .cfg .HeightHintCacheQueryDisable {
162
161
Log .Debugf ("Ignoring spend height hint for %v (height hint cache query disabled)" , spendRequest )
162
+ if c .cfg .QueryDisable {
163
163
return 0 , nil
164
164
}
165
165
err := kvdb .View (c .db , func (tx kvdb.RTx ) error {
@@ -256,8 +256,8 @@ func (c *HeightHintCache) CommitConfirmHint(height uint32,
256
256
// the cache for the transaction hash.
257
257
func (c * HeightHintCache ) QueryConfirmHint (confRequest ConfRequest ) (uint32 , error ) {
258
258
var hint uint32
259
- if c .cfg .HeightHintCacheQueryDisable {
260
259
Log .Debugf ("Ignoring confirmation height hint for %v (height hint cache query disabled)" , confRequest )
260
+ if c .cfg .QueryDisable {
261
261
return 0 , nil
262
262
}
263
263
err := kvdb .View (c .db , func (tx kvdb.RTx ) error {
0 commit comments