diff --git a/lnwallet/interface.go b/lnwallet/interface.go index 88b261e05..c80d44797 100644 --- a/lnwallet/interface.go +++ b/lnwallet/interface.go @@ -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