block

package
v3.8.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2020 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TIMER_FAST_SYNC_LAST_BLOCK_NUMBER   = 2
	TIMER_NORMAL_SYNC_LAST_BLOCK_NUMBER = 4
	TIMER_CHECK_SYNC_LAST_BLOCK_NUMBER  = 20

	TIMER_SYNC_STATE_CHECK  = 5
	TIMER_SYNC_STATE_CHECK1 = 1

	TIMER_HEADER_SYNC = 2
	TIMER_BLOCK_SYNC  = 2

	TIMER_CATCHUP   = 2
	CATCHUP_COUNTER = 10

	TIMER_HEADER_UPDATE_CHECK = 1

	SYNC_BLOCK_BUNDLE     = 60
	SYNC_BLOCK_BUNDLE_MAX = 200

	SYNC_HEADER_BUNDLE = 3
)

DO NOT EDIT

View Source
const (
	STATE_SYNCING = 0
	STATE_CATCHUP = 1
	STATE_NORMAL  = 2
)

DO NOT EDIT

View Source
const (
	SET_SYNC_NULL   = 0
	SET_SYNC_HEADER = 1
	SET_SYNC_BLOCK  = 2
)

DO NOT EDIT

View Source
const (
	CATCHUP_COMPLETE = 0
	CATCHUP_DOING    = 1
)

DO NOT EDIT

View Source
const (
	BLOCK_REQ = 1
	//BLOCK_INFO update or response
	BLOCK_UPDATE = 2

	LAST_BLOCK_NUMBER_REQ = 3
	LAST_BLOCK_NUMBER_RSP = 4

	BLOCK_HEADER_REQ = 5
	BLOCK_HEADER_RSP = 6

	BLOCK_HEADER_UPDATE = 7

	BLOCK_CATCH_REQUEST  = 8
	BLOCK_CATCH_RESPONSE = 9
)

DO NOT EDIT

View Source
const (
	//WAIT_TIME wait for actors ready
	WAIT_TIME = 20
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

type Block struct {
	S *synchronizes
	// contains filtered or unexported fields
}

Block sync block with peer and send up to block actor

func MakeBlock

func MakeBlock(chain chain.BlockChainInterface, nodeType bool) *Block

MakeBlock new instance

func (*Block) Dispatch

func (b *Block) Dispatch(index uint16, p *p2p.Packet)

Dispatch peer message process

func (*Block) GetSyncState

func (b *Block) GetSyncState() bool

GetSyncState get current synchronize status

func (*Block) SendNewBlock

func (b *Block) SendNewBlock(notify *message.NotifyBlock)

SendNewBlock send out a new block

func (*Block) SetActor

func (b *Block) SetActor(tid *actor.PID)

SetActor set chain actor id

func (*Block) Start

func (b *Block) Start()

Start start

func (*Block) UpdateHeadNumber

func (b *Block) UpdateHeadNumber()

func (*Block) UpdateNumber

func (b *Block) UpdateNumber()

Jump to

Keyboard shortcuts

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