lnwallet: add new PreimageCache interface
This commit is contained in:
parent
a9d451e46d
commit
b1503adfad
@ -278,13 +278,27 @@ type MessageSigner interface {
|
|||||||
SignMessage(pubKey *btcec.PublicKey, msg []byte) (*btcec.Signature, error)
|
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
|
// WalletDriver represents a "driver" for a particular concrete
|
||||||
// WalletController implementation. A driver is identified by a globally unique
|
// WalletController implementation. A driver is identified by a globally unique
|
||||||
// string identifier along with a 'New()' method which is responsible for
|
// string identifier along with a 'New()' method which is responsible for
|
||||||
// initializing a particular WalletController concrete implementation.
|
// initializing a particular WalletController concrete implementation.
|
||||||
type WalletDriver struct {
|
type WalletDriver struct {
|
||||||
// WalletType is a string which uniquely identifies the WalletController
|
// WalletType is a string which uniquely identifies the
|
||||||
// that this driver, drives.
|
// WalletController that this driver, drives.
|
||||||
WalletType string
|
WalletType string
|
||||||
|
|
||||||
// New creates a new instance of a concrete WalletController
|
// New creates a new instance of a concrete WalletController
|
||||||
|
Loading…
Reference in New Issue
Block a user