multi: update to latest RegisterBlockEpochNtfn interface
This commit is contained in:
parent
71a81f59a9
commit
1ffc3bb82e
@ -526,7 +526,7 @@ func testBlockEpochNotification(miner *rpctest.Harness,
|
|||||||
// blocks we generate below. So we'll use a WaitGroup to synchronize the
|
// blocks we generate below. So we'll use a WaitGroup to synchronize the
|
||||||
// test.
|
// test.
|
||||||
for i := 0; i < numClients; i++ {
|
for i := 0; i < numClients; i++ {
|
||||||
epochClient, err := notifier.RegisterBlockEpochNtfn()
|
epochClient, err := notifier.RegisterBlockEpochNtfn(nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("unable to register for epoch notification")
|
t.Fatalf("unable to register for epoch notification")
|
||||||
}
|
}
|
||||||
@ -898,7 +898,7 @@ func testSpendBeforeNtfnRegistration(miner *rpctest.Harness,
|
|||||||
|
|
||||||
// We create an epoch client we can use to make sure the notifier is
|
// We create an epoch client we can use to make sure the notifier is
|
||||||
// caught up to the mining node's chain.
|
// caught up to the mining node's chain.
|
||||||
epochClient, err := notifier.RegisterBlockEpochNtfn()
|
epochClient, err := notifier.RegisterBlockEpochNtfn(nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("unable to register for block epoch: %v", err)
|
t.Fatalf("unable to register for block epoch: %v", err)
|
||||||
}
|
}
|
||||||
@ -1082,7 +1082,7 @@ func testCancelEpochNtfn(node *rpctest.Harness, notifier chainntnfs.ChainNotifie
|
|||||||
|
|
||||||
epochClients := make([]*chainntnfs.BlockEpochEvent, numClients)
|
epochClients := make([]*chainntnfs.BlockEpochEvent, numClients)
|
||||||
for i := 0; i < numClients; i++ {
|
for i := 0; i < numClients; i++ {
|
||||||
epochClient, err := notifier.RegisterBlockEpochNtfn()
|
epochClient, err := notifier.RegisterBlockEpochNtfn(nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("unable to register for epoch notification")
|
t.Fatalf("unable to register for epoch notification")
|
||||||
}
|
}
|
||||||
|
@ -194,7 +194,7 @@ func newActiveChannelArbitrator(channel *channeldb.OpenChannel,
|
|||||||
//
|
//
|
||||||
// TODO(roasbeef): instead 1 block epoch that multi-plexes to the rest?
|
// TODO(roasbeef): instead 1 block epoch that multi-plexes to the rest?
|
||||||
// * reduces the number of goroutines
|
// * reduces the number of goroutines
|
||||||
blockEpoch, err := c.cfg.Notifier.RegisterBlockEpochNtfn()
|
blockEpoch, err := c.cfg.Notifier.RegisterBlockEpochNtfn(nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -384,7 +384,7 @@ func (c *ChainArbitrator) Start() error {
|
|||||||
// the chain any longer, only resolve the contracts on the confirmed
|
// the chain any longer, only resolve the contracts on the confirmed
|
||||||
// commitment.
|
// commitment.
|
||||||
for _, closeChanInfo := range closingChannels {
|
for _, closeChanInfo := range closingChannels {
|
||||||
blockEpoch, err := c.cfg.Notifier.RegisterBlockEpochNtfn()
|
blockEpoch, err := c.cfg.Notifier.RegisterBlockEpochNtfn(nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,8 @@ func (m *mockNotifier) RegisterConfirmationsNtfn(txid *chainhash.Hash, _ []byte,
|
|||||||
heightHint uint32) (*chainntnfs.ConfirmationEvent, error) {
|
heightHint uint32) (*chainntnfs.ConfirmationEvent, error) {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
func (m *mockNotifier) RegisterBlockEpochNtfn() (*chainntnfs.BlockEpochEvent, error) {
|
func (m *mockNotifier) RegisterBlockEpochNtfn(
|
||||||
|
bestBlock *chainntnfs.BlockEpoch) (*chainntnfs.BlockEpochEvent, error) {
|
||||||
return &chainntnfs.BlockEpochEvent{
|
return &chainntnfs.BlockEpochEvent{
|
||||||
Epochs: make(chan *chainntnfs.BlockEpoch),
|
Epochs: make(chan *chainntnfs.BlockEpoch),
|
||||||
Cancel: func() {},
|
Cancel: func() {},
|
||||||
|
@ -855,7 +855,7 @@ func (h *htlcOutgoingContestResolver) Resolve() (ContractResolver, error) {
|
|||||||
// If we reach this point, then we can't fully act yet, so we'll await
|
// If we reach this point, then we can't fully act yet, so we'll await
|
||||||
// either of our signals triggering: the HTLC expires, or we learn of
|
// either of our signals triggering: the HTLC expires, or we learn of
|
||||||
// the preimage.
|
// the preimage.
|
||||||
blockEpochs, err := h.Notifier.RegisterBlockEpochNtfn()
|
blockEpochs, err := h.Notifier.RegisterBlockEpochNtfn(nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -1043,7 +1043,7 @@ func (h *htlcIncomingContestResolver) Resolve() (ContractResolver, error) {
|
|||||||
// ensure the preimage can't be delivered between querying and
|
// ensure the preimage can't be delivered between querying and
|
||||||
// registering for the preimage subscription.
|
// registering for the preimage subscription.
|
||||||
preimageSubscription := h.PreimageDB.SubscribeUpdates()
|
preimageSubscription := h.PreimageDB.SubscribeUpdates()
|
||||||
blockEpochs, err := h.Notifier.RegisterBlockEpochNtfn()
|
blockEpochs, err := h.Notifier.RegisterBlockEpochNtfn(nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -408,7 +408,7 @@ func (d *AuthenticatedGossiper) Start() error {
|
|||||||
// First we register for new notifications of newly discovered blocks.
|
// First we register for new notifications of newly discovered blocks.
|
||||||
// We do this immediately so we'll later be able to consume any/all
|
// We do this immediately so we'll later be able to consume any/all
|
||||||
// blocks which were discovered.
|
// blocks which were discovered.
|
||||||
blockEpochs, err := d.cfg.Notifier.RegisterBlockEpochNtfn()
|
blockEpochs, err := d.cfg.Notifier.RegisterBlockEpochNtfn(nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -280,7 +280,8 @@ func (m *mockNotifier) notifyBlock(hash chainhash.Hash, height uint32) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *mockNotifier) RegisterBlockEpochNtfn() (*chainntnfs.BlockEpochEvent, error) {
|
func (m *mockNotifier) RegisterBlockEpochNtfn(
|
||||||
|
bestBlock *chainntnfs.BlockEpoch) (*chainntnfs.BlockEpochEvent, error) {
|
||||||
m.RLock()
|
m.RLock()
|
||||||
defer m.RUnlock()
|
defer m.RUnlock()
|
||||||
|
|
||||||
|
@ -1705,7 +1705,7 @@ func (f *fundingManager) handleFundingSigned(fmsg *fundingSignedMsg) {
|
|||||||
func (f *fundingManager) waitForFundingWithTimeout(completeChan *channeldb.OpenChannel,
|
func (f *fundingManager) waitForFundingWithTimeout(completeChan *channeldb.OpenChannel,
|
||||||
confChan chan<- *lnwire.ShortChannelID, timeoutChan chan<- struct{}) {
|
confChan chan<- *lnwire.ShortChannelID, timeoutChan chan<- struct{}) {
|
||||||
|
|
||||||
epochClient, err := f.cfg.Notifier.RegisterBlockEpochNtfn()
|
epochClient, err := f.cfg.Notifier.RegisterBlockEpochNtfn(nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fndgLog.Errorf("unable to register for epoch notification: %v",
|
fndgLog.Errorf("unable to register for epoch notification: %v",
|
||||||
err)
|
err)
|
||||||
|
@ -112,7 +112,8 @@ func (m *mockNotifier) RegisterConfirmationsNtfn(txid *chainhash.Hash,
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *mockNotifier) RegisterBlockEpochNtfn() (*chainntnfs.BlockEpochEvent, error) {
|
func (m *mockNotifier) RegisterBlockEpochNtfn(
|
||||||
|
bestBlock *chainntnfs.BlockEpoch) (*chainntnfs.BlockEpochEvent, error) {
|
||||||
return &chainntnfs.BlockEpochEvent{
|
return &chainntnfs.BlockEpochEvent{
|
||||||
Epochs: m.epochChan,
|
Epochs: m.epochChan,
|
||||||
Cancel: func() {},
|
Cancel: func() {},
|
||||||
|
@ -103,7 +103,7 @@ func (d *DecayedLog) Start() error {
|
|||||||
|
|
||||||
// Start garbage collector.
|
// Start garbage collector.
|
||||||
if d.notifier != nil {
|
if d.notifier != nil {
|
||||||
epochClient, err := d.notifier.RegisterBlockEpochNtfn()
|
epochClient, err := d.notifier.RegisterBlockEpochNtfn(nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("Unable to register for epoch "+
|
return fmt.Errorf("Unable to register for epoch "+
|
||||||
"notifications: %v", err)
|
"notifications: %v", err)
|
||||||
|
@ -790,7 +790,8 @@ func (m *mockNotifier) RegisterConfirmationsNtfn(txid *chainhash.Hash, _ []byte,
|
|||||||
numConfs uint32, heightHint uint32) (*chainntnfs.ConfirmationEvent, error) {
|
numConfs uint32, heightHint uint32) (*chainntnfs.ConfirmationEvent, error) {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
func (m *mockNotifier) RegisterBlockEpochNtfn() (*chainntnfs.BlockEpochEvent, error) {
|
func (m *mockNotifier) RegisterBlockEpochNtfn(
|
||||||
|
bestBlock *chainntnfs.BlockEpoch) (*chainntnfs.BlockEpochEvent, error) {
|
||||||
return &chainntnfs.BlockEpochEvent{
|
return &chainntnfs.BlockEpochEvent{
|
||||||
Epochs: m.epochChan,
|
Epochs: m.epochChan,
|
||||||
Cancel: func() {},
|
Cancel: func() {},
|
||||||
|
@ -1596,7 +1596,7 @@ func (s *Switch) Start() error {
|
|||||||
|
|
||||||
log.Infof("Starting HTLC Switch")
|
log.Infof("Starting HTLC Switch")
|
||||||
|
|
||||||
blockEpochStream, err := s.cfg.Notifier.RegisterBlockEpochNtfn()
|
blockEpochStream, err := s.cfg.Notifier.RegisterBlockEpochNtfn(nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
3
mock.go
3
mock.go
@ -92,7 +92,8 @@ func (m *mockNotfier) RegisterConfirmationsNtfn(txid *chainhash.Hash,
|
|||||||
Confirmed: m.confChannel,
|
Confirmed: m.confChannel,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
func (m *mockNotfier) RegisterBlockEpochNtfn() (*chainntnfs.BlockEpochEvent, error) {
|
func (m *mockNotfier) RegisterBlockEpochNtfn(
|
||||||
|
bestBlock *chainntnfs.BlockEpoch) (*chainntnfs.BlockEpochEvent, error) {
|
||||||
return &chainntnfs.BlockEpochEvent{
|
return &chainntnfs.BlockEpochEvent{
|
||||||
Epochs: make(chan *chainntnfs.BlockEpoch),
|
Epochs: make(chan *chainntnfs.BlockEpoch),
|
||||||
Cancel: func() {},
|
Cancel: func() {},
|
||||||
|
@ -257,7 +257,7 @@ func (u *utxoNursery) Start() error {
|
|||||||
// connected block. We register immediately on startup to ensure that
|
// connected block. We register immediately on startup to ensure that
|
||||||
// no blocks are missed while we are handling blocks that were missed
|
// no blocks are missed while we are handling blocks that were missed
|
||||||
// during the time the UTXO nursery was unavailable.
|
// during the time the UTXO nursery was unavailable.
|
||||||
newBlockChan, err := u.cfg.Notifier.RegisterBlockEpochNtfn()
|
newBlockChan, err := u.cfg.Notifier.RegisterBlockEpochNtfn(nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user