multi: move mockChainIO, mockNotifier to lntest/mock

This commit is contained in:
eugene
2020-08-27 15:34:55 -04:00
parent 3fa5d042c9
commit c7cbacc35b
18 changed files with 241 additions and 308 deletions

View File

@ -12,6 +12,7 @@ import (
"github.com/lightningnetwork/lnd/chainntnfs"
"github.com/lightningnetwork/lnd/channeldb"
"github.com/lightningnetwork/lnd/htlcswitch"
"github.com/lightningnetwork/lnd/lntest/mock"
"github.com/lightningnetwork/lnd/lnwallet/chancloser"
"github.com/lightningnetwork/lnd/lnwire"
)
@ -33,8 +34,10 @@ var (
func TestPeerChannelClosureAcceptFeeResponder(t *testing.T) {
t.Parallel()
notifier := &mockNotifier{
confChannel: make(chan *chainntnfs.TxConfirmation),
notifier := &mock.ChainNotifier{
SpendChan: make(chan *chainntnfs.SpendDetail),
EpochChan: make(chan *chainntnfs.BlockEpoch),
ConfChan: make(chan *chainntnfs.TxConfirmation),
}
broadcastTxChan := make(chan *wire.MsgTx)
@ -126,7 +129,7 @@ func TestPeerChannelClosureAcceptFeeResponder(t *testing.T) {
}
// Alice should be waiting in a goroutine for a confirmation.
notifier.confChannel <- &chainntnfs.TxConfirmation{}
notifier.ConfChan <- &chainntnfs.TxConfirmation{}
}
// TestPeerChannelClosureAcceptFeeInitiator tests the shutdown initiator's
@ -134,8 +137,10 @@ func TestPeerChannelClosureAcceptFeeResponder(t *testing.T) {
func TestPeerChannelClosureAcceptFeeInitiator(t *testing.T) {
t.Parallel()
notifier := &mockNotifier{
confChannel: make(chan *chainntnfs.TxConfirmation),
notifier := &mock.ChainNotifier{
SpendChan: make(chan *chainntnfs.SpendDetail),
EpochChan: make(chan *chainntnfs.BlockEpoch),
ConfChan: make(chan *chainntnfs.TxConfirmation),
}
broadcastTxChan := make(chan *wire.MsgTx)
@ -245,7 +250,7 @@ func TestPeerChannelClosureAcceptFeeInitiator(t *testing.T) {
}
// Alice should be waiting on a single confirmation for the coop close tx.
notifier.confChannel <- &chainntnfs.TxConfirmation{}
notifier.ConfChan <- &chainntnfs.TxConfirmation{}
}
// TestPeerChannelClosureFeeNegotiationsResponder tests the shutdown
@ -254,8 +259,10 @@ func TestPeerChannelClosureAcceptFeeInitiator(t *testing.T) {
func TestPeerChannelClosureFeeNegotiationsResponder(t *testing.T) {
t.Parallel()
notifier := &mockNotifier{
confChannel: make(chan *chainntnfs.TxConfirmation),
notifier := &mock.ChainNotifier{
SpendChan: make(chan *chainntnfs.SpendDetail),
EpochChan: make(chan *chainntnfs.BlockEpoch),
ConfChan: make(chan *chainntnfs.TxConfirmation),
}
broadcastTxChan := make(chan *wire.MsgTx)
@ -437,7 +444,7 @@ func TestPeerChannelClosureFeeNegotiationsResponder(t *testing.T) {
}
// Alice should be waiting on a single confirmation for the coop close tx.
notifier.confChannel <- &chainntnfs.TxConfirmation{}
notifier.ConfChan <- &chainntnfs.TxConfirmation{}
}
// TestPeerChannelClosureFeeNegotiationsInitiator tests the shutdown
@ -446,8 +453,10 @@ func TestPeerChannelClosureFeeNegotiationsResponder(t *testing.T) {
func TestPeerChannelClosureFeeNegotiationsInitiator(t *testing.T) {
t.Parallel()
notifier := &mockNotifier{
confChannel: make(chan *chainntnfs.TxConfirmation),
notifier := &mock.ChainNotifier{
SpendChan: make(chan *chainntnfs.SpendDetail),
EpochChan: make(chan *chainntnfs.BlockEpoch),
ConfChan: make(chan *chainntnfs.TxConfirmation),
}
broadcastTxChan := make(chan *wire.MsgTx)
@ -642,7 +651,7 @@ func TestPeerChannelClosureFeeNegotiationsInitiator(t *testing.T) {
}
// Alice should be waiting on a single confirmation for the coop close tx.
notifier.confChannel <- &chainntnfs.TxConfirmation{}
notifier.ConfChan <- &chainntnfs.TxConfirmation{}
}
// TestChooseDeliveryScript tests that chooseDeliveryScript correctly errors
@ -779,8 +788,10 @@ func TestCustomShutdownScript(t *testing.T) {
test := test
t.Run(test.name, func(t *testing.T) {
notifier := &mockNotifier{
confChannel: make(chan *chainntnfs.TxConfirmation),
notifier := &mock.ChainNotifier{
SpendChan: make(chan *chainntnfs.SpendDetail),
EpochChan: make(chan *chainntnfs.BlockEpoch),
ConfChan: make(chan *chainntnfs.TxConfirmation),
}
broadcastTxChan := make(chan *wire.MsgTx)