mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-02-22 22:25:24 +01:00
beacon: add constructor
This commit is contained in:
parent
57e08dfa54
commit
7265a5e42b
2 changed files with 8 additions and 4 deletions
|
@ -595,10 +595,7 @@ func newServer(cfg *Config, listenAddrs []net.Addr,
|
|||
quit: make(chan struct{}),
|
||||
}
|
||||
|
||||
s.witnessBeacon = &preimageBeacon{
|
||||
wCache: dbs.ChanStateDB.NewWitnessCache(),
|
||||
subscribers: make(map[uint64]*preimageSubscriber),
|
||||
}
|
||||
s.witnessBeacon = newPreimageBeacon(dbs.ChanStateDB.NewWitnessCache())
|
||||
|
||||
currentHash, currentHeight, err := s.cc.ChainIO.GetBestBlock()
|
||||
if err != nil {
|
||||
|
|
|
@ -28,6 +28,13 @@ type preimageBeacon struct {
|
|||
subscribers map[uint64]*preimageSubscriber
|
||||
}
|
||||
|
||||
func newPreimageBeacon(wCache *channeldb.WitnessCache) *preimageBeacon {
|
||||
return &preimageBeacon{
|
||||
wCache: wCache,
|
||||
subscribers: make(map[uint64]*preimageSubscriber),
|
||||
}
|
||||
}
|
||||
|
||||
// SubscribeUpdates returns a channel that will be sent upon *each* time a new
|
||||
// preimage is discovered.
|
||||
func (p *preimageBeacon) SubscribeUpdates() *contractcourt.WitnessSubscription {
|
||||
|
|
Loading…
Add table
Reference in a new issue