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(keyLoc keychain.KeyLocator) (keychain.KeyDescriptor, error)
- func (s *SecretKeyRing) DeriveNextKey(keyFam keychain.KeyFamily) (keychain.KeyDescriptor, error)
- func (s *SecretKeyRing) DerivePrivKey(keyDesc keychain.KeyDescriptor) (*btcec.PrivateKey, error)
- func (s *SecretKeyRing) ECDH(_ keychain.KeyDescriptor, pubKey *btcec.PublicKey) ([32]byte, error)
- func (s *SecretKeyRing) SignDigest(_ keychain.KeyDescriptor, digest [32]byte) (*btcec.Signature, error)
- func (s *SecretKeyRing) SignDigestCompact(_ keychain.KeyDescriptor, digest [32]byte) ([]byte, error)
- type SingleSigner
- func (s *SingleSigner) ComputeInputScript(tx *wire.MsgTx, signDesc *input.SignDescriptor) (*input.Script, error)
- func (s *SingleSigner) SignMessage(pubKey *btcec.PublicKey, msg []byte) (input.Signature, error)
- func (s *SingleSigner) SignOutputRaw(tx *wire.MsgTx, signDesc *input.SignDescriptor) (input.Signature, error)
- type SpendNotifier
- type WalletController
- func (w *WalletController) BackEnd() string
- func (w *WalletController) ConfirmedBalance(confs int32, _ string) (btcutil.Amount, error)
- func (w *WalletController) CreateSimpleTx(outputs []*wire.TxOut, _ chainfee.SatPerKWeight, _ int32, _ bool) (*txauthor.AuthoredTx, error)
- func (w *WalletController) FetchInputInfo(prevOut *wire.OutPoint) (*lnwallet.Utxo, error)
- func (w *WalletController) FinalizePsbt(_ *psbt.Packet, _ string) error
- func (w *WalletController) FundPsbt(_ *psbt.Packet, _ 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(a btcutil.Address) bool
- func (w *WalletController) IsSynced() (bool, int64, error)
- func (w *WalletController) LabelTransaction(_ chainhash.Hash, _ string, _ bool) error
- func (w *WalletController) LastUnusedAddress(addrType 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, _ string) ([]*lnwallet.TransactionDetail, error)
- func (w *WalletController) ListUnspentWitness(minConfs, maxConfs int32, _ string) ([]*lnwallet.Utxo, error)
- func (w *WalletController) LockOutpoint(o wire.OutPoint)
- func (w *WalletController) NewAddress(addrType lnwallet.AddressType, change 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) SendOutputs(outputs []*wire.TxOut, _ chainfee.SatPerKWeight, _ int32, _ string) (*wire.MsgTx, 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(keyLoc keychain.KeyLocator) (keychain.KeyDescriptor, error)
DeriveKey currently returns dummy values.
func (*SecretKeyRing) DeriveNextKey ¶
func (s *SecretKeyRing) DeriveNextKey(keyFam keychain.KeyFamily) ( keychain.KeyDescriptor, error)
DeriveNextKey currently returns dummy values.
func (*SecretKeyRing) DerivePrivKey ¶
func (s *SecretKeyRing) DerivePrivKey(keyDesc keychain.KeyDescriptor) (*btcec.PrivateKey, error)
DerivePrivKey currently returns dummy values.
func (*SecretKeyRing) ECDH ¶
func (s *SecretKeyRing) ECDH(_ keychain.KeyDescriptor, pubKey *btcec.PublicKey) ([32]byte, error)
ECDH currently returns dummy values.
func (*SecretKeyRing) SignDigest ¶
func (s *SecretKeyRing) SignDigest(_ keychain.KeyDescriptor, digest [32]byte) (*btcec.Signature, error)
SignDigest signs the passed digest and ignores the KeyDescriptor.
func (*SecretKeyRing) SignDigestCompact ¶
func (s *SecretKeyRing) SignDigestCompact(_ keychain.KeyDescriptor, digest [32]byte) ([]byte, error)
SignDigestCompact signs the passed digest.
type SingleSigner ¶
type SingleSigner struct {
Privkey *btcec.PrivateKey
}
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 ¶
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) 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(outputs []*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, _ 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(a 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(addrType 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, _ string) ([]*lnwallet.TransactionDetail, error)
ListTransactionDetails currently returns dummy values.
func (*WalletController) ListUnspentWitness ¶
func (w *WalletController) ListUnspentWitness(minConfs, maxConfs int32, _ string) ([]*lnwallet.Utxo, error)
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(addrType lnwallet.AddressType, change 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) SendOutputs ¶
func (w *WalletController) SendOutputs(outputs []*wire.TxOut, _ chainfee.SatPerKWeight, _ int32, _ string) (*wire.MsgTx, error)
SendOutputs currently returns dummy values.
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.