mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-18 19:41:21 +02:00
multi: move mockChainIO, mockNotifier to lntest/mock
This commit is contained in:
@@ -8,8 +8,10 @@ import (
|
||||
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/lightningnetwork/lnd/chainntnfs"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
"github.com/lightningnetwork/lnd/clock"
|
||||
"github.com/lightningnetwork/lnd/lntest/mock"
|
||||
"github.com/lightningnetwork/lnd/lnwallet"
|
||||
)
|
||||
|
||||
@@ -80,8 +82,12 @@ func TestChainArbitratorRepublishCloses(t *testing.T) {
|
||||
published := make(map[chainhash.Hash]int)
|
||||
|
||||
chainArbCfg := ChainArbitratorConfig{
|
||||
ChainIO: &mockChainIO{},
|
||||
Notifier: &mockNotifier{},
|
||||
ChainIO: &mock.ChainIO{},
|
||||
Notifier: &mock.ChainNotifier{
|
||||
SpendChan: make(chan *chainntnfs.SpendDetail),
|
||||
EpochChan: make(chan *chainntnfs.BlockEpoch),
|
||||
ConfChan: make(chan *chainntnfs.TxConfirmation),
|
||||
},
|
||||
PublishTx: func(tx *wire.MsgTx, _ string) error {
|
||||
published[tx.TxHash()]++
|
||||
return nil
|
||||
@@ -172,8 +178,12 @@ func TestResolveContract(t *testing.T) {
|
||||
// chain arbitrator that should pick up these new channels and launch
|
||||
// resolver for them.
|
||||
chainArbCfg := ChainArbitratorConfig{
|
||||
ChainIO: &mockChainIO{},
|
||||
Notifier: &mockNotifier{},
|
||||
ChainIO: &mock.ChainIO{},
|
||||
Notifier: &mock.ChainNotifier{
|
||||
SpendChan: make(chan *chainntnfs.SpendDetail),
|
||||
EpochChan: make(chan *chainntnfs.BlockEpoch),
|
||||
ConfChan: make(chan *chainntnfs.TxConfirmation),
|
||||
},
|
||||
PublishTx: func(tx *wire.MsgTx, _ string) error {
|
||||
return nil
|
||||
},
|
||||
|
@@ -7,58 +7,15 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/lightningnetwork/lnd/chainntnfs"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
"github.com/lightningnetwork/lnd/input"
|
||||
"github.com/lightningnetwork/lnd/lntest/mock"
|
||||
"github.com/lightningnetwork/lnd/lnwallet"
|
||||
"github.com/lightningnetwork/lnd/lnwire"
|
||||
)
|
||||
|
||||
type mockNotifier struct {
|
||||
spendChan chan *chainntnfs.SpendDetail
|
||||
epochChan chan *chainntnfs.BlockEpoch
|
||||
confChan chan *chainntnfs.TxConfirmation
|
||||
}
|
||||
|
||||
func (m *mockNotifier) RegisterConfirmationsNtfn(txid *chainhash.Hash, _ []byte, numConfs,
|
||||
heightHint uint32) (*chainntnfs.ConfirmationEvent, error) {
|
||||
return &chainntnfs.ConfirmationEvent{
|
||||
Confirmed: m.confChan,
|
||||
Cancel: func() {},
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (m *mockNotifier) RegisterBlockEpochNtfn(
|
||||
bestBlock *chainntnfs.BlockEpoch) (*chainntnfs.BlockEpochEvent, error) {
|
||||
|
||||
return &chainntnfs.BlockEpochEvent{
|
||||
Epochs: m.epochChan,
|
||||
Cancel: func() {},
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (m *mockNotifier) Start() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *mockNotifier) Started() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func (m *mockNotifier) Stop() error {
|
||||
return nil
|
||||
}
|
||||
func (m *mockNotifier) RegisterSpendNtfn(outpoint *wire.OutPoint, _ []byte,
|
||||
heightHint uint32) (*chainntnfs.SpendEvent, error) {
|
||||
|
||||
return &chainntnfs.SpendEvent{
|
||||
Spend: m.spendChan,
|
||||
Cancel: func() {},
|
||||
}, nil
|
||||
}
|
||||
|
||||
// TestChainWatcherRemoteUnilateralClose tests that the chain watcher is able
|
||||
// to properly detect a normal unilateral close by the remote node using their
|
||||
// lowest commitment.
|
||||
@@ -77,8 +34,10 @@ func TestChainWatcherRemoteUnilateralClose(t *testing.T) {
|
||||
|
||||
// With the channels created, we'll now create a chain watcher instance
|
||||
// which will be watching for any closes of Alice's channel.
|
||||
aliceNotifier := &mockNotifier{
|
||||
spendChan: make(chan *chainntnfs.SpendDetail),
|
||||
aliceNotifier := &mock.ChainNotifier{
|
||||
SpendChan: make(chan *chainntnfs.SpendDetail),
|
||||
EpochChan: make(chan *chainntnfs.BlockEpoch),
|
||||
ConfChan: make(chan *chainntnfs.TxConfirmation),
|
||||
}
|
||||
aliceChainWatcher, err := newChainWatcher(chainWatcherConfig{
|
||||
chanState: aliceChannel.State(),
|
||||
@@ -107,7 +66,7 @@ func TestChainWatcherRemoteUnilateralClose(t *testing.T) {
|
||||
SpenderTxHash: &bobTxHash,
|
||||
SpendingTx: bobCommit,
|
||||
}
|
||||
aliceNotifier.spendChan <- bobSpend
|
||||
aliceNotifier.SpendChan <- bobSpend
|
||||
|
||||
// We should get a new spend event over the remote unilateral close
|
||||
// event channel.
|
||||
@@ -166,8 +125,10 @@ func TestChainWatcherRemoteUnilateralClosePendingCommit(t *testing.T) {
|
||||
|
||||
// With the channels created, we'll now create a chain watcher instance
|
||||
// which will be watching for any closes of Alice's channel.
|
||||
aliceNotifier := &mockNotifier{
|
||||
spendChan: make(chan *chainntnfs.SpendDetail),
|
||||
aliceNotifier := &mock.ChainNotifier{
|
||||
SpendChan: make(chan *chainntnfs.SpendDetail),
|
||||
EpochChan: make(chan *chainntnfs.BlockEpoch),
|
||||
ConfChan: make(chan *chainntnfs.TxConfirmation),
|
||||
}
|
||||
aliceChainWatcher, err := newChainWatcher(chainWatcherConfig{
|
||||
chanState: aliceChannel.State(),
|
||||
@@ -216,7 +177,7 @@ func TestChainWatcherRemoteUnilateralClosePendingCommit(t *testing.T) {
|
||||
SpenderTxHash: &bobTxHash,
|
||||
SpendingTx: bobCommit,
|
||||
}
|
||||
aliceNotifier.spendChan <- bobSpend
|
||||
aliceNotifier.SpendChan <- bobSpend
|
||||
|
||||
// We should get a new spend event over the remote unilateral close
|
||||
// event channel.
|
||||
@@ -292,8 +253,10 @@ func TestChainWatcherDataLossProtect(t *testing.T) {
|
||||
// With the channels created, we'll now create a chain watcher
|
||||
// instance which will be watching for any closes of Alice's
|
||||
// channel.
|
||||
aliceNotifier := &mockNotifier{
|
||||
spendChan: make(chan *chainntnfs.SpendDetail),
|
||||
aliceNotifier := &mock.ChainNotifier{
|
||||
SpendChan: make(chan *chainntnfs.SpendDetail),
|
||||
EpochChan: make(chan *chainntnfs.BlockEpoch),
|
||||
ConfChan: make(chan *chainntnfs.TxConfirmation),
|
||||
}
|
||||
aliceChainWatcher, err := newChainWatcher(chainWatcherConfig{
|
||||
chanState: aliceChannel.State(),
|
||||
@@ -350,7 +313,7 @@ func TestChainWatcherDataLossProtect(t *testing.T) {
|
||||
SpenderTxHash: &bobTxHash,
|
||||
SpendingTx: bobCommit,
|
||||
}
|
||||
aliceNotifier.spendChan <- bobSpend
|
||||
aliceNotifier.SpendChan <- bobSpend
|
||||
|
||||
// We should get a new uni close resolution that indicates we
|
||||
// processed the DLP scenario.
|
||||
@@ -461,8 +424,10 @@ func TestChainWatcherLocalForceCloseDetect(t *testing.T) {
|
||||
// With the channels created, we'll now create a chain watcher
|
||||
// instance which will be watching for any closes of Alice's
|
||||
// channel.
|
||||
aliceNotifier := &mockNotifier{
|
||||
spendChan: make(chan *chainntnfs.SpendDetail),
|
||||
aliceNotifier := &mock.ChainNotifier{
|
||||
SpendChan: make(chan *chainntnfs.SpendDetail),
|
||||
EpochChan: make(chan *chainntnfs.BlockEpoch),
|
||||
ConfChan: make(chan *chainntnfs.TxConfirmation),
|
||||
}
|
||||
aliceChainWatcher, err := newChainWatcher(chainWatcherConfig{
|
||||
chanState: aliceChannel.State(),
|
||||
@@ -517,7 +482,7 @@ func TestChainWatcherLocalForceCloseDetect(t *testing.T) {
|
||||
SpenderTxHash: &aliceTxHash,
|
||||
SpendingTx: aliceCommit,
|
||||
}
|
||||
aliceNotifier.spendChan <- aliceSpend
|
||||
aliceNotifier.SpendChan <- aliceSpend
|
||||
|
||||
// We should get a local force close event from Alice as she
|
||||
// should be able to detect the close based on the commitment
|
||||
|
@@ -19,6 +19,7 @@ import (
|
||||
"github.com/lightningnetwork/lnd/channeldb/kvdb"
|
||||
"github.com/lightningnetwork/lnd/clock"
|
||||
"github.com/lightningnetwork/lnd/input"
|
||||
"github.com/lightningnetwork/lnd/lntest/mock"
|
||||
"github.com/lightningnetwork/lnd/lnwallet"
|
||||
"github.com/lightningnetwork/lnd/lnwire"
|
||||
)
|
||||
@@ -334,10 +335,10 @@ func createTestChannelArbitrator(t *testing.T, log ArbitratorLog,
|
||||
},
|
||||
OutgoingBroadcastDelta: 5,
|
||||
IncomingBroadcastDelta: 5,
|
||||
Notifier: &mockNotifier{
|
||||
epochChan: make(chan *chainntnfs.BlockEpoch),
|
||||
spendChan: make(chan *chainntnfs.SpendDetail),
|
||||
confChan: make(chan *chainntnfs.TxConfirmation),
|
||||
Notifier: &mock.ChainNotifier{
|
||||
EpochChan: make(chan *chainntnfs.BlockEpoch),
|
||||
SpendChan: make(chan *chainntnfs.SpendDetail),
|
||||
ConfChan: make(chan *chainntnfs.TxConfirmation),
|
||||
},
|
||||
IncubateOutputs: func(wire.OutPoint,
|
||||
*lnwallet.OutgoingHtlcResolution,
|
||||
@@ -878,7 +879,7 @@ func TestChannelArbitratorLocalForceClosePendingHtlc(t *testing.T) {
|
||||
// We'll grab the old notifier here as our resolvers are still holding
|
||||
// a reference to this instance, and a new one will be created when we
|
||||
// restart the channel arb below.
|
||||
oldNotifier := chanArb.cfg.Notifier.(*mockNotifier)
|
||||
oldNotifier := chanArb.cfg.Notifier.(*mock.ChainNotifier)
|
||||
|
||||
// At this point, in order to simulate a restart, we'll re-create the
|
||||
// channel arbitrator. We do this to ensure that all information
|
||||
@@ -927,7 +928,7 @@ func TestChannelArbitratorLocalForceClosePendingHtlc(t *testing.T) {
|
||||
}
|
||||
|
||||
// Send a notification that the expiry height has been reached.
|
||||
oldNotifier.epochChan <- &chainntnfs.BlockEpoch{Height: 10}
|
||||
oldNotifier.EpochChan <- &chainntnfs.BlockEpoch{Height: 10}
|
||||
|
||||
// htlcOutgoingContestResolver is now transforming into a
|
||||
// htlcTimeoutResolver and should send the contract off for incubation.
|
||||
@@ -939,7 +940,7 @@ func TestChannelArbitratorLocalForceClosePendingHtlc(t *testing.T) {
|
||||
|
||||
// Notify resolver that the HTLC output of the commitment has been
|
||||
// spent.
|
||||
oldNotifier.spendChan <- &chainntnfs.SpendDetail{SpendingTx: closeTx}
|
||||
oldNotifier.SpendChan <- &chainntnfs.SpendDetail{SpendingTx: closeTx}
|
||||
|
||||
// Finally, we should also receive a resolution message instructing the
|
||||
// switch to cancel back the HTLC.
|
||||
@@ -967,7 +968,7 @@ func TestChannelArbitratorLocalForceClosePendingHtlc(t *testing.T) {
|
||||
}
|
||||
|
||||
// Notify resolver that the second level transaction is spent.
|
||||
oldNotifier.spendChan <- &chainntnfs.SpendDetail{SpendingTx: closeTx}
|
||||
oldNotifier.SpendChan <- &chainntnfs.SpendDetail{SpendingTx: closeTx}
|
||||
|
||||
// At this point channel should be marked as resolved.
|
||||
chanArbCtxNew.AssertStateTransitions(StateFullyResolved)
|
||||
|
@@ -10,6 +10,7 @@ import (
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
"github.com/lightningnetwork/lnd/channeldb/kvdb"
|
||||
"github.com/lightningnetwork/lnd/input"
|
||||
"github.com/lightningnetwork/lnd/lntest/mock"
|
||||
"github.com/lightningnetwork/lnd/lnwallet"
|
||||
"github.com/lightningnetwork/lnd/lnwallet/chainfee"
|
||||
"github.com/lightningnetwork/lnd/sweep"
|
||||
@@ -17,7 +18,7 @@ import (
|
||||
|
||||
type commitSweepResolverTestContext struct {
|
||||
resolver *commitSweepResolver
|
||||
notifier *mockNotifier
|
||||
notifier *mock.ChainNotifier
|
||||
sweeper *mockSweeper
|
||||
resolverResultChan chan resolveResult
|
||||
t *testing.T
|
||||
@@ -26,10 +27,10 @@ type commitSweepResolverTestContext struct {
|
||||
func newCommitSweepResolverTestContext(t *testing.T,
|
||||
resolution *lnwallet.CommitOutputResolution) *commitSweepResolverTestContext {
|
||||
|
||||
notifier := &mockNotifier{
|
||||
epochChan: make(chan *chainntnfs.BlockEpoch),
|
||||
spendChan: make(chan *chainntnfs.SpendDetail),
|
||||
confChan: make(chan *chainntnfs.TxConfirmation),
|
||||
notifier := &mock.ChainNotifier{
|
||||
EpochChan: make(chan *chainntnfs.BlockEpoch),
|
||||
SpendChan: make(chan *chainntnfs.SpendDetail),
|
||||
ConfChan: make(chan *chainntnfs.TxConfirmation),
|
||||
}
|
||||
|
||||
sweeper := newMockSweeper()
|
||||
@@ -83,7 +84,7 @@ func (i *commitSweepResolverTestContext) resolve() {
|
||||
}
|
||||
|
||||
func (i *commitSweepResolverTestContext) notifyEpoch(height int32) {
|
||||
i.notifier.epochChan <- &chainntnfs.BlockEpoch{
|
||||
i.notifier.EpochChan <- &chainntnfs.BlockEpoch{
|
||||
Height: height,
|
||||
}
|
||||
}
|
||||
@@ -189,7 +190,7 @@ func TestCommitSweepResolverNoDelay(t *testing.T) {
|
||||
|
||||
spendTx := &wire.MsgTx{}
|
||||
spendHash := spendTx.TxHash()
|
||||
ctx.notifier.confChan <- &chainntnfs.TxConfirmation{
|
||||
ctx.notifier.ConfChan <- &chainntnfs.TxConfirmation{
|
||||
Tx: spendTx,
|
||||
}
|
||||
|
||||
@@ -267,7 +268,7 @@ func testCommitSweepResolverDelay(t *testing.T, sweepErr error) {
|
||||
|
||||
ctx.resolve()
|
||||
|
||||
ctx.notifier.confChan <- &chainntnfs.TxConfirmation{
|
||||
ctx.notifier.ConfChan <- &chainntnfs.TxConfirmation{
|
||||
BlockHeight: testInitialBlockHeight - 1,
|
||||
}
|
||||
|
||||
|
@@ -12,6 +12,7 @@ import (
|
||||
"github.com/lightningnetwork/lnd/channeldb/kvdb"
|
||||
"github.com/lightningnetwork/lnd/htlcswitch/hop"
|
||||
"github.com/lightningnetwork/lnd/invoices"
|
||||
"github.com/lightningnetwork/lnd/lntest/mock"
|
||||
"github.com/lightningnetwork/lnd/lntypes"
|
||||
"github.com/lightningnetwork/lnd/lnwallet"
|
||||
"github.com/lightningnetwork/lnd/lnwire"
|
||||
@@ -295,7 +296,7 @@ type incomingResolverTestContext struct {
|
||||
registry *mockRegistry
|
||||
witnessBeacon *mockWitnessBeacon
|
||||
resolver *htlcIncomingContestResolver
|
||||
notifier *mockNotifier
|
||||
notifier *mock.ChainNotifier
|
||||
onionProcessor *mockOnionProcessor
|
||||
resolveErr chan error
|
||||
nextResolver ContractResolver
|
||||
@@ -303,10 +304,10 @@ type incomingResolverTestContext struct {
|
||||
}
|
||||
|
||||
func newIncomingResolverTestContext(t *testing.T, isExit bool) *incomingResolverTestContext {
|
||||
notifier := &mockNotifier{
|
||||
epochChan: make(chan *chainntnfs.BlockEpoch),
|
||||
spendChan: make(chan *chainntnfs.SpendDetail),
|
||||
confChan: make(chan *chainntnfs.TxConfirmation),
|
||||
notifier := &mock.ChainNotifier{
|
||||
EpochChan: make(chan *chainntnfs.BlockEpoch),
|
||||
SpendChan: make(chan *chainntnfs.SpendDetail),
|
||||
ConfChan: make(chan *chainntnfs.TxConfirmation),
|
||||
}
|
||||
witnessBeacon := newMockWitnessBeacon()
|
||||
registry := &mockRegistry{
|
||||
@@ -377,7 +378,7 @@ func (i *incomingResolverTestContext) resolve() {
|
||||
}
|
||||
|
||||
func (i *incomingResolverTestContext) notifyEpoch(height int32) {
|
||||
i.notifier.epochChan <- &chainntnfs.BlockEpoch{
|
||||
i.notifier.EpochChan <- &chainntnfs.BlockEpoch{
|
||||
Height: height,
|
||||
}
|
||||
}
|
||||
|
@@ -9,6 +9,7 @@ import (
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
"github.com/lightningnetwork/lnd/channeldb/kvdb"
|
||||
"github.com/lightningnetwork/lnd/input"
|
||||
"github.com/lightningnetwork/lnd/lntest/mock"
|
||||
"github.com/lightningnetwork/lnd/lntypes"
|
||||
"github.com/lightningnetwork/lnd/lnwallet"
|
||||
"github.com/lightningnetwork/lnd/lnwire"
|
||||
@@ -80,7 +81,7 @@ func TestHtlcOutgoingResolverRemoteClaim(t *testing.T) {
|
||||
|
||||
spendHash := spendTx.TxHash()
|
||||
|
||||
ctx.notifier.spendChan <- &chainntnfs.SpendDetail{
|
||||
ctx.notifier.SpendChan <- &chainntnfs.SpendDetail{
|
||||
SpendingTx: spendTx,
|
||||
SpenderTxHash: &spendHash,
|
||||
}
|
||||
@@ -114,7 +115,7 @@ type resolveResult struct {
|
||||
|
||||
type outgoingResolverTestContext struct {
|
||||
resolver *htlcOutgoingContestResolver
|
||||
notifier *mockNotifier
|
||||
notifier *mock.ChainNotifier
|
||||
preimageDB *mockWitnessBeacon
|
||||
resolverResultChan chan resolveResult
|
||||
resolutionChan chan ResolutionMsg
|
||||
@@ -122,10 +123,10 @@ type outgoingResolverTestContext struct {
|
||||
}
|
||||
|
||||
func newOutgoingResolverTestContext(t *testing.T) *outgoingResolverTestContext {
|
||||
notifier := &mockNotifier{
|
||||
epochChan: make(chan *chainntnfs.BlockEpoch),
|
||||
spendChan: make(chan *chainntnfs.SpendDetail),
|
||||
confChan: make(chan *chainntnfs.TxConfirmation),
|
||||
notifier := &mock.ChainNotifier{
|
||||
EpochChan: make(chan *chainntnfs.BlockEpoch),
|
||||
SpendChan: make(chan *chainntnfs.SpendDetail),
|
||||
ConfChan: make(chan *chainntnfs.TxConfirmation),
|
||||
}
|
||||
|
||||
checkPointChan := make(chan struct{}, 1)
|
||||
@@ -212,7 +213,7 @@ func (i *outgoingResolverTestContext) resolve() {
|
||||
}
|
||||
|
||||
func (i *outgoingResolverTestContext) notifyEpoch(height int32) {
|
||||
i.notifier.epochChan <- &chainntnfs.BlockEpoch{
|
||||
i.notifier.EpochChan <- &chainntnfs.BlockEpoch{
|
||||
Height: height,
|
||||
}
|
||||
}
|
||||
|
@@ -8,6 +8,7 @@ import (
|
||||
"github.com/lightningnetwork/lnd/chainntnfs"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
"github.com/lightningnetwork/lnd/channeldb/kvdb"
|
||||
"github.com/lightningnetwork/lnd/lntest/mock"
|
||||
"github.com/lightningnetwork/lnd/lnwallet"
|
||||
"github.com/lightningnetwork/lnd/lnwire"
|
||||
)
|
||||
@@ -16,16 +17,16 @@ var testHtlcAmt = lnwire.MilliSatoshi(200000)
|
||||
|
||||
type htlcSuccessResolverTestContext struct {
|
||||
resolver *htlcSuccessResolver
|
||||
notifier *mockNotifier
|
||||
notifier *mock.ChainNotifier
|
||||
resolverResultChan chan resolveResult
|
||||
t *testing.T
|
||||
}
|
||||
|
||||
func newHtlcSuccessResolverTextContext(t *testing.T) *htlcSuccessResolverTestContext {
|
||||
notifier := &mockNotifier{
|
||||
epochChan: make(chan *chainntnfs.BlockEpoch),
|
||||
spendChan: make(chan *chainntnfs.SpendDetail),
|
||||
confChan: make(chan *chainntnfs.TxConfirmation),
|
||||
notifier := &mock.ChainNotifier{
|
||||
EpochChan: make(chan *chainntnfs.BlockEpoch),
|
||||
SpendChan: make(chan *chainntnfs.SpendDetail),
|
||||
ConfChan: make(chan *chainntnfs.TxConfirmation),
|
||||
}
|
||||
|
||||
checkPointChan := make(chan struct{}, 1)
|
||||
@@ -116,7 +117,7 @@ func TestSingleStageSuccess(t *testing.T) {
|
||||
// We send a confirmation for our sweep tx to indicate that our sweep
|
||||
// succeeded.
|
||||
resolve := func(ctx *htlcSuccessResolverTestContext) {
|
||||
ctx.notifier.confChan <- &chainntnfs.TxConfirmation{
|
||||
ctx.notifier.ConfChan <- &chainntnfs.TxConfirmation{
|
||||
Tx: ctx.resolver.sweepTx,
|
||||
BlockHeight: testInitialBlockHeight - 1,
|
||||
}
|
||||
@@ -165,7 +166,7 @@ func TestSecondStageResolution(t *testing.T) {
|
||||
|
||||
// We send a spend notification for our output to resolve our htlc.
|
||||
resolve := func(ctx *htlcSuccessResolverTestContext) {
|
||||
ctx.notifier.spendChan <- &chainntnfs.SpendDetail{
|
||||
ctx.notifier.SpendChan <- &chainntnfs.SpendDetail{
|
||||
SpendingTx: sweepTx,
|
||||
SpenderTxHash: &sweepHash,
|
||||
}
|
||||
|
@@ -203,10 +203,10 @@ func TestHtlcTimeoutResolver(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
notifier := &mockNotifier{
|
||||
epochChan: make(chan *chainntnfs.BlockEpoch),
|
||||
spendChan: make(chan *chainntnfs.SpendDetail),
|
||||
confChan: make(chan *chainntnfs.TxConfirmation),
|
||||
notifier := &mock.ChainNotifier{
|
||||
EpochChan: make(chan *chainntnfs.BlockEpoch),
|
||||
SpendChan: make(chan *chainntnfs.SpendDetail),
|
||||
ConfChan: make(chan *chainntnfs.TxConfirmation),
|
||||
}
|
||||
witnessBeacon := newMockWitnessBeacon()
|
||||
|
||||
@@ -331,7 +331,7 @@ func TestHtlcTimeoutResolver(t *testing.T) {
|
||||
spendTxHash := spendingTx.TxHash()
|
||||
|
||||
select {
|
||||
case notifier.spendChan <- &chainntnfs.SpendDetail{
|
||||
case notifier.SpendChan <- &chainntnfs.SpendDetail{
|
||||
SpendingTx: spendingTx,
|
||||
SpenderTxHash: &spendTxHash,
|
||||
}:
|
||||
@@ -388,7 +388,7 @@ func TestHtlcTimeoutResolver(t *testing.T) {
|
||||
// only if this is a local commitment transaction.
|
||||
if !testCase.remoteCommit {
|
||||
select {
|
||||
case notifier.spendChan <- &chainntnfs.SpendDetail{
|
||||
case notifier.SpendChan <- &chainntnfs.SpendDetail{
|
||||
SpendingTx: spendingTx,
|
||||
SpenderTxHash: &spendTxHash,
|
||||
}:
|
||||
|
Reference in New Issue
Block a user