beacon: add constructor
This commit is contained in:
2 files changed
+8
-4
No files matched your search
@@ -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 {
|
||||||
|
|||||||
Reference in new issue
Block a user