balance

package
v0.1.20 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2023 License: Unlicense Imports: 12 Imported by: 0

Documentation

Overview

Package balance provides an onion layer message that comes in response to a getbalance query, informing the client of the balance of a session, identified by the getbalance nonce.ID.

Index

Constants

View Source
const (
	Magic = "bala"
	Len   = magic.Len + nonce.IDLen + slice.Uint64Len
)

Variables

This section is empty.

Functions

func Gen

func Gen() codec.Codec

Gen is a factory function to generate an Ad.

func New

func New(id nonce.ID, amt lnwire.MilliSatoshi) ont.Onion

New creates a new Balance as an ont.Onion.

Types

type Balance

type Balance struct {

	// ID of the request this response relates to.
	ID nonce.ID

	// Amount current in the balance according to the relay.
	lnwire.MilliSatoshi
}

Balance is the balance with an ID the client has a pending balance update waiting on.

func (*Balance) Account

func (x *Balance) Account(res *sess.Data, sm *sess.Manager,
	s *sessions.Data, last bool) (skip bool, sd *sessions.Data)

Account simply records the message ID, which will be recognised in the pending responses cache.

func (*Balance) Decode

func (x *Balance) Decode(s *splice.Splice) (e error)

Decode a splice.Splice's next bytes into a Balance.

func (*Balance) Encode

func (x *Balance) Encode(s *splice.Splice) (e error)

Encode a Balance into a splice.Splice's next bytes.

func (*Balance) Handle

func (x *Balance) Handle(s *splice.Splice, p ont.Onion, ng ont.Ngin) (e error)

Handle provides relay and accounting processing logic for receiving a Balance message.

func (*Balance) Len

func (x *Balance) Len() int

Len returns the length of bytes required to encode the Balance.

func (*Balance) Magic

func (x *Balance) Magic() string

Magic bytes that identify this message.

func (*Balance) Unwrap

func (x *Balance) Unwrap() interface{}

Unwrap returns nothing because there isn't an onion inside a Balance.

func (*Balance) Wrap

func (x *Balance) Wrap(inner ont.Onion)

Wrap is a no-op because a Balance is terminal.

Jump to

Keyboard shortcuts

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