payment

package
v0.12.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2019 License: ISC Imports: 31 Imported by: 0

Documentation

Overview

Package payment - control of payment verification

Index

Constants

View Source
const (
	// MinimumNonceLength - least number of bytes in NONCE
	MinimumNonceLength = 8
	// MaximumNonceLength - most number of bytes in NONCE
	MaximumNonceLength = 64
)
View Source
const HeaderSyncTimeout = time.Minute
View Source
const MaximumOutboundPeers = 32
View Source
const PaymentExpiry = 12 * time.Hour

Variables

This section is empty.

Functions

func Finalise added in v0.2.0

func Finalise() error

Finalise - stop all background tasks

func Initialise added in v0.2.0

func Initialise(configuration *Configuration) error

Initialise - setup the payment system

Types

type Configuration added in v0.2.0

type Configuration struct {
	Mode      string                  `gluamapper:"mode" hcl:"mode" json:"mode"`
	Discovery *discoveryConfiguration `gluamapper:"discovery" hcl:"discovery" json:"discovery"`
	Bitcoin   *currencyConfiguration  `gluamapper:"bitcoin" hcl:"bitcoin" json:"bitcoin"`
	Litecoin  *currencyConfiguration  `gluamapper:"litecoin" hcl:"litecoin" json:"litecoin"`
}

Configuration - structure for configuration file

type PeerMap added in v0.12.0

type PeerMap struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

PeerMap is a map that maintains the pair between addresses and bitcoin peers in a thread-safe way.

func NewPeerMap added in v0.12.0

func NewPeerMap() *PeerMap

func (*PeerMap) Add added in v0.12.0

func (m *PeerMap) Add(addr string, p *peer.Peer)

Add will add a new peer into the map.

func (*PeerMap) Delete added in v0.12.0

func (m *PeerMap) Delete(addr string)

Delete will remove a peer by its address.

func (*PeerMap) Exist added in v0.12.0

func (m *PeerMap) Exist(addr string) bool

Exist validate whether an address is in the map.

func (*PeerMap) First added in v0.12.0

func (m *PeerMap) First() (p *peer.Peer)

First will return the first peer get from the map iteration. Due to the nature of map in golang, the item is random without fixed order.

func (*PeerMap) Get added in v0.12.0

func (m *PeerMap) Get(addr string) (p *peer.Peer)

Get will return a specific peer from the map.

func (*PeerMap) Len added in v0.12.0

func (m *PeerMap) Len() int

Len returns the len of current map.

func (*PeerMap) Range added in v0.12.0

func (m *PeerMap) Range(callback func(key string, value *peer.Peer))

Range is a wrapper function of the map iteration.

Jump to

Keyboard shortcuts

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