fundingmanager_test: assert initator funding txn rebcast

This commit is contained in:
Conner Fromknecht 2018-03-10 17:09:03 -08:00
parent e754db44d2
commit 3512cfe836
No known key found for this signature in database
GPG Key ID: 39DE78FBE6ACB0EF
1 changed files with 13 additions and 0 deletions

View File

@ -337,6 +337,7 @@ func recreateAliceFundingManager(t *testing.T, alice *testNode) {
aliceMsgChan := make(chan lnwire.Message)
aliceAnnounceChan := make(chan lnwire.Message)
shutdownChan := make(chan struct{})
publishChan := make(chan *wire.MsgTx, 10)
oldCfg := alice.fundingMgr.cfg
@ -376,6 +377,10 @@ func recreateAliceFundingManager(t *testing.T, alice *testNode) {
TempChanIDSeed: oldCfg.TempChanIDSeed,
ArbiterChan: alice.arbiterChan,
FindChannel: oldCfg.FindChannel,
PublishTransaction: func(txn *wire.MsgTx) error {
publishChan <- txn
return nil
},
})
if err != nil {
t.Fatalf("failed recreating aliceFundingManager: %v", err)
@ -384,6 +389,7 @@ func recreateAliceFundingManager(t *testing.T, alice *testNode) {
alice.fundingMgr = f
alice.msgChan = aliceMsgChan
alice.announceChan = aliceAnnounceChan
alice.publTxChan = publishChan
alice.shutdownChannel = shutdownChan
if err = f.Start(); err != nil {
@ -1228,6 +1234,13 @@ func TestFundingManagerFundingNotTimeoutInitiator(t *testing.T) {
recreateAliceFundingManager(t, alice)
// We should receive the rebroadcasted funding txn.
select {
case <-alice.publTxChan:
case <-time.After(time.Second * 5):
t.Fatalf("alice did not publish funding tx")
}
// Increase the height to 1 minus the maxWaitNumBlocksFundingConf height
alice.mockNotifier.epochChan <- &chainntnfs.BlockEpoch{
Height: fundingBroadcastHeight + maxWaitNumBlocksFundingConf - 1,