coordinatornetwork

package
v1.8.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2021 License: AGPL-3.0 Imports: 23 Imported by: 0

Documentation

Overview

Package coordinatornetwork implements a comunication layer among coordinators in order to share information such as transactions in the pool and create account authorizations.

To do so the pubsub gossip protocol is used. This code is currently heavily based on this example: https://github.com/libp2p/go-libp2p/blob/master/examples/pubsub

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CoordinatorNetwork

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

CoordinatorNetwork it's a p2p communication layer that enables coordinators to exchange information in benefit of the network and them selfs. The main goal is to share L2 data (common.PoolL2Tx and common.AccountCreationAuth)

func NewCoordinatorNetwork

func NewCoordinatorNetwork(
	ethPrivKey *ecdsa.PrivateKey,
	bootstrapPeers []multiaddr.Multiaddr,
	chainID uint16,
	newPoolTxHandler func(common.PoolL2Tx) error,
) (CoordinatorNetwork, error)

NewCoordinatorNetwork connects to coordinators network and return a CoordinatorNetwork to be able to receive and send information from and to other coordinators.

func (CoordinatorNetwork) FindMorePeers

func (coordnet CoordinatorNetwork) FindMorePeers() error

FindMorePeers discover more peers that have already join the coordinators network

func (CoordinatorNetwork) PublishTx

func (coordnet CoordinatorNetwork) PublishTx(tx common.PoolL2Tx) error

PublishTx send a L2 transaction to the coordinators network

Jump to

Keyboard shortcuts

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