mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-05-31 18:21:42 +02:00
beacon: add constructor
This commit is contained in:
parent
57e08dfa54
commit
7265a5e42b
@ -595,10 +595,7 @@ func newServer(cfg *Config, listenAddrs []net.Addr,
|
|||||||
quit: make(chan struct{}),
|
quit: make(chan struct{}),
|
||||||
}
|
}
|
||||||
|
|
||||||
s.witnessBeacon = &preimageBeacon{
|
s.witnessBeacon = newPreimageBeacon(dbs.ChanStateDB.NewWitnessCache())
|
||||||
wCache: dbs.ChanStateDB.NewWitnessCache(),
|
|
||||||
subscribers: make(map[uint64]*preimageSubscriber),
|
|
||||||
}
|
|
||||||
|
|
||||||
currentHash, currentHeight, err := s.cc.ChainIO.GetBestBlock()
|
currentHash, currentHeight, err := s.cc.ChainIO.GetBestBlock()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -28,6 +28,13 @@ type preimageBeacon struct {
|
|||||||
subscribers map[uint64]*preimageSubscriber
|
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
|
// SubscribeUpdates returns a channel that will be sent upon *each* time a new
|
||||||
// preimage is discovered.
|
// preimage is discovered.
|
||||||
func (p *preimageBeacon) SubscribeUpdates() *contractcourt.WitnessSubscription {
|
func (p *preimageBeacon) SubscribeUpdates() *contractcourt.WitnessSubscription {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user