lnwallet/btcwallet: add compile time check for BlockChainIO interface
This commit is contained in:
parent
c4415f0400
commit
beb5d14ed9
@ -124,6 +124,8 @@ func (b *mockArbitratorLog) WipeHistory() error {
|
|||||||
|
|
||||||
type mockChainIO struct{}
|
type mockChainIO struct{}
|
||||||
|
|
||||||
|
var _ lnwallet.BlockChainIO = (*mockChainIO)(nil)
|
||||||
|
|
||||||
func (*mockChainIO) GetBestBlock() (*chainhash.Hash, int32, error) {
|
func (*mockChainIO) GetBestBlock() (*chainhash.Hash, int32, error) {
|
||||||
return nil, 0, nil
|
return nil, 0, nil
|
||||||
}
|
}
|
||||||
|
@ -67,8 +67,9 @@ type BtcWallet struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// A compile time check to ensure that BtcWallet implements the
|
// A compile time check to ensure that BtcWallet implements the
|
||||||
// WalletController interface.
|
// WalletController and BlockChainIO interfaces.
|
||||||
var _ lnwallet.WalletController = (*BtcWallet)(nil)
|
var _ lnwallet.WalletController = (*BtcWallet)(nil)
|
||||||
|
var _ lnwallet.BlockChainIO = (*BtcWallet)(nil)
|
||||||
|
|
||||||
// New returns a new fully initialized instance of BtcWallet given a valid
|
// New returns a new fully initialized instance of BtcWallet given a valid
|
||||||
// configuration struct.
|
// configuration struct.
|
||||||
|
2
mock.go
2
mock.go
@ -205,6 +205,8 @@ type mockChainIO struct {
|
|||||||
bestHeight int32
|
bestHeight int32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var _ lnwallet.BlockChainIO = (*mockChainIO)(nil)
|
||||||
|
|
||||||
func (m *mockChainIO) GetBestBlock() (*chainhash.Hash, int32, error) {
|
func (m *mockChainIO) GetBestBlock() (*chainhash.Hash, int32, error) {
|
||||||
return activeNetParams.GenesisHash, m.bestHeight, nil
|
return activeNetParams.GenesisHash, m.bestHeight, nil
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ import (
|
|||||||
"github.com/btcsuite/btcd/wire"
|
"github.com/btcsuite/btcd/wire"
|
||||||
"github.com/lightningnetwork/lnd/chainntnfs"
|
"github.com/lightningnetwork/lnd/chainntnfs"
|
||||||
"github.com/lightningnetwork/lnd/input"
|
"github.com/lightningnetwork/lnd/input"
|
||||||
|
"github.com/lightningnetwork/lnd/lnwallet"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -237,6 +238,8 @@ func (m *MockNotifier) RegisterSpendNtfn(outpoint *wire.OutPoint,
|
|||||||
|
|
||||||
type mockChainIO struct{}
|
type mockChainIO struct{}
|
||||||
|
|
||||||
|
var _ lnwallet.BlockChainIO = (*mockChainIO)(nil)
|
||||||
|
|
||||||
func (m *mockChainIO) GetBestBlock() (*chainhash.Hash, int32, error) {
|
func (m *mockChainIO) GetBestBlock() (*chainhash.Hash, int32, error) {
|
||||||
return nil, mockChainIOHeight, nil
|
return nil, mockChainIOHeight, nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user