types

package
v0.0.0-...-7cc22e0 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxPeers int = 8
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockIndex

type BlockIndex uint64

type GetBlock

type GetBlock struct {
	// node that request for block
	Node      string
	BlockHash []byte
}

type GetInv

type GetInv struct {
	NodeId   string
	InvType  InvType
	LastHash []byte
}

type GetNode

type GetNode struct {
	SrcNodes   []*types.Node
	ShareNodes []*types.Node
}

type Inv

type Inv struct {
	NodeId   string
	InvCount int
	InvType  InvType

	// a map contain block index and block hash
	BlocksHash map[BlockIndex][]byte

	TXs []*types.Transaction
}

func NewInv

func NewInv() *Inv

type InvType

type InvType int
const (
	BlockType InvType = iota
	TxType
)

type MsgBlock

type MsgBlock struct {
	Sender string
	Block  *types.Block
	Miner  string
}

func Msgblock

func Msgblock(b *types.Block, sender string, miner string) *MsgBlock

func NewMsgBlock

func NewMsgBlock() *MsgBlock

type MsgTX

type MsgTX struct {
	SenderID string            `json:"sender"`
	TX       types.Transaction `json:"tx"`
}

type MsgUTXOSet

type MsgUTXOSet struct {
	Account types.Account `json:"account"`
	Utxos   []*types.UTXO `json:"utxos"`
}

type PeerSet

type PeerSet struct {
	Peers map[string]*types.Node

	Mu *sync.Mutex
}

func NewPeerSet

func NewPeerSet() *PeerSet

func (*PeerSet) Add

func (p *PeerSet) Add(n *types.Node)

Jump to

Keyboard shortcuts

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