mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-03-13 11:09:23 +01:00
fundingmanager_test: assert initator funding txn rebcast
This commit is contained in:
parent
e754db44d2
commit
3512cfe836
1 changed files with 13 additions and 0 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Reference in a new issue