htlcswitch: add channel link config

Step №1 in making htlcManager (aka channelLink) testable:
Start use config which will allow as mock/stub external subsystems.
This commit is contained in:
Andrey Samokhvalov authored and Olaoluwa Osuntokun committed 2017-05-31 11:06:08 -07:00
1 parent 0de4ea2712
commit 7f572fc155
3 files changed
+55

No files matched your search

+19
View File
@@ -3,10 +3,25 @@ package htlcswitch
import (
"crypto/sha256"
"github.com/lightningnetwork/lnd/channeldb"
"github.com/lightningnetwork/lnd/lnwallet"
"github.com/lightningnetwork/lnd/lnwire"
"github.com/roasbeef/btcd/chaincfg/chainhash"
"github.com/roasbeef/btcutil"
)
// InvoiceDatabase is an interface which represents the persistent subsystem
// which may search, lookup and settle invoices.
type InvoiceDatabase interface {
// LookupInvoice attempts to look up an invoice according to it's 32
// byte payment hash.
LookupInvoice(chainhash.Hash) (*channeldb.Invoice, error)
// SettleInvoice attempts to mark an invoice corresponding to the passed
// payment hash as fully settled.
SettleInvoice(chainhash.Hash) error
}
// ChannelLink is an interface which represents the subsystem for managing
// the incoming htlc requests, applying the changes to the channel, and also
// propagating/forwarding it to htlc switch.
@@ -66,6 +81,10 @@ type Peer interface {
// ID returns the lightning network peer id.
ID() [sha256.Size]byte
// WipeChannel removes the passed channel from all indexes associated
// with the peer.
WipeChannel(*lnwallet.LightningChannel) error
// PubKey returns the peer public key.
PubKey() []byte