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) 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
- 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) (*btcec.Signature, error)
- func (s *SecretKeyRing) SignMessageCompact(_ keychain.KeyLocator, msg []byte, doubleHash bool) ([]byte, 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) (*btcec.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) ConfirmedBalance(int32, string) (btcutil.Amount, error)
- func (w *WalletController) CreateSimpleTx([]*wire.TxOut, chainfee.SatPerKWeight, int32, bool) (*txauthor.AuthoredTx, 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) (int32, error)
- func (w *WalletController) GetRecoveryInfo() (bool, float64, 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) 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, error)
- func (w *WalletController) ListAccounts(string, *waddrmgr.KeyScope) ([]*waddrmgr.AccountProperties, error)
- func (w *WalletController) ListLeasedOutputs() ([]*wtxmgr.LockedOutput, error)
- func (w *WalletController) ListTransactionDetails(int32, int32, string) ([]*lnwallet.TransactionDetail, error)
- func (w *WalletController) ListUnspentWitness(int32, int32, string) ([]*lnwallet.Utxo, error)
- func (w *WalletController) LockOutpoint(o wire.OutPoint)
- 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) ScriptForOutput(*wire.TxOut) (waddrmgr.ManagedPubKeyAddress, []byte, []byte, error)
- func (w *WalletController) SendOutputs([]*wire.TxOut, chainfee.SatPerKWeight, int32, string) (*wire.MsgTx, error)
- func (w *WalletController) SignPsbt(*psbt.Packet) error
- func (w *WalletController) Start() error
- func (w *WalletController) Stop() error
- func (w *WalletController) SubscribeTransactions() (lnwallet.TransactionSubscription, error)
- func (w *WalletController) UnlockOutpoint(o wire.OutPoint)
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.
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) (*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.
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) 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) (*btcec.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.
type SingleSigner ¶
type SingleSigner struct { Privkey *btcec.PrivateKey KeyLoc keychain.KeyLocator }
SingleSigner is an implementation of the Signer interface that signs everything with a single private key.
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) (*btcec.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) ConfirmedBalance ¶
ConfirmedBalance currently returns dummy values.
func (*WalletController) CreateSimpleTx ¶
func (w *WalletController) CreateSimpleTx([]*wire.TxOut, chainfee.SatPerKWeight, int32, bool) (*txauthor.AuthoredTx, error)
CreateSimpleTx currently returns dummy values.
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) (int32, error)
FundPsbt currently does nothing.
func (*WalletController) GetRecoveryInfo ¶
func (w *WalletController) GetRecoveryInfo() (bool, float64, error)
GetRecoveryInfo currently returns dummy values.
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) 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, 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) ListLeasedOutputs ¶
func (w *WalletController) ListLeasedOutputs() ([]*wtxmgr.LockedOutput, 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) LockOutpoint ¶
func (w *WalletController) LockOutpoint(o wire.OutPoint)
LockOutpoint currently does nothing.
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) 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([]*wire.TxOut, chainfee.SatPerKWeight, int32, string) (*wire.MsgTx, error)
SendOutputs currently returns dummy values.
func (*WalletController) SignPsbt ¶
func (w *WalletController) SignPsbt(*psbt.Packet) 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.
func (*WalletController) UnlockOutpoint ¶
func (w *WalletController) UnlockOutpoint(o wire.OutPoint)
UnlockOutpoint currently does nothing.