funding tests: account for returned err channel
This commit is contained in:
parent
67d36eb79d
commit
6a6d3ff557
@ -286,13 +286,15 @@ func createTestFundingManager(t *testing.T, privKey *btcec.PrivateKey,
|
|||||||
SignMessage: func(pubKey *btcec.PublicKey, msg []byte) (*btcec.Signature, error) {
|
SignMessage: func(pubKey *btcec.PublicKey, msg []byte) (*btcec.Signature, error) {
|
||||||
return testSig, nil
|
return testSig, nil
|
||||||
},
|
},
|
||||||
SendAnnouncement: func(msg lnwire.Message) error {
|
SendAnnouncement: func(msg lnwire.Message) chan error {
|
||||||
|
errChan := make(chan error, 1)
|
||||||
select {
|
select {
|
||||||
case sentAnnouncements <- msg:
|
case sentAnnouncements <- msg:
|
||||||
|
errChan <- nil
|
||||||
case <-shutdownChan:
|
case <-shutdownChan:
|
||||||
return fmt.Errorf("shutting down")
|
errChan <- fmt.Errorf("shutting down")
|
||||||
}
|
}
|
||||||
return nil
|
return errChan
|
||||||
},
|
},
|
||||||
CurrentNodeAnnouncement: func() (lnwire.NodeAnnouncement, error) {
|
CurrentNodeAnnouncement: func() (lnwire.NodeAnnouncement, error) {
|
||||||
return lnwire.NodeAnnouncement{}, nil
|
return lnwire.NodeAnnouncement{}, nil
|
||||||
@ -410,13 +412,15 @@ func recreateAliceFundingManager(t *testing.T, alice *testNode) {
|
|||||||
msg []byte) (*btcec.Signature, error) {
|
msg []byte) (*btcec.Signature, error) {
|
||||||
return testSig, nil
|
return testSig, nil
|
||||||
},
|
},
|
||||||
SendAnnouncement: func(msg lnwire.Message) error {
|
SendAnnouncement: func(msg lnwire.Message) chan error {
|
||||||
|
errChan := make(chan error, 1)
|
||||||
select {
|
select {
|
||||||
case aliceAnnounceChan <- msg:
|
case aliceAnnounceChan <- msg:
|
||||||
|
errChan <- nil
|
||||||
case <-shutdownChan:
|
case <-shutdownChan:
|
||||||
return fmt.Errorf("shutting down")
|
errChan <- fmt.Errorf("shutting down")
|
||||||
}
|
}
|
||||||
return nil
|
return errChan
|
||||||
},
|
},
|
||||||
CurrentNodeAnnouncement: func() (lnwire.NodeAnnouncement, error) {
|
CurrentNodeAnnouncement: func() (lnwire.NodeAnnouncement, error) {
|
||||||
return lnwire.NodeAnnouncement{}, nil
|
return lnwire.NodeAnnouncement{}, nil
|
||||||
@ -1096,8 +1100,12 @@ func TestFundingManagerRestartBehavior(t *testing.T) {
|
|||||||
recreateAliceFundingManager(t, alice)
|
recreateAliceFundingManager(t, alice)
|
||||||
|
|
||||||
// Intentionally make the channel announcements fail
|
// Intentionally make the channel announcements fail
|
||||||
alice.fundingMgr.cfg.SendAnnouncement = func(msg lnwire.Message) error {
|
alice.fundingMgr.cfg.SendAnnouncement =
|
||||||
return fmt.Errorf("intentional error in SendAnnouncement")
|
func(msg lnwire.Message) chan error {
|
||||||
|
errChan := make(chan error, 1)
|
||||||
|
errChan <- fmt.Errorf("intentional error in " +
|
||||||
|
"SendAnnouncement")
|
||||||
|
return errChan
|
||||||
}
|
}
|
||||||
|
|
||||||
fundingLockedAlice := assertFundingMsgSent(
|
fundingLockedAlice := assertFundingMsgSent(
|
||||||
|
Loading…
Reference in New Issue
Block a user