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 ¶
- Variables
- type Service
- func (s *Service) Metrics() []prometheus.Collector
- func (s *Service) Pay(ctx context.Context, peer swarm.Address, amount *big.Int)
- func (s *Service) Protocol() p2p.ProtocolSpec
- func (s *Service) SetAccounting(accounting settlement.Accounting)
- func (s *Service) SettlementsReceived() (map[string]*big.Int, error)
- func (s *Service) SettlementsSent() (map[string]*big.Int, error)
- func (s *Service) TotalReceived(peer swarm.Address) (totalReceived *big.Int, err error)
- func (s *Service) TotalSent(peer swarm.Address) (totalSent *big.Int, err error)
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") ErrTimeOutOfSyncAlleged = errors.New("settlement allowance timestamps from peer were decreasing") ErrTimeOutOfSyncRecent = errors.New("settlement allowance timestamps from peer differed from our measurement by more than 2 seconds") ErrTimeOutOfSyncInterval = errors.New("settlement allowance interval from peer differed from local interval by more than 3 seconds") ErrRefreshmentBelowExpected = errors.New("refreshment below expected") ErrRefreshmentAboveExpected = errors.New("refreshment above expected") )
Functions ¶
This section is empty.
Types ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func New ¶
func New(streamer p2p.Streamer, logger log.Logger, store storage.StateStorer, accounting settlement.Accounting, refreshRate, lightRefreshRate *big.Int, p2pService p2p.Service) *Service
func (*Service) Metrics ¶
func (s *Service) Metrics() []prometheus.Collector
func (*Service) Protocol ¶
func (s *Service) Protocol() p2p.ProtocolSpec
func (*Service) SetAccounting ¶ added in v0.6.0
func (s *Service) SetAccounting(accounting settlement.Accounting)
func (*Service) SettlementsReceived ¶ added in v0.3.0
SettlementsReceived returns all stored received settlement values for a given type of prefix
func (*Service) SettlementsSent ¶ added in v0.3.0
SettlementsSent returns all stored sent settlement values for a given type of prefix
func (*Service) TotalReceived ¶ added in v0.3.0
TotalReceived returns the total amount received from a peer
Click to show internal directories.
Click to hide internal directories.