paychmgr

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2020 License: Apache-2.0, MIT Imports: 29 Imported by: 12

Documentation

Index

Constants

View Source
const (
	DirInbound  = 1
	DirOutbound = 2
)

Variables

View Source
var ErrChannelNotTracked = errors.New("channel not tracked")

Functions

This section is empty.

Types

type ChannelInfo

type ChannelInfo struct {
	Channel address.Address
	Control address.Address
	Target  address.Address

	Direction uint64
	Vouchers  []*VoucherInfo
	NextLane  uint64
}

func (*ChannelInfo) MarshalCBOR

func (t *ChannelInfo) MarshalCBOR(w io.Writer) error

func (*ChannelInfo) UnmarshalCBOR

func (t *ChannelInfo) UnmarshalCBOR(r io.Reader) error

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

func NewManager

func NewManager(sm *stmgr.StateManager, pchstore *Store, api ManagerApi) *Manager

func (*Manager) AddVoucher

func (pm *Manager) AddVoucher(ctx context.Context, ch address.Address, sv *paych.SignedVoucher, proof []byte, minDelta types.BigInt) (types.BigInt, error)

func (*Manager) AllocateLane

func (pm *Manager) AllocateLane(ch address.Address) (uint64, error)

func (*Manager) CheckVoucherSpendable

func (pm *Manager) CheckVoucherSpendable(ctx context.Context, ch address.Address, sv *paych.SignedVoucher, secret []byte, proof []byte) (bool, error)

checks if the given voucher is currently spendable

func (*Manager) CheckVoucherValid

func (pm *Manager) CheckVoucherValid(ctx context.Context, ch address.Address, sv *paych.SignedVoucher) error

checks if the given voucher is valid (is or could become spendable at some point)

func (*Manager) GetChannelInfo

func (pm *Manager) GetChannelInfo(addr address.Address) (*ChannelInfo, error)

func (*Manager) GetPaych

func (pm *Manager) GetPaych(ctx context.Context, from, to address.Address, ensureFree types.BigInt) (address.Address, cid.Cid, error)

func (*Manager) ListChannels

func (pm *Manager) ListChannels() ([]address.Address, error)

func (*Manager) ListVouchers

func (pm *Manager) ListVouchers(ctx context.Context, ch address.Address) ([]*VoucherInfo, error)

func (*Manager) NextNonceForLane

func (pm *Manager) NextNonceForLane(ctx context.Context, ch address.Address, lane uint64) (uint64, error)

func (*Manager) OutboundChanTo

func (pm *Manager) OutboundChanTo(from, to address.Address) (address.Address, error)

func (*Manager) TrackInboundChannel

func (pm *Manager) TrackInboundChannel(ctx context.Context, ch address.Address) error

func (*Manager) TrackOutboundChannel

func (pm *Manager) TrackOutboundChannel(ctx context.Context, ch address.Address) error

type ManagerApi

type ManagerApi struct {
	fx.In

	full.MpoolAPI
	full.WalletAPI
	full.StateAPI
}

type Store

type Store struct {
	// contains filtered or unexported fields
}

func NewStore

func NewStore(ds dtypes.MetadataDS) *Store

func (*Store) AllocateLane

func (ps *Store) AllocateLane(ch address.Address) (uint64, error)

func (*Store) ListChannels

func (ps *Store) ListChannels() ([]address.Address, error)

func (*Store) TrackChannel

func (ps *Store) TrackChannel(ch *ChannelInfo) error

func (*Store) VouchersForPaych

func (ps *Store) VouchersForPaych(ch address.Address) ([]*VoucherInfo, error)

type VoucherInfo

type VoucherInfo struct {
	Voucher *paych.SignedVoucher
	Proof   []byte
}

func (*VoucherInfo) MarshalCBOR

func (t *VoucherInfo) MarshalCBOR(w io.Writer) error

func (*VoucherInfo) UnmarshalCBOR

func (t *VoucherInfo) UnmarshalCBOR(r io.Reader) error

Jump to

Keyboard shortcuts

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