tangle

package
v0.0.0-...-9e21bb5 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2018 License: AGPL-3.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	P_TIP_REPLY = 25
	P_BROADCAST = 10
)
View Source
const (
	COO_ADDRESS  = "KPWCHICGJZXKE9GSUDXZYUAPLHAKAHYHDXNPHENTERYMMBQOPSQIDENXKLKCEYCPVTZQLEEJVYJZV9BWU"
	COO_ADDRESS2 = "999999999999999999999999999999999999999999999999999999999999999999999999999999999"
)
View Source
const (
	MWM = 14

	TRYTES_SIZE     = 2673
	PACKET_SIZE     = 1650
	REQ_HASH_SIZE   = 46
	HASH_SIZE       = 49 // This is not "46" on purpose, because all hashes in the DB are stored with length 49
	DATA_SIZE       = PACKET_SIZE - REQ_HASH_SIZE
	TX_TRITS_LENGTH = 8019
)
View Source
const (
	MinTipselDepth = 3
	MaxTipselDepth = 7
	MaxCheckDepth  = 70
	MaxTipAge      = MaxTipselDepth * time.Duration(40) * time.Second
	MaxTXAge       = time.Duration(60) * time.Second
)
View Source
const (
	UNKNOWN_CHECK_INTERVAL = time.Duration(60) * time.Second
)

Variables

View Source
var (
	COO_ADDRESS_BYTES  = convert.TrytesToBytes(COO_ADDRESS)[:49]
	COO_ADDRESS2_BYTES = convert.TrytesToBytes(COO_ADDRESS2)[:49]

	LatestMilestone     Milestone // TODO: Access latest milestone only via GetLatestMilestone()
	LatestMilestoneLock = &sync.RWMutex{}
)
View Source
var (
	PendingRequests     map[string]*PendingRequest
	PendingRequestsLock = &sync.RWMutex{}
)
View Source
var (
	LastIncomingTime     map[string]time.Time
	LastIncomingTimeLock = &sync.RWMutex{}
	RequestQueues        map[string]*RequestQueue
	RequestQueuesLock    = &sync.RWMutex{}
)
View Source
var (
	Tips     = make(map[string]time.Time) // []byte = Hash, time.Time = ReceiveTimestamp
	TipsLock = &sync.RWMutex{}
)

Functions

func Broadcast

func Broadcast(data []byte, excludeNeighbor *server.Neighbor) int

func End

func End()

func GetMilestoneKeyByIndex

func GetMilestoneKeyByIndex(index int, acceptNearest bool) []byte

* Returns the (hash) key for a specific milestone. if acceptNearest is set, the nearest, more recent milestone is returned, if the other is not found.

func GetTXToApprove

func GetTXToApprove(reference []byte, depth int) ([][]byte, error)

func LoadMissingMilestonesFromFile

func LoadMissingMilestonesFromFile(path string) error

TODO: remove this? Or add an API interface?

func Report

func Report()

func SaveTX

func SaveTX(tx *transaction.FastTX, raw *[]byte, dbTx db.Transaction) (e error)

func Start

func Start()

Types

type GraphNode

type GraphNode struct {
	Key      []byte
	Children []*GraphNode
	Count    int64
	Valid    bool
	Tx       *transaction.FastTX
}

type GraphRating

type GraphRating struct {
	Rating int
	Graph  *GraphNode
}

type IncomingTX

type IncomingTX struct {
	TX       *transaction.FastTX
	Neighbor *server.Neighbor
	Bytes    *[]byte
}

type Message

type Message struct {
	Bytes     *[]byte
	Requested *[]byte
	Neighbor  *server.Neighbor
}

type Milestone

type Milestone struct {
	TX    *transaction.FastTX
	Index int
}

func GetLatestMilestone

func GetLatestMilestone() *Milestone

type PendingConfirmation

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

type PendingMilestone

type PendingMilestone struct {
	Key         []byte
	TX2BytesKey []byte
}

type PendingRequest

type PendingRequest struct {
	Hash      []byte
	Timestamp int
	LastTried time.Time
	Neighbor  *server.Neighbor
}

type Request

type Request struct {
	Requested []byte
	Tip       bool
}

type RequestQueue

type RequestQueue chan *Request

Jump to

Keyboard shortcuts

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