github.com/decred/dcrlnd@v0.7.6/watchtower/wtdb/client_chan_summary.go (about)

     1  package wtdb
     2  
     3  import (
     4  	"io"
     5  
     6  	"github.com/decred/dcrlnd/lnwire"
     7  )
     8  
     9  // ChannelSummaries is a map for a given channel id to it's ClientChanSummary.
    10  type ChannelSummaries map[lnwire.ChannelID]ClientChanSummary
    11  
    12  // ClientChanSummary tracks channel-specific information. A new
    13  // ClientChanSummary is inserted in the database the first time the client
    14  // encounters a particular channel.
    15  type ClientChanSummary struct {
    16  	// SweepPkScript is the pkscript to which all justice transactions will
    17  	// deposit recovered funds for this particular channel.
    18  	SweepPkScript []byte
    19  
    20  	// TODO(conner): later extend with info about initial commit height,
    21  	// ineligible states, etc.
    22  }
    23  
    24  // Encode writes the ClientChanSummary to the passed io.Writer.
    25  func (s *ClientChanSummary) Encode(w io.Writer) error {
    26  	return WriteElement(w, s.SweepPkScript)
    27  }
    28  
    29  // Decode reads a ClientChanSummary form the passed io.Reader.
    30  func (s *ClientChanSummary) Decode(r io.Reader) error {
    31  	return ReadElement(r, &s.SweepPkScript)
    32  }