diff --git a/lnwallet/channel.go b/lnwallet/channel.go index d5775f19..8029a15b 100644 --- a/lnwallet/channel.go +++ b/lnwallet/channel.go @@ -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...