From 067db8572c055dfde8fe76ff674ec62c8edc7762 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Tue, 17 Jul 2018 19:23:47 -0700 Subject: [PATCH] test+lnd: update unit test mocks to adhere to new interface API's --- breacharbiter_test.go | 10 +++++----- chainparams.go | 6 +++--- fundingmanager_test.go | 6 +++++- mock.go | 12 ++++++------ test_utils.go | 8 ++++---- 5 files changed, 23 insertions(+), 19 deletions(-) diff --git a/breacharbiter_test.go b/breacharbiter_test.go index 85d10fe9..45dc93f5 100644 --- a/breacharbiter_test.go +++ b/breacharbiter_test.go @@ -18,7 +18,12 @@ import ( "testing" "time" + "github.com/btcsuite/btcd/btcec" + "github.com/btcsuite/btcd/chaincfg/chainhash" + "github.com/btcsuite/btcd/txscript" + "github.com/btcsuite/btcd/wire" "github.com/btcsuite/btclog" + "github.com/btcsuite/btcutil" "github.com/go-errors/errors" "github.com/lightningnetwork/lnd/chainntnfs" "github.com/lightningnetwork/lnd/channeldb" @@ -27,11 +32,6 @@ import ( "github.com/lightningnetwork/lnd/lnwallet" "github.com/lightningnetwork/lnd/lnwire" "github.com/lightningnetwork/lnd/shachain" - "github.com/btcsuite/btcd/btcec" - "github.com/btcsuite/btcd/chaincfg/chainhash" - "github.com/btcsuite/btcd/txscript" - "github.com/btcsuite/btcd/wire" - "github.com/btcsuite/btcutil" ) var ( diff --git a/chainparams.go b/chainparams.go index 2751d81e..812bb6f3 100644 --- a/chainparams.go +++ b/chainparams.go @@ -1,13 +1,13 @@ package main import ( - "github.com/lightningnetwork/lnd/keychain" - litecoinCfg "github.com/ltcsuite/ltcd/chaincfg" - litecoinWire "github.com/ltcsuite/ltcd/wire" "github.com/btcsuite/btcd/chaincfg" bitcoinCfg "github.com/btcsuite/btcd/chaincfg" "github.com/btcsuite/btcd/chaincfg/chainhash" bitcoinWire "github.com/btcsuite/btcd/wire" + "github.com/lightningnetwork/lnd/keychain" + litecoinCfg "github.com/ltcsuite/ltcd/chaincfg" + litecoinWire "github.com/ltcsuite/ltcd/wire" ) // activeNetParams is a pointer to the parameters specific to the currently diff --git a/fundingmanager_test.go b/fundingmanager_test.go index fabcf780..a019f272 100644 --- a/fundingmanager_test.go +++ b/fundingmanager_test.go @@ -29,6 +29,10 @@ import ( "github.com/lightningnetwork/lnd/lnrpc" "github.com/lightningnetwork/lnd/lnwallet" "github.com/lightningnetwork/lnd/lnwire" + + "github.com/btcsuite/btcd/btcec" + "github.com/btcsuite/btcd/wire" + "github.com/btcsuite/btcutil" ) const ( @@ -126,7 +130,7 @@ func (m *mockNotifier) Stop() error { return nil } -func (m *mockNotifier) RegisterSpendNtfn(outpoint *wire.OutPoint, +func (m *mockNotifier) RegisterSpendNtfn(outpoint *wire.OutPoint, _ []byte, heightHint uint32) (*chainntnfs.SpendEvent, error) { return &chainntnfs.SpendEvent{ Spend: make(chan *chainntnfs.SpendDetail), diff --git a/mock.go b/mock.go index 28794bc4..cd0461e8 100644 --- a/mock.go +++ b/mock.go @@ -5,15 +5,15 @@ import ( "fmt" "sync" - "github.com/lightningnetwork/lnd/chainntnfs" - "github.com/lightningnetwork/lnd/keychain" - "github.com/lightningnetwork/lnd/lnwallet" "github.com/btcsuite/btcd/btcec" "github.com/btcsuite/btcd/chaincfg" "github.com/btcsuite/btcd/chaincfg/chainhash" "github.com/btcsuite/btcd/txscript" "github.com/btcsuite/btcd/wire" "github.com/btcsuite/btcutil" + "github.com/lightningnetwork/lnd/chainntnfs" + "github.com/lightningnetwork/lnd/keychain" + "github.com/lightningnetwork/lnd/lnwallet" ) // The block height returned by the mock BlockChainIO's GetBestBlock. @@ -105,7 +105,7 @@ func (m *mockNotfier) Start() error { func (m *mockNotfier) Stop() error { return nil } -func (m *mockNotfier) RegisterSpendNtfn(outpoint *wire.OutPoint, +func (m *mockNotfier) RegisterSpendNtfn(outpoint *wire.OutPoint, _ []byte, heightHint uint32) (*chainntnfs.SpendEvent, error) { return &chainntnfs.SpendEvent{ Spend: make(chan *chainntnfs.SpendDetail), @@ -131,7 +131,7 @@ func makeMockSpendNotifier() *mockSpendNotifier { } func (m *mockSpendNotifier) RegisterSpendNtfn(outpoint *wire.OutPoint, - heightHint uint32) (*chainntnfs.SpendEvent, error) { + _ []byte, heightHint uint32) (*chainntnfs.SpendEvent, error) { m.mtx.Lock() defer m.mtx.Unlock() @@ -172,7 +172,7 @@ func (*mockChainIO) GetBestBlock() (*chainhash.Hash, int32, error) { return activeNetParams.GenesisHash, fundingBroadcastHeight, nil } -func (*mockChainIO) GetUtxo(op *wire.OutPoint, +func (*mockChainIO) GetUtxo(op *wire.OutPoint, _ []byte, heightHint uint32) (*wire.TxOut, error) { return nil, nil } diff --git a/test_utils.go b/test_utils.go index c44b4b43..0de7f0f8 100644 --- a/test_utils.go +++ b/test_utils.go @@ -10,6 +10,10 @@ import ( "net" "os" + "github.com/btcsuite/btcd/btcec" + "github.com/btcsuite/btcd/chaincfg/chainhash" + "github.com/btcsuite/btcd/wire" + "github.com/btcsuite/btcutil" "github.com/lightningnetwork/lnd/chainntnfs" "github.com/lightningnetwork/lnd/channeldb" "github.com/lightningnetwork/lnd/contractcourt" @@ -18,10 +22,6 @@ import ( "github.com/lightningnetwork/lnd/lnwallet" "github.com/lightningnetwork/lnd/lnwire" "github.com/lightningnetwork/lnd/shachain" - "github.com/btcsuite/btcd/btcec" - "github.com/btcsuite/btcd/chaincfg/chainhash" - "github.com/btcsuite/btcd/wire" - "github.com/btcsuite/btcutil" ) var (