channeldb

package
v0.0.0-...-ae0a28a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 18, 2016 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// ActiveNetParams ...
	ActiveNetParams = &chaincfg.TestNet3Params
)

Functions

This section is empty.

Types

type ClosedChannel

type ClosedChannel struct {
}

ClosedChannel ...

type DB

type DB struct {
	// contains filtered or unexported fields
}

DB ... TODO(roasbeef): CHECKSUMS, REDUNDANCY, etc etc.

func Create

func Create() *DB

Create ...

func New

func New(addrmgr *waddrmgr.Manager, namespace walletdb.Namespace) *DB

New ... TODO(roasbeef): re-visit this dependancy...

func Open

func Open() *DB

Open ... TODO(roasbeef): create+open, ditch New, fixes above

func (*DB) FetchOpenChannel

func (c *DB) FetchOpenChannel(nodeID [32]byte) (*OpenChannel, error)

FetchOpenChannel ... TODO(roasbeef): assumes only 1 active channel per-node

func (*DB) GetIDAdr

func (c *DB) GetIDAdr() (*btcutil.AddressPubKeyHash, error)

GetIDAdr returns the IDKey

func (*DB) PutIDKey

func (c *DB) PutIDKey(pkh []byte) error

PutIDKey saves the private key used for

func (*DB) PutOpenChannel

func (c *DB) PutOpenChannel(channel *OpenChannel) error

PutOpenChannel ...

func (*DB) Wipe

func (d *DB) Wipe() error

Wipe ...

type OpenChannel

type OpenChannel struct {
	// Hash? or Their current pubKey?
	// TODO(roasbeef): switch to Tadge's LNId
	TheirLNID [wire.HashSize]byte

	// The ID of a channel is the txid of the funding transaction.
	ChanID [wire.HashSize]byte

	MinFeePerKb btcutil.Amount

	// Keys for both sides to be used for the commitment transactions.
	OurCommitKey   *btcec.PrivateKey
	TheirCommitKey *btcec.PublicKey

	// Tracking total channel capacity, and the amount of funds allocated
	// to each side.
	Capacity     btcutil.Amount
	OurBalance   btcutil.Amount
	TheirBalance btcutil.Amount

	// Commitment transactions for both sides (they're asymmetric). Our
	// commitment transaction includes a valid sigScript, and is ready for
	// broadcast.
	TheirCommitTx *wire.MsgTx
	OurCommitTx   *wire.MsgTx // TODO(roasbeef): store hash instead?

	// The final funding transaction. Kept wallet-related records.
	FundingTx *wire.MsgTx

	MultiSigKey         *btcec.PrivateKey
	FundingRedeemScript []byte

	// Current revocation for their commitment transaction. However, since
	// this is the hash, and not the pre-image, we can't yet verify that
	// it's actually in the chain.
	TheirCurrentRevocation [20]byte
	TheirShaChain          *shachain.HyperShaChain
	OurShaChain            *shachain.HyperShaChain

	// Final delivery address
	// TODO(roasbeef): should just be output scripts
	OurDeliveryAddress   btcutil.Address
	TheirDeliveryAddress btcutil.Address

	// In blocks
	CsvDelay uint32

	// TODO(roasbeef): track fees, other stats?
	NumUpdates            uint64
	TotalSatoshisSent     uint64
	TotalSatoshisReceived uint64
	CreationTime          time.Time
}

OpenChannel ... TODO(roasbeef): store only the essentials? optimize space... TODO(roasbeef): switch to "column store"

func (*OpenChannel) Decode

func (o *OpenChannel) Decode(b io.Reader, addrManager *waddrmgr.Manager) error

Decode ...

func (*OpenChannel) Encode

func (o *OpenChannel) Encode(b io.Writer, addrManager *waddrmgr.Manager) error

Encode ... TODO(roasbeef): checksum

type Payment

type Payment struct {
}

Payment ...

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL