lnwallet: add comments to fields of OpenChannelState
This commit is contained in:
parent
36ec5b4927
commit
b606804934
@ -26,30 +26,39 @@ type nodeId [32]byte
|
|||||||
// OpenChannelState...
|
// OpenChannelState...
|
||||||
// TODO(roasbeef): script gen methods on this?
|
// TODO(roasbeef): script gen methods on this?
|
||||||
type OpenChannelState struct {
|
type OpenChannelState struct {
|
||||||
fundingType FundingType
|
|
||||||
|
|
||||||
// Hash? or Their current pubKey?
|
// Hash? or Their current pubKey?
|
||||||
// TODO(roasbeef): switch to Tadge's LNId
|
// TODO(roasbeef): switch to Tadge's LNId
|
||||||
theirLNID [32]byte
|
theirLNID nodeId
|
||||||
|
|
||||||
minFeePerKb btcutil.Amount
|
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
|
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
|
theirCommitKey *btcec.PublicKey
|
||||||
|
|
||||||
|
// Tracking total channel capacity, and the amount of funds allocated
|
||||||
|
// to each side.
|
||||||
capacity btcutil.Amount
|
capacity btcutil.Amount
|
||||||
ourBalance btcutil.Amount
|
ourBalance btcutil.Amount
|
||||||
theirBalance 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
|
theirCommitTx *wire.MsgTx
|
||||||
ourCommitTx *wire.MsgTx
|
ourCommitTx *wire.MsgTx
|
||||||
theirCommitSig []byte
|
theirCommitSig []byte
|
||||||
|
|
||||||
|
// The final funding transaction. Kept wallet-related records.
|
||||||
fundingTx *wire.MsgTx
|
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
|
fundingRedeemScript []byte
|
||||||
|
|
||||||
// Current revocation for their commitment transaction. However, since
|
// Current revocation for their commitment transaction. However, since
|
||||||
@ -67,11 +76,11 @@ type OpenChannelState struct {
|
|||||||
htlcTimeout uint32
|
htlcTimeout uint32
|
||||||
csvDelay uint32
|
csvDelay uint32
|
||||||
|
|
||||||
|
// TODO(roasbeef): track fees, other stats?
|
||||||
numUpdates uint64
|
numUpdates uint64
|
||||||
totalSatoshisSent uint64
|
totalSatoshisSent uint64
|
||||||
totalSatoshisReceived uint64
|
totalSatoshisReceived uint64
|
||||||
// TODO(roasbeef): track fees?
|
creationTime time.Time
|
||||||
creationTime time.Time
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (o *OpenChannelState) Encode(b bytes.Buffer) error {
|
func (o *OpenChannelState) Encode(b bytes.Buffer) error {
|
||||||
@ -82,8 +91,8 @@ func (o *OpenChannelState) Decode(b bytes.Buffer) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func newOpenChannelState(fType FundingType, ID [32]byte) *OpenChannelState {
|
func newOpenChannelState(ID [32]byte) *OpenChannelState {
|
||||||
return &OpenChannelState{fundingType: fType, theirLNID: ID}
|
return &OpenChannelState{theirLNID: ID}
|
||||||
}
|
}
|
||||||
|
|
||||||
// LightningChannel...
|
// LightningChannel...
|
||||||
|
Loading…
Reference in New Issue
Block a user