peer

package
v0.0.0-...-041ef7d Latest Latest
Warning

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

Go to latest
Published: May 13, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BlockSync = iota
	TxSync
)

Variables

View Source
var StatusSync *packet.StatusPacket

Functions

func Add

func Add(p *Peer)

func PeerInfos

func PeerInfos() []*p2p.PeerInfo

func Remove

func Remove(p *Peer)

func Size

func Size() uint32

Types

type Block

type Block struct {
	Hash   common.Hash
	Number uint64
}

type Broadcast

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

func NewBroadcast

func NewBroadcast(p *Peer) *Broadcast

func (*Broadcast) AnnounceBlock

func (b *Broadcast) AnnounceBlock(hash common.Hash, number uint64)

func (*Broadcast) AnnounceBlocks

func (b *Broadcast) AnnounceBlocks()

func (*Broadcast) AnnounceTransactions

func (b *Broadcast) AnnounceTransactions()

func (*Broadcast) AnnounceTx

func (b *Broadcast) AnnounceTx(tx common.Hash)

func (*Broadcast) Close

func (b *Broadcast) Close()

func (*Broadcast) SendAnnounceBlock

func (b *Broadcast) SendAnnounceBlock(hash common.Hash, number uint64) error

func (*Broadcast) SendAnnounceTx

func (b *Broadcast) SendAnnounceTx(txs []common.Hash) error

type Cache

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

type Info

type Info struct {
	Version    uint
	Difficulty *big.Int
	Head       string
}

type Peer

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

func Get

func Get(id enode.ID) *Peer

func Gets

func Gets() []*Peer

func New

func New(peer *p2p.Peer, rw p2p.MsgReadWriter, bootstrap, static bool) *Peer

func (*Peer) AddRequestTxs

func (p *Peer) AddRequestTxs(n uint32)

func (*Peer) AnnounceBlock

func (p *Peer) AnnounceBlock(hash common.Hash, number uint64)

func (*Peer) AnnounceTx

func (p *Peer) AnnounceTx(tx common.Hash)

func (*Peer) Close

func (p *Peer) Close()

func (*Peer) Handshake

func (p *Peer) Handshake(version uint32, networkId uint64) error

func (*Peer) Info

func (p *Peer) Info() *Info

func (*Peer) IsBootstrap

func (p *Peer) IsBootstrap() bool

func (*Peer) IsKnownBlock

func (p *Peer) IsKnownBlock(hash common.Hash) bool

func (*Peer) IsKnownTx

func (p *Peer) IsKnownTx(hash common.Hash) bool

func (*Peer) IsStatic

func (p *Peer) IsStatic() bool

func (*Peer) IsTrusted

func (p *Peer) IsTrusted() bool

func (*Peer) KnownBlock

func (p *Peer) KnownBlock(hash common.Hash)

func (*Peer) KnownTx

func (p *Peer) KnownTx(hash common.Hash)

func (*Peer) Loop

func (p *Peer) Loop()

func (*Peer) Peer

func (p *Peer) Peer() *p2p.Peer

func (*Peer) RW

func (p *Peer) RW() p2p.MsgReadWriter

func (*Peer) RequestTxs

func (p *Peer) RequestTxs() uint32

func (*Peer) Send

func (p *Peer) Send(msgCode uint64, msg interface{}) error

func (*Peer) Sync

func (p *Peer) Sync(t int)

func (*Peer) TxBroadcast

func (p *Peer) TxBroadcast() bool

type Requests

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

type Status

type Status struct {
	Blocks       uint32
	Transactions uint32
	BSync        time.Time
	TSync        time.Time
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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