Documentation ¶
Index ¶
- Variables
- type ChainIO
- func (c *ChainIO) GetBestBlock() (*chainhash.Hash, int32, error)
- func (c *ChainIO) GetBlock(blockHash *chainhash.Hash) (*wire.MsgBlock, error)
- func (c *ChainIO) GetBlockHash(blockHeight int64) (*chainhash.Hash, error)
- func (c *ChainIO) GetBlockHeader(blockHash *chainhash.Hash) (*wire.BlockHeader, error)
- func (c *ChainIO) GetUtxo(op *wire.OutPoint, _ []byte, heightHint uint32, _ <-chan struct{}) (*wire.TxOut, error)
- type ChainNotifier
- func (c *ChainNotifier) RegisterBlockEpochNtfn(blockEpoch *chainntnfs.BlockEpoch) (*chainntnfs.BlockEpochEvent, error)
- func (c *ChainNotifier) RegisterConfirmationsNtfn(txid *chainhash.Hash, pkScript []byte, numConfs, heightHint uint32, ...) (*chainntnfs.ConfirmationEvent, error)
- func (c *ChainNotifier) RegisterSpendNtfn(outpoint *wire.OutPoint, pkScript []byte, heightHint uint32) (*chainntnfs.SpendEvent, error)
- func (c *ChainNotifier) Start() error
- func (c *ChainNotifier) Started() bool
- func (c *ChainNotifier) Stop() error
- type DummySignature
- type DummySigner
- func (d *DummySigner) ComputeInputScript(tx *wire.MsgTx, signDesc *input.SignDescriptor) (*input.Script, error)
- func (d *DummySigner) MuSig2Cleanup(input.MuSig2SessionID) error
- func (d *DummySigner) MuSig2CombineSig(input.MuSig2SessionID, []*musig2.PartialSignature) (*schnorr.Signature, bool, error)
- func (d *DummySigner) MuSig2CreateSession(input.MuSig2Version, keychain.KeyLocator, []*btcec.PublicKey, ...) (*input.MuSig2SessionInfo, error)
- func (d *DummySigner) MuSig2RegisterNonces(input.MuSig2SessionID, [][musig2.PubNonceSize]byte) (bool, error)
- func (d *DummySigner) MuSig2Sign(input.MuSig2SessionID, [sha256.Size]byte, bool) (*musig2.PartialSignature, error)
- func (d *DummySigner) SignOutputRaw(tx *wire.MsgTx, signDesc *input.SignDescriptor) (input.Signature, error)
- type SecretKeyRing
- func (s *SecretKeyRing) DeriveKey(_ keychain.KeyLocator) (keychain.KeyDescriptor, error)
- func (s *SecretKeyRing) DeriveNextKey(_ keychain.KeyFamily) (keychain.KeyDescriptor, error)
- func (s *SecretKeyRing) DerivePrivKey(_ keychain.KeyDescriptor) (*btcec.PrivateKey, error)
- func (s *SecretKeyRing) ECDH(_ keychain.KeyDescriptor, _ *btcec.PublicKey) ([32]byte, error)
- func (s *SecretKeyRing) SignMessage(_ keychain.KeyLocator, msg []byte, doubleHash bool) (*ecdsa.Signature, error)
- func (s *SecretKeyRing) SignMessageCompact(_ keychain.KeyLocator, msg []byte, doubleHash bool) ([]byte, error)
- func (s *SecretKeyRing) SignMessageSchnorr(_ keychain.KeyLocator, msg []byte, doubleHash bool, taprootTweak []byte, ...) (*schnorr.Signature, error)
- type SingleSigner
- func (s *SingleSigner) ComputeInputScript(tx *wire.MsgTx, signDesc *input.SignDescriptor) (*input.Script, error)
- func (s *SingleSigner) SignMessage(keyLoc keychain.KeyLocator, msg []byte, doubleHash bool) (*ecdsa.Signature, error)
- func (s *SingleSigner) SignOutputRaw(tx *wire.MsgTx, signDesc *input.SignDescriptor) (input.Signature, error)
- type SpendNotifier
- type WalletController
- func (w *WalletController) AddressInfo(btcutil.Address) (waddrmgr.ManagedAddress, error)
- func (w *WalletController) BackEnd() string
- func (w *WalletController) CheckMempoolAcceptance(tx *wire.MsgTx) error
- func (w *WalletController) ConfirmedBalance(int32, string) (btcutil.Amount, error)
- func (w *WalletController) CreateSimpleTx(fn.Set[wire.OutPoint], []*wire.TxOut, chainfee.SatPerKWeight, int32, ...) (*txauthor.AuthoredTx, error)
- func (w *WalletController) DecorateInputs(*psbt.Packet, bool) error
- func (w *WalletController) FetchInputInfo(prevOut *wire.OutPoint) (*lnwallet.Utxo, error)
- func (w *WalletController) FetchTx(chainhash.Hash) (*wire.MsgTx, error)
- func (w *WalletController) FinalizePsbt(_ *psbt.Packet, _ string) error
- func (w *WalletController) FundPsbt(*psbt.Packet, int32, chainfee.SatPerKWeight, string, *waddrmgr.KeyScope, ...) (int32, error)
- func (w *WalletController) GetRecoveryInfo() (bool, float64, error)
- func (w *WalletController) GetTransactionDetails(txHash *chainhash.Hash) (*lnwallet.TransactionDetail, error)
- func (w *WalletController) ImportAccount(string, *hdkeychain.ExtendedKey, uint32, *waddrmgr.AddressType, bool) (*waddrmgr.AccountProperties, []btcutil.Address, []btcutil.Address, error)
- func (w *WalletController) ImportPublicKey(*btcec.PublicKey, waddrmgr.AddressType) error
- func (w *WalletController) ImportTaprootScript(waddrmgr.KeyScope, *waddrmgr.Tapscript) (waddrmgr.ManagedAddress, error)
- func (w *WalletController) IsOurAddress(btcutil.Address) bool
- func (w *WalletController) IsSynced() (bool, int64, error)
- func (w *WalletController) LabelTransaction(chainhash.Hash, string, bool) error
- func (w *WalletController) LastUnusedAddress(lnwallet.AddressType, string) (btcutil.Address, error)
- func (w *WalletController) LeaseOutput(wtxmgr.LockID, wire.OutPoint, time.Duration) (time.Time, []byte, btcutil.Amount, error)
- func (w *WalletController) ListAccounts(string, *waddrmgr.KeyScope) ([]*waddrmgr.AccountProperties, error)
- func (w *WalletController) ListAddresses(string, bool) (lnwallet.AccountAddressMap, error)
- func (w *WalletController) ListLeasedOutputs() ([]*base.ListLeasedOutputResult, error)
- func (w *WalletController) ListTransactionDetails(int32, int32, string) ([]*lnwallet.TransactionDetail, error)
- func (w *WalletController) ListUnspentWitness(int32, int32, string) ([]*lnwallet.Utxo, error)
- func (w *WalletController) NewAddress(lnwallet.AddressType, bool, string) (btcutil.Address, error)
- func (w *WalletController) PublishTransaction(tx *wire.MsgTx, _ string) error
- func (w *WalletController) ReleaseOutput(wtxmgr.LockID, wire.OutPoint) error
- func (w *WalletController) RemoveDescendants(*wire.MsgTx) error
- func (w *WalletController) RequiredReserve(uint32) btcutil.Amount
- func (w *WalletController) ScriptForOutput(*wire.TxOut) (waddrmgr.ManagedPubKeyAddress, []byte, []byte, error)
- func (w *WalletController) SendOutputs(fn.Set[wire.OutPoint], []*wire.TxOut, chainfee.SatPerKWeight, int32, string, ...) (*wire.MsgTx, error)
- func (w *WalletController) SignPsbt(*psbt.Packet) ([]uint32, error)
- func (w *WalletController) Start() error
- func (w *WalletController) Stop() error
- func (w *WalletController) SubscribeTransactions() (lnwallet.TransactionSubscription, error)
Constants ¶
This section is empty.
Variables ¶
var (
CoinPkScript, _ = hex.DecodeString("001431df1bde03c074d0cf21ea2529427e1499b8f1de")
)
Functions ¶
This section is empty.
Types ¶
type ChainIO ¶
type ChainIO struct {
BestHeight int32
}
ChainIO is a mock implementation of the BlockChainIO interface.
func (*ChainIO) GetBestBlock ¶
GetBestBlock currently returns dummy values.
func (*ChainIO) GetBlockHash ¶
GetBlockHash currently returns dummy values.
func (*ChainIO) GetBlockHeader ¶
GetBlockHeader currently returns dummy values.
type ChainNotifier ¶
type ChainNotifier struct { SpendChan chan *chainntnfs.SpendDetail EpochChan chan *chainntnfs.BlockEpoch ConfChan chan *chainntnfs.TxConfirmation }
ChainNotifier is a mock implementation of the ChainNotifier interface.
func (*ChainNotifier) RegisterBlockEpochNtfn ¶
func (c *ChainNotifier) RegisterBlockEpochNtfn(blockEpoch *chainntnfs.BlockEpoch) ( *chainntnfs.BlockEpochEvent, error)
RegisterBlockEpochNtfn returns a BlockEpochEvent that contains a channel that block epochs will go over.
func (*ChainNotifier) RegisterConfirmationsNtfn ¶
func (c *ChainNotifier) RegisterConfirmationsNtfn(txid *chainhash.Hash, pkScript []byte, numConfs, heightHint uint32, opts ...chainntnfs.NotifierOption) (*chainntnfs.ConfirmationEvent, error)
RegisterConfirmationsNtfn returns a ConfirmationEvent that contains a channel that the tx confirmation will go over.
func (*ChainNotifier) RegisterSpendNtfn ¶
func (c *ChainNotifier) RegisterSpendNtfn(outpoint *wire.OutPoint, pkScript []byte, heightHint uint32) (*chainntnfs.SpendEvent, error)
RegisterSpendNtfn returns a SpendEvent that contains a channel that the spend details will go over.
func (*ChainNotifier) Start ¶
func (c *ChainNotifier) Start() error
Start currently returns a dummy value.
func (*ChainNotifier) Started ¶
func (c *ChainNotifier) Started() bool
Started currently returns a dummy value.
func (*ChainNotifier) Stop ¶
func (c *ChainNotifier) Stop() error
Stop currently returns a dummy value.
type DummySignature ¶
type DummySignature struct{}
DummySignature is a dummy Signature implementation.
func (*DummySignature) Serialize ¶
func (d *DummySignature) Serialize() []byte
Serialize returns an empty byte slice.
func (*DummySignature) Verify ¶
func (d *DummySignature) Verify(_ []byte, _ *btcec.PublicKey) bool
Verify always returns true.
type DummySigner ¶
type DummySigner struct{}
DummySigner is an implementation of the Signer interface that returns dummy values when called.
func (*DummySigner) ComputeInputScript ¶
func (d *DummySigner) ComputeInputScript(tx *wire.MsgTx, signDesc *input.SignDescriptor) (*input.Script, error)
ComputeInputScript returns nil for both values.
func (*DummySigner) MuSig2Cleanup ¶
func (d *DummySigner) MuSig2Cleanup(input.MuSig2SessionID) error
MuSig2Cleanup removes a session from memory to free up resources.
func (*DummySigner) MuSig2CombineSig ¶
func (d *DummySigner) MuSig2CombineSig(input.MuSig2SessionID, []*musig2.PartialSignature) (*schnorr.Signature, bool, error)
MuSig2CombineSig combines the given partial signature(s) with the local one, if it already exists. Once a partial signature of all participants is registered, the final signature will be combined and returned.
func (*DummySigner) MuSig2CreateSession ¶
func (d *DummySigner) MuSig2CreateSession(input.MuSig2Version, keychain.KeyLocator, []*btcec.PublicKey, *input.MuSig2Tweaks, [][musig2.PubNonceSize]byte, *musig2.Nonces, ) (*input.MuSig2SessionInfo, error)
MuSig2CreateSession creates a new MuSig2 signing session using the local key identified by the key locator. The complete list of all public keys of all signing parties must be provided, including the public key of the local signing key. If nonces of other parties are already known, they can be submitted as well to reduce the number of method calls necessary later on.
func (*DummySigner) MuSig2RegisterNonces ¶
func (d *DummySigner) MuSig2RegisterNonces(input.MuSig2SessionID, [][musig2.PubNonceSize]byte) (bool, error)
MuSig2RegisterNonces registers one or more public nonces of other signing participants for a session identified by its ID. This method returns true once we have all nonces for all other signing participants.
func (*DummySigner) MuSig2Sign ¶
func (d *DummySigner) MuSig2Sign(input.MuSig2SessionID, [sha256.Size]byte, bool) (*musig2.PartialSignature, error)
MuSig2Sign creates a partial signature using the local signing key that was specified when the session was created. This can only be called when all public nonces of all participants are known and have been registered with the session. If this node isn't responsible for combining all the partial signatures, then the cleanup parameter should be set, indicating that the session can be removed from memory once the signature was produced.
func (*DummySigner) SignOutputRaw ¶
func (d *DummySigner) SignOutputRaw(tx *wire.MsgTx, signDesc *input.SignDescriptor) (input.Signature, error)
SignOutputRaw returns a dummy signature.
type SecretKeyRing ¶
type SecretKeyRing struct {
RootKey *btcec.PrivateKey
}
SecretKeyRing is a mock implementation of the SecretKeyRing interface.
func (*SecretKeyRing) DeriveKey ¶
func (s *SecretKeyRing) DeriveKey( _ keychain.KeyLocator) (keychain.KeyDescriptor, error)
DeriveKey currently returns dummy values.
func (*SecretKeyRing) DeriveNextKey ¶
func (s *SecretKeyRing) DeriveNextKey( _ keychain.KeyFamily) (keychain.KeyDescriptor, error)
DeriveNextKey currently returns dummy values.
func (*SecretKeyRing) DerivePrivKey ¶
func (s *SecretKeyRing) DerivePrivKey( _ keychain.KeyDescriptor) (*btcec.PrivateKey, error)
DerivePrivKey currently returns dummy values.
func (*SecretKeyRing) ECDH ¶
func (s *SecretKeyRing) ECDH(_ keychain.KeyDescriptor, _ *btcec.PublicKey) ([32]byte, error)
ECDH currently returns dummy values.
func (*SecretKeyRing) SignMessage ¶
func (s *SecretKeyRing) SignMessage(_ keychain.KeyLocator, msg []byte, doubleHash bool) (*ecdsa.Signature, error)
SignMessage signs the passed message and ignores the KeyDescriptor.
func (*SecretKeyRing) SignMessageCompact ¶
func (s *SecretKeyRing) SignMessageCompact(_ keychain.KeyLocator, msg []byte, doubleHash bool) ([]byte, error)
SignMessageCompact signs the passed message.
func (*SecretKeyRing) SignMessageSchnorr ¶
func (s *SecretKeyRing) SignMessageSchnorr(_ keychain.KeyLocator, msg []byte, doubleHash bool, taprootTweak []byte, tag []byte) (*schnorr.Signature, error)
SignMessageSchnorr signs the passed message and ignores the KeyDescriptor.
type SingleSigner ¶
type SingleSigner struct { Privkey *btcec.PrivateKey KeyLoc keychain.KeyLocator *input.MusigSessionManager }
SingleSigner is an implementation of the Signer interface that signs everything with a single private key.
func NewSingleSigner ¶
func NewSingleSigner(privkey *btcec.PrivateKey) *SingleSigner
func (*SingleSigner) ComputeInputScript ¶
func (s *SingleSigner) ComputeInputScript(tx *wire.MsgTx, signDesc *input.SignDescriptor) (*input.Script, error)
ComputeInputScript computes an input script with the stored private key given a transaction and a SignDescriptor.
func (*SingleSigner) SignMessage ¶
func (s *SingleSigner) SignMessage(keyLoc keychain.KeyLocator, msg []byte, doubleHash bool) (*ecdsa.Signature, error)
SignMessage takes a public key and a message and only signs the message with the stored private key if the public key matches the private key.
func (*SingleSigner) SignOutputRaw ¶
func (s *SingleSigner) SignOutputRaw(tx *wire.MsgTx, signDesc *input.SignDescriptor) (input.Signature, error)
SignOutputRaw generates a signature for the passed transaction using the stored private key.
type SpendNotifier ¶
type SpendNotifier struct { *ChainNotifier // contains filtered or unexported fields }
SpendNotifier extends the mock.ChainNotifier so that spend notifications can be triggered and delivered to subscribers.
func MakeMockSpendNotifier ¶
func MakeMockSpendNotifier() *SpendNotifier
MakeMockSpendNotifier creates a SpendNotifier.
func (*SpendNotifier) RegisterSpendNtfn ¶
func (s *SpendNotifier) RegisterSpendNtfn(outpoint *wire.OutPoint, _ []byte, heightHint uint32) (*chainntnfs.SpendEvent, error)
RegisterSpendNtfn registers a spend notification for a specified outpoint.
type WalletController ¶
type WalletController struct { RootKey *btcec.PrivateKey PublishedTransactions chan *wire.MsgTx Utxos []*lnwallet.Utxo // contains filtered or unexported fields }
WalletController is a mock implementation of the WalletController interface. It let's us mock the interaction with the bitcoin network.
func (*WalletController) AddressInfo ¶
func (w *WalletController) AddressInfo( btcutil.Address) (waddrmgr.ManagedAddress, error)
AddressInfo currently returns a dummy value.
func (*WalletController) BackEnd ¶
func (w *WalletController) BackEnd() string
BackEnd returns "mock" to signify a mock wallet controller.
func (*WalletController) CheckMempoolAcceptance ¶
func (w *WalletController) CheckMempoolAcceptance(tx *wire.MsgTx) error
func (*WalletController) ConfirmedBalance ¶
ConfirmedBalance currently returns dummy values.
func (*WalletController) CreateSimpleTx ¶
func (w *WalletController) CreateSimpleTx(fn.Set[wire.OutPoint], []*wire.TxOut, chainfee.SatPerKWeight, int32, base.CoinSelectionStrategy, bool) (*txauthor.AuthoredTx, error)
CreateSimpleTx currently returns dummy values.
func (*WalletController) DecorateInputs ¶
func (w *WalletController) DecorateInputs(*psbt.Packet, bool) error
DecorateInputs currently does nothing.
func (*WalletController) FetchInputInfo ¶
FetchInputInfo will be called to get info about the inputs to the funding transaction.
func (*WalletController) FinalizePsbt ¶
func (w *WalletController) FinalizePsbt(_ *psbt.Packet, _ string) error
FinalizePsbt currently does nothing.
func (*WalletController) FundPsbt ¶
func (w *WalletController) FundPsbt(*psbt.Packet, int32, chainfee.SatPerKWeight, string, *waddrmgr.KeyScope, base.CoinSelectionStrategy, func(utxo wtxmgr.Credit) bool) (int32, error)
FundPsbt currently does nothing.
func (*WalletController) GetRecoveryInfo ¶
func (w *WalletController) GetRecoveryInfo() (bool, float64, error)
GetRecoveryInfo currently returns dummy values.
func (*WalletController) GetTransactionDetails ¶
func (w *WalletController) GetTransactionDetails( txHash *chainhash.Hash) (*lnwallet.TransactionDetail, error)
GetTransactionDetails currently does nothing.
func (*WalletController) ImportAccount ¶
func (w *WalletController) ImportAccount(string, *hdkeychain.ExtendedKey, uint32, *waddrmgr.AddressType, bool) (*waddrmgr.AccountProperties, []btcutil.Address, []btcutil.Address, error)
ImportAccount currently returns a dummy value.
func (*WalletController) ImportPublicKey ¶
func (w *WalletController) ImportPublicKey(*btcec.PublicKey, waddrmgr.AddressType) error
ImportPublicKey currently returns a dummy value.
func (*WalletController) ImportTaprootScript ¶
func (w *WalletController) ImportTaprootScript(waddrmgr.KeyScope, *waddrmgr.Tapscript) (waddrmgr.ManagedAddress, error)
ImportTaprootScript currently returns a dummy value.
func (*WalletController) IsOurAddress ¶
func (w *WalletController) IsOurAddress(btcutil.Address) bool
IsOurAddress currently returns a dummy value.
func (*WalletController) IsSynced ¶
func (w *WalletController) IsSynced() (bool, int64, error)
IsSynced currently returns dummy values.
func (*WalletController) LabelTransaction ¶
LabelTransaction currently does nothing.
func (*WalletController) LastUnusedAddress ¶
func (w *WalletController) LastUnusedAddress(lnwallet.AddressType, string) (btcutil.Address, error)
LastUnusedAddress currently returns dummy values.
func (*WalletController) LeaseOutput ¶
func (w *WalletController) LeaseOutput(wtxmgr.LockID, wire.OutPoint, time.Duration) (time.Time, []byte, btcutil.Amount, error)
LeaseOutput returns the current time and a nil error.
func (*WalletController) ListAccounts ¶
func (w *WalletController) ListAccounts(string, *waddrmgr.KeyScope) ([]*waddrmgr.AccountProperties, error)
ListAccounts currently returns a dummy value.
func (*WalletController) ListAddresses ¶
func (w *WalletController) ListAddresses(string, bool) (lnwallet.AccountAddressMap, error)
ListAddresses currently returns a dummy value.
func (*WalletController) ListLeasedOutputs ¶
func (w *WalletController) ListLeasedOutputs() ([]*base.ListLeasedOutputResult, error)
func (*WalletController) ListTransactionDetails ¶
func (w *WalletController) ListTransactionDetails(int32, int32, string) ([]*lnwallet.TransactionDetail, error)
ListTransactionDetails currently returns dummy values.
func (*WalletController) ListUnspentWitness ¶
ListUnspentWitness is called by the wallet when doing coin selection. We just need one unspent for the funding transaction.
func (*WalletController) NewAddress ¶
func (w *WalletController) NewAddress(lnwallet.AddressType, bool, string) (btcutil.Address, error)
NewAddress is called to get new addresses for delivery, change etc.
func (*WalletController) PublishTransaction ¶
func (w *WalletController) PublishTransaction(tx *wire.MsgTx, _ string) error
PublishTransaction sends a transaction to the PublishedTransactions chan.
func (*WalletController) ReleaseOutput ¶
ReleaseOutput currently does nothing.
func (*WalletController) RemoveDescendants ¶
func (w *WalletController) RemoveDescendants(*wire.MsgTx) error
func (*WalletController) RequiredReserve ¶
func (w *WalletController) RequiredReserve(uint32) btcutil.Amount
RequiredReserve currently returns a dummy value.
func (*WalletController) ScriptForOutput ¶
func (w *WalletController) ScriptForOutput(*wire.TxOut) ( waddrmgr.ManagedPubKeyAddress, []byte, []byte, error)
ScriptForOutput returns the address, witness program and redeem script for a given UTXO. An error is returned if the UTXO does not belong to our wallet or it is not a managed pubKey address.
func (*WalletController) SendOutputs ¶
func (w *WalletController) SendOutputs(fn.Set[wire.OutPoint], []*wire.TxOut, chainfee.SatPerKWeight, int32, string, base.CoinSelectionStrategy) ( *wire.MsgTx, error)
SendOutputs currently returns dummy values.
func (*WalletController) SignPsbt ¶
func (w *WalletController) SignPsbt(*psbt.Packet) ([]uint32, error)
SignPsbt currently does nothing.
func (*WalletController) Start ¶
func (w *WalletController) Start() error
Start currently does nothing.
func (*WalletController) Stop ¶
func (w *WalletController) Stop() error
Stop currently does nothing.
func (*WalletController) SubscribeTransactions ¶
func (w *WalletController) SubscribeTransactions() (lnwallet.TransactionSubscription, error)
SubscribeTransactions currently does nothing.