node

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2020 License: Apache-2.0 Imports: 53 Imported by: 0

Documentation

Overview

Copyright © 2019 Annchain Authors <EMAIL ADDRESS>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright © 2019 Annchain Authors <EMAIL ADDRESS>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright © 2019 Annchain Authors <EMAIL ADDRESS>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright © 2019 Annchain Authors <EMAIL ADDRESS>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewP2PServer

func NewP2PServer(privKey *ecdsa.PrivateKey, isBootNode bool) *p2p.Server

func SetupCallbacks

func SetupCallbacks(m *og.MessageRouter, hub *og.Hub)

SetupCallbacks Regist callbacks to handle different messages

func SetupCallbacksOG32

func SetupCallbacksOG32(m *og.MessageRouterOG02, hub *og.Hub)

func StringArrayToIntArray

func StringArrayToIntArray(arr []string) []int

Types

type BootstrapInfoRequest added in v0.0.2

type BootstrapInfoRequest struct {
	NetworkId int64  `json:"networkid"`
	PublicKey string `json:"publickey"`
	ONode     string `json:"onode"`
}

type BootstrapInfoResponse added in v0.0.2

type BootstrapInfoResponse struct {
	Status         string `json:"status"`
	BootstrapNode  bool   `json:"bootstrap_node"`
	BootstrapNodes string `json:"bootstrap_nodes"`
	GenesisPk      string `json:"genesis_pk"`
	Message        string `json:"message"`
	Partners       int    `json:"partners"`
}

type Component

type Component interface {
	Start()
	Stop()
	// Get the component name
	Name() string
}

type Delegate

type Delegate struct {
	TxCreator          *txmaker.OGTxCreator
	ReceivedNewTxsChan chan []types.Txi
	ReceivedNewTxChan  chan types.Txi
	TxPool             *pool.TxPool
	Dag                *core2.Dag
	OnNewTxiGenerated  []chan types.Txi
	InsertSyncBuffer   insertTxsFn
}

func (*Delegate) Announce

func (c *Delegate) Announce(txi types.Txi)

func (*Delegate) GenerateArchive added in v0.0.2

func (c *Delegate) GenerateArchive(data []byte) (tx types.Txi, err error)

func (*Delegate) GenerateSequencer

func (c *Delegate) GenerateSequencer(r SeqRequest) (seq *types.Sequencer, err error)

discarded function

func (*Delegate) GenerateTx

func (c *Delegate) GenerateTx(r ogcore.SignedTxBuildRequest) (tx types.Txi, err error)

func (*Delegate) GetLatestAccountNonce

func (c *Delegate) GetLatestAccountNonce(addr common.Address) (uint64, error)

func (*Delegate) GetLatestDagSequencer

func (c *Delegate) GetLatestDagSequencer() *types.Sequencer

func (*Delegate) GetTxNum added in v0.0.2

func (d *Delegate) GetTxNum() uint32

func (*Delegate) JudgeNonce added in v0.0.7

func (c *Delegate) JudgeNonce(me *account.Account) uint64

func (*Delegate) TooMoreTx added in v0.0.2

func (d *Delegate) TooMoreTx() bool

type Node

type Node struct {
	Components []Component
}

Node is the basic entrypoint for all modules to start.

func NewNode

func NewNode() *Node

func (*Node) Start

func (n *Node) Start()

func (*Node) Stop

func (n *Node) Stop()

type Node2 added in v0.0.7

type Node2 struct {
	PrivateInfoProvider  account.PrivateInfoProvider
	PhysicalCommunicator community.LibP2pPhysicalCommunicator
	// contains filtered or unexported fields
}

Node is the basic entrypoint for all modules to start.

func (*Node2) InitDefault added in v0.0.7

func (n *Node2) InitDefault()

func (*Node2) Setup added in v0.0.7

func (n *Node2) Setup()

type PhysicalCommunicator added in v0.0.7

type PhysicalCommunicator interface {
	Start()
	Stop()
	GetIncomingChannel() chan *WireMessage
	ClosePeer(id string)
	GetNeighbour(id string) (neighbour *Neighbour, err error)
}

type SeqRequest

type SeqRequest struct {
	Issuer     common.Address
	PrivateKey crypto.PrivateKey
	Nonce      uint64
	Height     uint64
}

type TxRequest

type TxRequest struct {
	AddrFrom   common.Address
	AddrTo     common.Address
	PrivateKey crypto.PrivateKey
	Value      *math.BigInt
	Nonce      uint64
	TokenId    int32
}

Jump to

Keyboard shortcuts

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