noncer

package
v0.0.0-...-e03aae4 Latest Latest
Warning

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

Go to latest
Published: May 6, 2022 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProtocolVersionStr = "1.0.0"         // The same, as a string
	ProtocolName       = "bitbon_noncer" // Nickname of the protocol in geth

	DefaultDialTimeout = 5000
	DefaultMaxRetries  = 20
)

Variables

This section is empty.

Functions

func IsAllowed

func IsAllowed() bool

Types

type API

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

API provides the bitbon bitbon RPC service

func NewAPI

func NewAPI(n *Noncer) *API

NewAPI create a new RPC bitbon noncer service.

func (*API) Version

func (api *API) Version(ctx context.Context) string

Version returns version.

type Config

type Config struct {
	Enabled       bool
	RedisConnStrs []string
	Key           string
	DialTimeout   uint64
	MaxRetries    uint64
}

Config represents the configuration state of a bitbon agent service.

type Noncer

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

func New

func New(_ *node.ServiceContext, cfg *Config) (b *Noncer, err error)

func (*Noncer) APIs

func (n *Noncer) APIs() []rpc.API

APIs is a meaningless implementation of node.Service.

func (*Noncer) CheckNoncerEligibility

func (n *Noncer) CheckNoncerEligibility(assetbox common.Address) (bool, error)

func (*Noncer) ForceNonce

func (n *Noncer) ForceNonce(assetbox common.Address, nonce int64) error

directly sets nonce for given address use very carefully

func (*Noncer) GetNonce

func (n *Noncer) GetNonce(assetbox common.Address) (int64, error)

returns the current amount of transactions (for next transaction it should be incremented)

func (*Noncer) GetNoncerAssetboxes

func (n *Noncer) GetNoncerAssetboxes() ([]common.Address, error)

func (*Noncer) IncrementAndGetNonce

func (n *Noncer) IncrementAndGetNonce(assetbox common.Address) (int64, error)

increments nonce and returns the incremented value

func (*Noncer) Protocols

func (n *Noncer) Protocols() []p2p.Protocol

Protocols is a meaningless implementation of node.Service.

func (*Noncer) RemoveAssetboxesFromNoncer

func (n *Noncer) RemoveAssetboxesFromNoncer(assetboxes []common.Address) error

func (*Noncer) SetUpNonce

func (n *Noncer) SetUpNonce(assetbox common.Address, nonce int64) error

func (*Noncer) Start

func (n *Noncer) Start(srvr *p2p.Server) (err error)

Start implements node.Service

func (*Noncer) Stop

func (n *Noncer) Stop() error

Stop implements node.Service

func (*Noncer) Stopped

func (n *Noncer) Stopped() bool

Jump to

Keyboard shortcuts

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