lnwallet: add new PreimageCache interface

This commit is contained in:
Olaoluwa Osuntokun 2018-01-16 18:04:07 -08:00
parent a9d451e46d
commit b1503adfad
No known key found for this signature in database
GPG Key ID: 964EA263DD637C21

@ -278,13 +278,27 @@ type MessageSigner interface {
SignMessage(pubKey *btcec.PublicKey, msg []byte) (*btcec.Signature, error)
}
// PreimageCache is an interface that represents a global cache for preimages.
// We'll utilize this cache to communicate the discovery of new preimages
// across sub-systems.
type PreimageCache interface {
// LookupPreimage attempts to look up a preimage according to its hash.
// If found, the preimage is returned along with true for the second
// argument. Otherwise, it'll return false.
LookupPreimage(hash []byte) ([]byte, bool)
// AddPreimage attempts to add a new preimage to the global cache. If
// successful a nil error will be returned.
AddPreimage(preimage []byte) error
}
// WalletDriver represents a "driver" for a particular concrete
// WalletController implementation. A driver is identified by a globally unique
// string identifier along with a 'New()' method which is responsible for
// initializing a particular WalletController concrete implementation.
type WalletDriver struct {
// WalletType is a string which uniquely identifies the WalletController
// that this driver, drives.
// WalletType is a string which uniquely identifies the
// WalletController that this driver, drives.
WalletType string
// New creates a new instance of a concrete WalletController