fundingmanager_test: remove ArbiterChan

This commit is contained in:
Johan T. Halseth 2018-04-19 11:01:56 +02:00
parent cdf60b5f9d
commit 7c945b42fe
No known key found for this signature in database
GPG Key ID: 15BAADA29DA20D26

@ -136,7 +136,6 @@ type testNode struct {
privKey *btcec.PrivateKey privKey *btcec.PrivateKey
msgChan chan lnwire.Message msgChan chan lnwire.Message
announceChan chan lnwire.Message announceChan chan lnwire.Message
arbiterChan chan wire.OutPoint
publTxChan chan *wire.MsgTx publTxChan chan *wire.MsgTx
fundingMgr *fundingManager fundingMgr *fundingManager
peer *peer peer *peer
@ -200,7 +199,6 @@ func createTestFundingManager(t *testing.T, privKey *btcec.PrivateKey,
sentMessages := make(chan lnwire.Message) sentMessages := make(chan lnwire.Message)
sentAnnouncements := make(chan lnwire.Message) sentAnnouncements := make(chan lnwire.Message)
publTxChan := make(chan *wire.MsgTx, 1) publTxChan := make(chan *wire.MsgTx, 1)
arbiterChan := make(chan wire.OutPoint)
shutdownChan := make(chan struct{}) shutdownChan := make(chan struct{})
wc := &mockWalletController{ wc := &mockWalletController{
@ -306,7 +304,6 @@ func createTestFundingManager(t *testing.T, privKey *btcec.PrivateKey,
RequiredRemoteMaxHTLCs: func(chanAmt btcutil.Amount) uint16 { RequiredRemoteMaxHTLCs: func(chanAmt btcutil.Amount) uint16 {
return uint16(lnwallet.MaxHTLCNumber / 2) return uint16(lnwallet.MaxHTLCNumber / 2)
}, },
ArbiterChan: arbiterChan,
WatchNewChannel: func(*channeldb.OpenChannel, *lnwire.NetAddress) error { WatchNewChannel: func(*channeldb.OpenChannel, *lnwire.NetAddress) error {
return nil return nil
}, },
@ -328,7 +325,6 @@ func createTestFundingManager(t *testing.T, privKey *btcec.PrivateKey,
privKey: privKey, privKey: privKey,
msgChan: sentMessages, msgChan: sentMessages,
announceChan: sentAnnouncements, announceChan: sentAnnouncements,
arbiterChan: arbiterChan,
publTxChan: publTxChan, publTxChan: publTxChan,
fundingMgr: f, fundingMgr: f,
peer: p, peer: p,
@ -386,7 +382,6 @@ func recreateAliceFundingManager(t *testing.T, alice *testNode) {
}, },
FindPeer: oldCfg.FindPeer, FindPeer: oldCfg.FindPeer,
TempChanIDSeed: oldCfg.TempChanIDSeed, TempChanIDSeed: oldCfg.TempChanIDSeed,
ArbiterChan: alice.arbiterChan,
FindChannel: oldCfg.FindChannel, FindChannel: oldCfg.FindChannel,
PublishTransaction: func(txn *wire.MsgTx) error { PublishTransaction: func(txn *wire.MsgTx) error {
publishChan <- txn publishChan <- txn
@ -857,20 +852,7 @@ func assertErrChannelNotFound(t *testing.T, node *testNode,
} }
func assertHandleFundingLocked(t *testing.T, alice, bob *testNode) { func assertHandleFundingLocked(t *testing.T, alice, bob *testNode) {
// They should both send the new channel to the breach arbiter. // They should both send the new channel state to their peer.
select {
case <-alice.arbiterChan:
case <-time.After(time.Second * 15):
t.Fatalf("alice did not send channel to breach arbiter")
}
select {
case <-bob.arbiterChan:
case <-time.After(time.Second * 15):
t.Fatalf("bob did not send channel to breach arbiter")
}
// And send the new channel state to their peer.
select { select {
case c := <-alice.peer.newChannels: case c := <-alice.peer.newChannels:
close(c.done) close(c.done)
@ -1587,12 +1569,6 @@ func TestFundingManagerReceiveFundingLockedTwice(t *testing.T) {
// Alice should not send the channel state the second time, as the // Alice should not send the channel state the second time, as the
// second funding locked should just be ignored. // second funding locked should just be ignored.
select { select {
case <-alice.arbiterChan:
t.Fatalf("alice sent channel to breach arbiter a second time")
case <-time.After(time.Millisecond * 300):
// Expected
}
select {
case <-alice.peer.newChannels: case <-alice.peer.newChannels:
t.Fatalf("alice sent new channel to peer a second time") t.Fatalf("alice sent new channel to peer a second time")
case <-time.After(time.Millisecond * 300): case <-time.After(time.Millisecond * 300):
@ -1603,12 +1579,6 @@ func TestFundingManagerReceiveFundingLockedTwice(t *testing.T) {
// have updated her database at this point. // have updated her database at this point.
alice.fundingMgr.processFundingLocked(fundingLockedBob, bobAddr) alice.fundingMgr.processFundingLocked(fundingLockedBob, bobAddr)
select { select {
case <-alice.arbiterChan:
t.Fatalf("alice sent channel to breach arbiter a second time")
case <-time.After(time.Millisecond * 300):
// Expected
}
select {
case <-alice.peer.newChannels: case <-alice.peer.newChannels:
t.Fatalf("alice sent new channel to peer a second time") t.Fatalf("alice sent new channel to peer a second time")
case <-time.After(time.Millisecond * 300): case <-time.After(time.Millisecond * 300):