lnwallet: add comments to fields of OpenChannelState

This commit is contained in:
Olaoluwa Osuntokun 2015-12-22 22:27:33 -06:00
parent 36ec5b4927
commit b606804934
1 changed files with 19 additions and 10 deletions

View File

@ -26,30 +26,39 @@ type nodeId [32]byte
// OpenChannelState...
// TODO(roasbeef): script gen methods on this?
type OpenChannelState struct {
fundingType FundingType
// Hash? or Their current pubKey?
// TODO(roasbeef): switch to Tadge's LNId
theirLNID [32]byte
theirLNID nodeId
minFeePerKb btcutil.Amount
//Our reserve. assume symmetric reserve amounts
// Our reserve. Assume symmetric reserve amounts. Only needed if the
// funding type is CLTV.
reserveAmount btcutil.Amount
ourCommitKey *btcec.PrivateKey
// Keys for both sides to be used for the commitment transactions.
ourCommitKey *btcec.PrivateKey // TODO(roasbeef): again unencrypted
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). Also
// their signature which lets us spend our version of the commitment
// transaction.
theirCommitTx *wire.MsgTx
ourCommitTx *wire.MsgTx
theirCommitSig []byte
// The final funding transaction. Kept wallet-related records.
fundingTx *wire.MsgTx
multiSigKey *btcec.PrivateKey
// TODO(roasbeef): instead store a btcutil.Address here? Otherwise key
// is stored unencrypted! Use manager.Encrypt() when storing.
multiSigKey *btcec.PrivateKey
// TODO(roasbeef): encrypt also, or store in waddrmanager?
fundingRedeemScript []byte
// Current revocation for their commitment transaction. However, since
@ -67,11 +76,11 @@ type OpenChannelState struct {
htlcTimeout uint32
csvDelay uint32
// TODO(roasbeef): track fees, other stats?
numUpdates uint64
totalSatoshisSent uint64
totalSatoshisReceived uint64
// TODO(roasbeef): track fees?
creationTime time.Time
creationTime time.Time
}
func (o *OpenChannelState) Encode(b bytes.Buffer) error {
@ -82,8 +91,8 @@ func (o *OpenChannelState) Decode(b bytes.Buffer) error {
return nil
}
func newOpenChannelState(fType FundingType, ID [32]byte) *OpenChannelState {
return &OpenChannelState{fundingType: fType, theirLNID: ID}
func newOpenChannelState(ID [32]byte) *OpenChannelState {
return &OpenChannelState{theirLNID: ID}
}
// LightningChannel...