pseudosettle

package
v0.0.0-...-c9321c3 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2022 License: BSD-3-Clause Imports: 16 Imported by: 0

Documentation

Overview

Package pseudosettle implements a pretend settlement protocol where nodes send pretend payment messages consisting only of the payment amount. Its purpose is to be able to have the full payment / disconnect threshold machinery in place without having to send cheques or real values.

Index

Constants

This section is empty.

Variables

View Source
var (
	SettlementReceivedPrefix = "pseudosettle_total_received_"
	SettlementSentPrefix     = "pseudosettle_total_sent_"

	ErrSettlementTooSoon              = errors.New("settlement too soon")
	ErrNoPseudoSettlePeer             = errors.New("settlement peer not found")
	ErrDisconnectAllowanceCheckFailed = errors.New("settlement allowance below enforced amount")
	ErrTimeOutOfSync                  = errors.New("settlement allowance timestamps differ beyond tolerance")
)

Functions

This section is empty.

Types

type Service

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

func New

func New(streamer p2p.Streamer, logger logging.Logger, store storage.StateStorer, accounting settlement.Accounting, refreshRate *big.Int, p2pService p2p.Service) *Service

func (*Service) Metrics

func (s *Service) Metrics() []prometheus.Collector

func (*Service) Pay

func (s *Service) Pay(ctx context.Context, peer penguin.Address, amount *big.Int, checkAllowance *big.Int) (*big.Int, int64, error)

Pay initiates a payment to the given peer

func (*Service) Protocol

func (s *Service) Protocol() p2p.ProtocolSpec

func (*Service) SetAccounting

func (s *Service) SetAccounting(accounting settlement.Accounting)

func (*Service) SettlementsReceived

func (s *Service) SettlementsReceived() (map[string]*big.Int, error)

SettlementsReceived returns all stored received settlement values for a given type of prefix

func (*Service) SettlementsSent

func (s *Service) SettlementsSent() (map[string]*big.Int, error)

SettlementsSent returns all stored sent settlement values for a given type of prefix

func (*Service) TotalReceived

func (s *Service) TotalReceived(peer penguin.Address) (totalReceived *big.Int, err error)

TotalReceived returns the total amount received from a peer

func (*Service) TotalSent

func (s *Service) TotalSent(peer penguin.Address) (totalSent *big.Int, err error)

TotalSent returns the total amount sent to a peer

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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