migration26

package
v0.17.0-beta.rc1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 24, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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")
)
View Source
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

func MigrateBalancesToTlvRecords(tx kvdb.RwTx) error

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.

func UseLogger

func UseLogger(logger btclog.Logger)

UseLogger uses a specified Logger to output package logging info.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL