Documentation ¶
Index ¶
- func NewMockConn(localPk, remotePk *btcec.PublicKey, localAddr, remoteAddr net.Addr, ...) (*MockPeer, *MockPeer)
- type ClientDB
- func (m *ClientDB) AckUpdate(id *wtdb.SessionID, seqNum, lastApplied uint16) error
- func (m *ClientDB) AddChanPkScript(chanID lnwire.ChannelID, pkScript []byte) error
- func (m *ClientDB) CommitUpdate(id *wtdb.SessionID, seqNum uint16, update *wtdb.CommittedUpdate) (uint16, error)
- func (m *ClientDB) CreateClientSession(session *wtdb.ClientSession) error
- func (m *ClientDB) CreateTower(lnAddr *lnwire.NetAddress) (*wtdb.Tower, error)
- func (m *ClientDB) FetchChanPkScripts() (map[lnwire.ChannelID][]byte, error)
- func (m *ClientDB) ListClientSessions() (map[wtdb.SessionID]*wtdb.ClientSession, error)
- func (m *ClientDB) MarkBackupIneligible(chanID lnwire.ChannelID, commitHeight uint64) error
- type MockPeer
- func (p *MockPeer) Close() error
- func (p *MockPeer) LocalAddr() net.Addr
- func (p *MockPeer) Read(dst []byte) (int, error)
- func (p *MockPeer) ReadNextMessage() ([]byte, error)
- func (p *MockPeer) RemoteAddr() net.Addr
- func (p *MockPeer) RemotePub() *btcec.PublicKey
- func (p *MockPeer) SetDeadline(t time.Time) error
- func (p *MockPeer) SetReadDeadline(t time.Time) error
- func (p *MockPeer) SetWriteDeadline(t time.Time) error
- func (p *MockPeer) Write(b []byte) (n int, err error)
- type MockSigner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ClientDB ¶
type ClientDB struct {
// contains filtered or unexported fields
}
ClientDB is a mock, in-memory database or testing the watchtower client behavior.
func (*ClientDB) AckUpdate ¶
AckUpdate persists an acknowledgment for a given (session, seqnum) pair. This removes the update from the set of committed updates, and validates the lastApplied value returned from the tower.
func (*ClientDB) AddChanPkScript ¶
AddChanPkScript sets a pkscript or sweeping funds from the channel or chanID.
func (*ClientDB) CommitUpdate ¶
func (m *ClientDB) CommitUpdate(id *wtdb.SessionID, seqNum uint16, update *wtdb.CommittedUpdate) (uint16, error)
CommitUpdate persists the CommittedUpdate provided in the slot for (session, seqNum). This allows the client to retransmit this update on startup.
func (*ClientDB) CreateClientSession ¶
func (m *ClientDB) CreateClientSession(session *wtdb.ClientSession) error
CreateClientSession records a newly negotiated client session in the set of active sessions. The session can be identified by its SessionID.
func (*ClientDB) CreateTower ¶
CreateTower initializes a database entry with the given lightning address. If the tower exists, the address is append to the list of all addresses used to that tower previously.
func (*ClientDB) FetchChanPkScripts ¶
FetchChanPkScripts returns the set of sweep pkscripts known for all channels. This allows the client to cache them in memory on startup.
func (*ClientDB) ListClientSessions ¶
ListClientSessions returns the set of all client sessions known to the db.
func (*ClientDB) MarkBackupIneligible ¶
MarkBackupIneligible records that particular commit height is ineligible for backup. This allows the client to track which updates it should not attempt to retry after startup.
type MockPeer ¶
type MockPeer struct { IncomingMsgs chan []byte OutgoingMsgs chan []byte RemoteQuit chan struct{} Quit chan struct{} // contains filtered or unexported fields }
MockPeer emulates a single endpoint of brontide transport.
func NewMockPeer ¶
NewMockPeer returns a fresh MockPeer.
func (*MockPeer) ReadNextMessage ¶
ReadNextMessage returns the raw bytes of the next full message read from the remote peer. The read will fail if either party closes the connection or the read deadline expires.
func (*MockPeer) RemoteAddr ¶
RemoteAddr returns the net address of the remote peer.
func (*MockPeer) SetDeadline ¶
SetDeadline is not implemented.
func (*MockPeer) SetReadDeadline ¶
SetReadDeadline initializes a timer that will cause any pending reads to fail at time t. If t is zero, the deadline is infinite.
func (*MockPeer) SetWriteDeadline ¶
SetWriteDeadline initializes a timer that will cause any pending writes to fail at time t. If t is zero, the deadline is infinite.
type MockSigner ¶
type MockSigner struct {
// contains filtered or unexported fields
}
MockSigner is an input.Signer that allows one to add arbitrary private keys and sign messages by passing the assigned keychain.KeyLocator.
func (*MockSigner) AddPrivKey ¶
func (s *MockSigner) AddPrivKey(privKey *btcec.PrivateKey) keychain.KeyLocator
AddPrivKey records the passed privKey in the MockSigner's registry of keys it can sign with in the future. A unique key locator is returned, allowing the caller to sign with this key when presented via an input.SignDescriptor.
func (*MockSigner) ComputeInputScript ¶
func (s *MockSigner) ComputeInputScript(tx *wire.MsgTx, signDesc *input.SignDescriptor) (*input.Script, error)
ComputeInputScript is not implemented.
func (*MockSigner) SignOutputRaw ¶
func (s *MockSigner) SignOutputRaw(tx *wire.MsgTx, signDesc *input.SignDescriptor) ([]byte, error)
SignOutputRaw signs an input on the passed transaction using the input index in the sign descriptor. The returned signature is the raw DER-encoded signature without the signhash flag.