Documentation ¶
Index ¶
- Variables
- func FetchChanInfo(chanBucket kvdb.RBucket, c *OpenChannel, legacy bool) error
- func MakeTlvStream(c *OpenChannel, legacy bool) (*tlv.Stream, error)
- func MigrateBalancesToTlvRecords(tx kvdb.RwTx) error
- func PutChanInfo(chanBucket kvdb.RwBucket, c *OpenChannel, legacy bool) error
- func UseLogger(logger btclog.Logger)
- type OpenChannel
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNoChanInfoFound is returned when a particular channel does not // have any channels state. ErrNoChanInfoFound = fmt.Errorf("no chan info found") // ErrNoPastDeltas is returned when the channel delta bucket hasn't been // created. ErrNoPastDeltas = fmt.Errorf("channel has no recorded deltas") // ErrLogEntryNotFound is returned when we cannot find a log entry at // the height requested in the revocation log. ErrLogEntryNotFound = fmt.Errorf("log entry not found") // ErrNoCommitmentsFound is returned when a channel has not set // commitment states. ErrNoCommitmentsFound = fmt.Errorf("no commitments found") )
var ( // ErrNoChanDBExists is returned when a channel bucket hasn't been // created. ErrNoChanDBExists = fmt.Errorf("channel db has not yet been created") // ErrNoActiveChannels is returned when there is no active (open) // channels within the database. ErrNoActiveChannels = fmt.Errorf("no active channels exist") // ErrChannelNotFound is returned when we attempt to locate a channel // for a specific chain, but it is not found. ErrChannelNotFound = fmt.Errorf("channel not found") )
Functions ¶
func FetchChanInfo ¶
func FetchChanInfo(chanBucket kvdb.RBucket, c *OpenChannel, legacy bool) error
FetchChanInfo deserializes the channel info based on the legacy boolean. After migration25, the legacy format would have the fields `InitialLocalBalance` and `InitialRemoteBalance` directly encoded as bytes. For the new format, they will be put inside a tlv stream.
func MakeTlvStream ¶
func MakeTlvStream(c *OpenChannel, legacy bool) (*tlv.Stream, error)
MakeTlvStream creates a tlv stream based on whether we are deadling with legacy format or not. For the legacy format, we have a single record in the stream. For the new format, we have the extra balance records.
func MigrateBalancesToTlvRecords ¶
MigrateBalancesToTlvRecords migrates the balance fields into tlv records. It does so by first reading a list of open channels, then rewriting the channel info with the updated tlv stream.
func PutChanInfo ¶
func PutChanInfo(chanBucket kvdb.RwBucket, c *OpenChannel, legacy bool) error
PutChanInfo serializes the channel info based on the legacy boolean. After migration25, the legacy format would have the fields `InitialLocalBalance` and `InitialRemoteBalance` directly encoded as bytes. For the new format, they will be put inside a tlv stream.
Types ¶
type OpenChannel ¶
type OpenChannel struct {
mig25.OpenChannel
}
OpenChannel embeds a mig25.OpenChannel with the extra update-to-date serialization and deserialization methods.
NOTE: doesn't have the Packager field as it's not used in current migration.