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.
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.
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.
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
- Variables
- func CreateDB() (ogdb.Database, error)
- func GetOldDb() (ogdb.Database, error)
- func InitLoggers(logger *logrus.Logger, logdir string)
- func Sha256(bytes []byte) []byte
- type ActionTxHandler
- type Announcer
- type ArchiveHandler
- type BodiesRequestHandler
- type BodiesResponseHandler
- type CampaignHandler
- type ConsensusDkgDealHandler
- type ConsensusDkgDealResponseHandler
- type ConsensusDkgGenesisPublicKeyHandler
- type ConsensusDkgSigSetsHandler
- type ConsensusPreCommitHandler
- type ConsensusPreVoteHandler
- type ConsensusProposalHandler
- type ConsensusVerifier
- type ControlMsgCache
- type ControlMsgHandler
- type DataLoader
- type DummyTxPoolMiniTx
- type EncryptionLayer
- type FIFOTipGenerator
- type FetchByHashHandlerRequest
- type FetchByHashResponseHandler
- type GetMsgHandler
- type GetNodeDataMsgHandler
- type GetReceiptsMsgHandler
- type GetStateRoot
- type GraphVerifier
- type HeaderRequestHandler
- type HeaderResponseHandler
- type Hub
- func (h *Hub) BestPeerId() (peerId string, err error)
- func (h *Hub) BestPeerInfo() (peerId string, hash common.Hash, seqId uint64, err error)
- func (h *Hub) BroadcastMessage(messageType p2p_message.MessageType, msg p2p_message.Message)
- func (h *Hub) BroadcastMessageWithFilter(messageType p2p_message.MessageType, msg p2p_message.Message)
- func (h *Hub) BroadcastMessageWithLink(messageType p2p_message.MessageType, msg p2p_message.Message)
- func (h *Hub) GetBenchmarks() map[string]interface{}
- func (h *Hub) GetPeerHead(peerId string) (hash common.Hash, seqId uint64, err error)
- func (h *Hub) Init(config *HubConfig)
- func (h *Hub) MulticastMessage(messageType p2p_message.MessageType, msg p2p_message.Message)
- func (h *Hub) MulticastToSource(messageType p2p_message.MessageType, msg p2p_message.Message, ...)
- func (h *Hub) Name() string
- func (h *Hub) NodeStatus() *NodeStatus
- func (h *Hub) PeersInfo() []*PeerInfo
- func (h *Hub) RelayMessage(msgOut *p2PMessage)
- func (h *Hub) RemovePeer(id string)
- func (h *Hub) RequestBodies(peerId string, hashs common.Hashes) error
- func (h *Hub) RequestOneHeader(peerId string, hash common.Hash) error
- func (h *Hub) SendBytesToPeer(peerId string, messageType p2p_message.MessageType, msg []byte) error
- func (h *Hub) SendGetMsg(peerId string, msg *p2p_message.MessageGetMsg) error
- func (h *Hub) SendToAnynomous(messageType p2p_message.MessageType, msg p2p_message.Message, ...)
- func (h *Hub) SendToPeer(peerId string, messageType p2p_message.MessageType, msg p2p_message.Message) error
- func (h *Hub) SetEncryptionKey(priv *crypto.PrivateKey)
- func (h *Hub) SetPeerHead(peerId string, hash common.Hash, number uint64) error
- func (h *Hub) Start()
- func (h *Hub) Stop()
- type HubConfig
- type IDag
- type ITxPool
- type IncomingMessageHandler
- func (m *IncomingMessageHandler) GetBenchmarks() map[string]interface{}
- func (h *IncomingMessageHandler) HandleBodiesRequest(msgReq *p2p_message.MessageBodiesRequest, peerId string)
- func (h *IncomingMessageHandler) HandleBodiesResponse(request *p2p_message.MessageBodiesResponse, peerId string)
- func (h *IncomingMessageHandler) HandleControlMsg(req *p2p_message.MessageControl, sourceId string)
- func (h *IncomingMessageHandler) HandleFetchByHashRequest(syncRequest *p2p_message.MessageSyncRequest, peerId string)
- func (h *IncomingMessageHandler) HandleGetMsg(msg *p2p_message.MessageGetMsg, sourcePeerId string)
- func (h *IncomingMessageHandler) HandleHeaderRequest(query *p2p_message.MessageHeaderRequest, peerId string)
- func (h *IncomingMessageHandler) HandleHeaderResponse(headerMsg *p2p_message.MessageHeaderResponse, peerId string)
- func (h *IncomingMessageHandler) HandlePing(peerId string)
- func (h *IncomingMessageHandler) HandlePong()
- func (h *IncomingMessageHandler) HandleSequencerHeader(msgHeader *p2p_message.MessageSequencerHeader, peerId string)
- func (h *IncomingMessageHandler) HandleTxsRequest(msgReq *p2p_message.MessageTxsRequest, peerId string)
- func (h *IncomingMessageHandler) HandleTxsResponse(request *p2p_message.MessageTxsResponse)
- func (m *IncomingMessageHandler) Name() string
- func (h *IncomingMessageHandler) RemoveControlMsgFromCache(hash common.Hash)
- func (m *IncomingMessageHandler) Start()
- func (m *IncomingMessageHandler) Stop()
- type IncomingMessageHandlerOG02
- type ManagerConfig
- type MessageCounter
- type MessageRouter
- func (m *MessageRouter) BroadcastMessage(messageType p2p_message.MessageType, message p2p_message.Message)
- func (m *MessageRouter) BroadcastMessageWithLink(messageType p2p_message.MessageType, message p2p_message.Message)
- func (m *MessageRouter) MulticastMessage(messageType p2p_message.MessageType, message p2p_message.Message)
- func (m *MessageRouter) MulticastToSource(messageType p2p_message.MessageType, message p2p_message.Message, ...)
- func (m *MessageRouter) Name() string
- func (m *MessageRouter) RouteActionTx(msg *p2PMessage)
- func (m *MessageRouter) RouteArchive(msg *p2PMessage)
- func (m *MessageRouter) RouteBodiesRequest(msg *p2PMessage)
- func (m *MessageRouter) RouteBodiesResponse(msg *p2PMessage)
- func (m *MessageRouter) RouteCampaign(msg *p2PMessage)
- func (m *MessageRouter) RouteConsensusDkgDeal(msg *p2PMessage)
- func (m *MessageRouter) RouteConsensusDkgDealResponse(msg *p2PMessage)
- func (m *MessageRouter) RouteConsensusDkgGenesisPublicKey(msg *p2PMessage)
- func (m *MessageRouter) RouteConsensusDkgSigSets(msg *p2PMessage)
- func (m *MessageRouter) RouteConsensusPreCommit(msg *p2PMessage)
- func (m *MessageRouter) RouteConsensusPreVote(msg *p2PMessage)
- func (m *MessageRouter) RouteConsensusProposal(msg *p2PMessage)
- func (m *MessageRouter) RouteControlMsg(msg *p2PMessage)
- func (m *MessageRouter) RouteFetchByHashRequest(msg *p2PMessage)
- func (m *MessageRouter) RouteFetchByHashResponse(msg *p2PMessage)
- func (m *MessageRouter) RouteGetMsg(msg *p2PMessage)
- func (m *MessageRouter) RouteHeaderRequest(msg *p2PMessage)
- func (m *MessageRouter) RouteHeaderResponse(msg *p2PMessage)
- func (m *MessageRouter) RouteNewSequencer(msg *p2PMessage)
- func (m *MessageRouter) RouteNewTx(msg *p2PMessage)
- func (m *MessageRouter) RouteNewTxs(msg *p2PMessage)
- func (m *MessageRouter) RoutePing(msg *p2PMessage)
- func (m *MessageRouter) RoutePong(*p2PMessage)
- func (m *MessageRouter) RouteSequencerHeader(msg *p2PMessage)
- func (m *MessageRouter) RouteTermChange(msg *p2PMessage)
- func (m *MessageRouter) RouteTermChangeRequest(msg *p2PMessage)
- func (m *MessageRouter) RouteTermChangeResponse(msg *p2PMessage)
- func (m *MessageRouter) RouteTxsRequest(msg *p2PMessage)
- func (m *MessageRouter) RouteTxsResponse(msg *p2PMessage)
- func (m *MessageRouter) SendToPeer(peerId string, messageType p2p_message.MessageType, msg p2p_message.Message)
- func (m *MessageRouter) Start()
- func (m *MessageRouter) Stop()
- type MessageRouterOG02
- func (m *MessageRouterOG02) Name() string
- func (m *MessageRouterOG02) RouteGetNodeDataMsg(msg *p2PMessage)
- func (m *MessageRouterOG02) RouteGetReceiptsMsg(msg *p2PMessage)
- func (m *MessageRouterOG02) RouteNodeDataMsg(msg *p2PMessage)
- func (m *MessageRouterOG02) Start()
- func (m *MessageRouterOG02) Stop()
- type NewSequencerHandler
- type NewTxHandler
- type NewTxsHandler
- type NodeDataMsgHandler
- type NodeStatus
- type NodeStatusDataProvider
- type OGConfig
- type Og
- type PeerInfo
- type PeerProvider
- type PingHandler
- type PongHandler
- type RequestCache
- type SendingType
- type SequencerHeaderHandler
- type Syncer
- type TermChangeHandler
- type TermChangeRequestHandler
- type TermChangeResponseHandler
- type TipGenerator
- type TxBuffer
- func (d *TxBuffer) Dump() string
- func (d *TxBuffer) DumpKnownCache() string
- func (b *TxBuffer) GetBenchmarks() map[string]interface{}
- func (b *TxBuffer) GetFromAllKnownSource(hash common.Hash) types.Txi
- func (b *TxBuffer) GetFromBuffer(hash common.Hash) types.Txi
- func (b *TxBuffer) GetFromProviders(hash common.Hash) types.Txi
- func (b *TxBuffer) IsCachedHash(hash common.Hash) bool
- func (b *TxBuffer) IsKnownHash(hash common.Hash) bool
- func (b *TxBuffer) IsReceivedHash(hash common.Hash) bool
- func (b *TxBuffer) Name() string
- func (b *TxBuffer) Start()
- func (b *TxBuffer) Stop()
- type TxBufferConfig
- type TxCreator
- func (m *TxCreator) GenerateSequencer(issuer common.Address, Height uint64, accountNonce uint64, ...) (seq *tx_types.Sequencer, genAgain bool)
- func (t *TxCreator) GetArchiveNonce() uint64
- func (m *TxCreator) NewActionTxWithSeal(from common.Address, to common.Address, value *math.BigInt, action byte, ...) (tx types.Txi, err error)
- func (m *TxCreator) NewArchiveWithSeal(data []byte) (tx types.Txi, err error)
- func (m *TxCreator) NewSignedSequencer(issuer common.Address, height uint64, accountNonce uint64, ...) types.Txi
- func (m *TxCreator) NewSignedTx(from common.Address, to common.Address, value *math.BigInt, ...) types.Txi
- func (m *TxCreator) NewTxWithSeal(from common.Address, to common.Address, value *math.BigInt, data []byte, ...) (tx types.Txi, err error)
- func (m *TxCreator) NewUnsignedSequencer(issuer common.Address, Height uint64, accountNonce uint64) *tx_types.Sequencer
- func (m *TxCreator) NewUnsignedTx(from common.Address, to common.Address, value *math.BigInt, ...) types.Txi
- func (m *TxCreator) SealTx(tx types.Txi, priveKey *crypto.PrivateKey) (ok bool)
- func (t *TxCreator) Stop()
- type TxFormatVerifier
- func (v *TxFormatVerifier) Independent() bool
- func (v *TxFormatVerifier) Name() string
- func (t *TxFormatVerifier) SignatureValues(sig []byte) (r, s, v *big.Int, err error)
- func (c *TxFormatVerifier) String() string
- func (v *TxFormatVerifier) Verify(t types.Txi) bool
- func (v *TxFormatVerifier) VerifyHash(t types.Txi) bool
- func (v *TxFormatVerifier) VerifySignature(t types.Txi) bool
- func (v *TxFormatVerifier) VerifySourceAddress(t types.Txi) bool
- type TxsRequestHandler
- type TxsResponseHandler
- type Verifier
Constants ¶
const ( NormalMode uint8 = iota FeedBackMode )
const ( OG01 = 01 OG02 = 02 )
const ( ErrMsgTooLarge = iota ErrDecode ErrInvalidMsgCode ErrProtocolVersionMismatch ErrNetworkIdMismatch ErrGenesisBlockMismatch ErrNoStatusMsg ErrExtraStatusMsg ErrSuspendedPeer )
const (
DuplicateMsgPeerNum = 5
)
const ProtocolMaxMsgSize = 10 * 1024 * 1024 // Maximum cap on the size of a protocol message
Variables ¶
var ProtocolLengths = []p2p_message.MessageType{p2p_message.MessageTypeOg02Length, p2p_message.MessageTypeOg01Length}
ProtocolLengths are the number of implemented message corresponding to different protocol versions.
var ProtocolName = "og"
ProtocolName is the official short name of the protocol used during capability negotiation.
var ProtocolVersions = []uint32{OG02, OG01}
ProtocolVersions are the supported versions of the og protocol (first is primary).
Functions ¶
func InitLoggers ¶
Types ¶
type ActionTxHandler ¶ added in v0.0.2
type ActionTxHandler interface {
HandleActionTx(request *p2p_message.MessageNewActionTx, perid string)
}
type ArchiveHandler ¶ added in v0.0.2
type ArchiveHandler interface {
HandleArchive(request *p2p_message.MessageNewArchive, peerId string)
}
type BodiesRequestHandler ¶
type BodiesRequestHandler interface {
HandleBodiesRequest(msgReq *p2p_message.MessageBodiesRequest, peerID string)
}
type BodiesResponseHandler ¶
type BodiesResponseHandler interface {
HandleBodiesResponse(request *p2p_message.MessageBodiesResponse, peerId string)
}
type CampaignHandler ¶
type CampaignHandler interface {
HandleCampaign(request *p2p_message.MessageCampaign, peerId string)
}
type ConsensusDkgDealHandler ¶
type ConsensusDkgDealHandler interface {
HandleConsensusDkgDeal(request *p2p_message.MessageConsensusDkgDeal, peerId string)
}
type ConsensusDkgDealResponseHandler ¶
type ConsensusDkgDealResponseHandler interface {
HandleConsensusDkgDealResponse(request *p2p_message.MessageConsensusDkgDealResponse, peerId string)
}
type ConsensusDkgGenesisPublicKeyHandler ¶
type ConsensusDkgGenesisPublicKeyHandler interface {
HandleConsensusDkgGenesisPublicKey(request *p2p_message.MessageConsensusDkgGenesisPublicKey, peerId string)
}
type ConsensusDkgSigSetsHandler ¶
type ConsensusDkgSigSetsHandler interface {
HandleConsensusDkgSigSets(request *p2p_message.MessageConsensusDkgSigSets, peerId string)
}
type ConsensusPreCommitHandler ¶
type ConsensusPreCommitHandler interface {
HandleConsensusPreCommit(request *p2p_message.MessagePreCommit, peerId string)
}
type ConsensusPreVoteHandler ¶
type ConsensusPreVoteHandler interface {
HandleConsensusPreVote(request *p2p_message.MessagePreVote, peerId string)
}
type ConsensusProposalHandler ¶
type ConsensusProposalHandler interface {
HandleConsensusProposal(request *p2p_message.MessageProposal, peerId string)
}
type ConsensusVerifier ¶
type ConsensusVerifier struct { VerifyCampaign func(cp *tx_types.Campaign) bool VerifyTermChange func(cp *tx_types.TermChange) bool VerifySequencer func(cp *tx_types.Sequencer) bool }
consensus related verification
func (*ConsensusVerifier) Independent ¶ added in v0.0.2
func (v *ConsensusVerifier) Independent() bool
func (*ConsensusVerifier) Name ¶
func (c *ConsensusVerifier) Name() string
func (*ConsensusVerifier) String ¶ added in v0.0.2
func (c *ConsensusVerifier) String() string
type ControlMsgCache ¶
msg request cache ,don't send duplicate message
func (*ControlMsgCache) Len ¶
func (c *ControlMsgCache) Len() int
type ControlMsgHandler ¶
type ControlMsgHandler interface {
HandleControlMsg(msg *p2p_message.MessageControl, peerId string)
}
type DataLoader ¶
func (*DataLoader) GenerateGenesis ¶
func (d *DataLoader) GenerateGenesis() *tx_types.Sequencer
func (*DataLoader) GenerateGenesisBalance ¶
func (loader *DataLoader) GenerateGenesisBalance() map[common.Address]*math.BigInt
func (*DataLoader) LoadLocalData ¶
func (d *DataLoader) LoadLocalData()
LoadLocalData will load all necessary data (db, status, etc) from local database. If there is no data or data corrupted, rebuild.
func (*DataLoader) Name ¶
func (d *DataLoader) Name() string
func (*DataLoader) Start ¶
func (d *DataLoader) Start()
func (*DataLoader) Stop ¶
func (d *DataLoader) Stop()
type DummyTxPoolMiniTx ¶
type DummyTxPoolMiniTx struct {
// contains filtered or unexported fields
}
func (*DummyTxPoolMiniTx) Add ¶
func (p *DummyTxPoolMiniTx) Add(v types.Txi)
func (*DummyTxPoolMiniTx) GetByNonce ¶ added in v0.0.3
func (*DummyTxPoolMiniTx) GetRandomTips ¶
func (p *DummyTxPoolMiniTx) GetRandomTips(n int) (v []types.Txi)
func (*DummyTxPoolMiniTx) Init ¶
func (d *DummyTxPoolMiniTx) Init()
type EncryptionLayer ¶
type EncryptionLayer interface {
SetEncryptionKey(priv *crypto.PrivateKey)
}
type FIFOTipGenerator ¶
type FIFOTipGenerator struct {
// contains filtered or unexported fields
}
func NewFIFOTIpGenerator ¶
func NewFIFOTIpGenerator(upstream TipGenerator, maxCacheSize int) *FIFOTipGenerator
func (*FIFOTipGenerator) GetByNonce ¶ added in v0.0.3
func (*FIFOTipGenerator) GetRandomTips ¶
func (f *FIFOTipGenerator) GetRandomTips(n int) (v []types.Txi)
type FetchByHashHandlerRequest ¶
type FetchByHashHandlerRequest interface {
HandleFetchByHashRequest(req *p2p_message.MessageSyncRequest, sourceID string)
}
type FetchByHashResponseHandler ¶
type FetchByHashResponseHandler interface {
HandleFetchByHashResponse(resp *p2p_message.MessageSyncResponse, sourceID string)
}
type GetMsgHandler ¶
type GetMsgHandler interface {
HandleGetMsg(msg *p2p_message.MessageGetMsg, peerId string)
}
type GetNodeDataMsgHandler ¶
type GetNodeDataMsgHandler interface {
HandleGetNodeDataMsg(peerId string)
}
type GetReceiptsMsgHandler ¶
type GetReceiptsMsgHandler interface {
HandleGetReceiptsMsg(peerId string)
}
type GetStateRoot ¶ added in v0.0.2
type GraphVerifier ¶
GraphVerifier verifies if the tx meets the OG hash and graph standards.
func (*GraphVerifier) Independent ¶ added in v0.0.2
func (v *GraphVerifier) Independent() bool
func (*GraphVerifier) Name ¶
func (v *GraphVerifier) Name() string
func (*GraphVerifier) String ¶ added in v0.0.2
func (c *GraphVerifier) String() string
func (*GraphVerifier) Verify ¶
func (v *GraphVerifier) Verify(txi types.Txi) (ok bool)
Verify do the graph validation according to the following rules that are marked as [My job]. Graph standards: A1: [My job] Randomly choose 2 tips. A2: [Not used] Node's parent cannot be its grandparents or ancestors. A3: [My job] Nodes produced by same source must be sequential (tx nonce ++). A4: [------] Double spending once A3 is not followed, whatever there is actual double spending. A5: [Pool's job] If A3 is followed but there is still double spending (tx nonce collision), keep the forked tx with smaller hash A6: [My job] Node cannot reference two un-ordered nodes as its parents B1: [My job] Nodes that are confirmed by at least N (=2) sequencers cannot be referenced. B2: [My job] Two layer hash validation Basically Verify checks whether txs are in their nonce order
type HeaderRequestHandler ¶
type HeaderRequestHandler interface {
HandleHeaderRequest(request *p2p_message.MessageHeaderRequest, peerID string)
}
type HeaderResponseHandler ¶
type HeaderResponseHandler interface {
HandleHeaderResponse(headerMsg *p2p_message.MessageHeaderResponse, peerID string)
}
type Hub ¶
type Hub struct { CallbackRegistry map[p2p_message.MessageType]func(*p2PMessage) // All callbacks CallbackRegistryOG02 map[p2p_message.MessageType]func(*p2PMessage) // All callbacks of OG02 StatusDataProvider NodeStatusDataProvider SubProtocols []p2p.Protocol // new peer event OnNewPeerConnected []chan string Downloader *downloader.Downloader Fetcher *fetcher.Fetcher NodeInfo func() *p2p.NodeInfo IsReceivedHash func(hash common.Hash) bool // contains filtered or unexported fields }
Hub is the middle layer between p2p and business layer When there is a general request coming from the upper layer, Hub will find the appropriate peer to handle. When there is a message coming from p2p, Hub will unmarshall this message and give it to message router. Hub will also prevent duplicate requests/responses. If there is any failure, Hub is NOT responsible for changing a peer and retry. (maybe enhanced in the future.) DO NOT INVOLVE ANY BUSINESS LOGICS HERE.
func (*Hub) BestPeerId ¶
func (*Hub) BestPeerInfo ¶
func (*Hub) BroadcastMessage ¶
func (h *Hub) BroadcastMessage(messageType p2p_message.MessageType, msg p2p_message.Message)
BroadcastMessage broadcast to whole network
func (*Hub) BroadcastMessageWithFilter ¶
func (h *Hub) BroadcastMessageWithFilter(messageType p2p_message.MessageType, msg p2p_message.Message)
BroadcastMessage broadcast to whole network
func (*Hub) BroadcastMessageWithLink ¶
func (h *Hub) BroadcastMessageWithLink(messageType p2p_message.MessageType, msg p2p_message.Message)
BroadcastMessage broadcast to whole network
func (*Hub) GetBenchmarks ¶
func (*Hub) GetPeerHead ¶
func (*Hub) MulticastMessage ¶
func (h *Hub) MulticastMessage(messageType p2p_message.MessageType, msg p2p_message.Message)
MulticastMessage multicast message to some peer
func (*Hub) MulticastToSource ¶
func (h *Hub) MulticastToSource(messageType p2p_message.MessageType, msg p2p_message.Message, sourceMsgHash *common.Hash)
MulticastToSource multicast msg to source , for example , send tx request to the peer which hash the tx
func (*Hub) NodeStatus ¶
func (h *Hub) NodeStatus() *NodeStatus
NodeInfo retrieves some protocol metadata about the running host node.
func (*Hub) RelayMessage ¶
func (h *Hub) RelayMessage(msgOut *p2PMessage)
func (*Hub) RemovePeer ¶
func (*Hub) RequestOneHeader ¶
func (*Hub) SendBytesToPeer ¶
func (h *Hub) SendBytesToPeer(peerId string, messageType p2p_message.MessageType, msg []byte) error
func (*Hub) SendGetMsg ¶
func (h *Hub) SendGetMsg(peerId string, msg *p2p_message.MessageGetMsg) error
func (*Hub) SendToAnynomous ¶
func (h *Hub) SendToAnynomous(messageType p2p_message.MessageType, msg p2p_message.Message, anyNomousPubKey *crypto.PublicKey)
SendToAnynomous send msg by Anynomous
func (*Hub) SendToPeer ¶
func (h *Hub) SendToPeer(peerId string, messageType p2p_message.MessageType, msg p2p_message.Message) error
func (*Hub) SetEncryptionKey ¶
func (h *Hub) SetEncryptionKey(priv *crypto.PrivateKey)
func (*Hub) SetPeerHead ¶
SetPeerHead is just a hack to set the latest seq number known of the peer This value ought not to be stored in peer, but an outside map. This has nothing related to p2p.
type HubConfig ¶
type HubConfig struct { OutgoingBufferSize int IncomingBufferSize int MessageCacheMaxSize int MessageCacheExpirationSeconds int MaxPeers int BroadCastMode uint8 DisableEncryptGossip bool }
func DefaultHubConfig ¶
func DefaultHubConfig() HubConfig
type IDag ¶
type IDag interface { GetTx(hash common.Hash) types.Txi GetTxByNonce(addr common.Address, nonce uint64) types.Txi GetSequencerByHeight(id uint64) *tx_types.Sequencer GetTxisByNumber(id uint64) types.Txis LatestSequencer() *tx_types.Sequencer GetSequencer(hash common.Hash, id uint64) *tx_types.Sequencer Genesis() *tx_types.Sequencer GetHeight() uint64 GetSequencerByHash(hash common.Hash) *tx_types.Sequencer GetBalance(addr common.Address, tokenID int32) *math.BigInt GetLatestNonce(addr common.Address) (uint64, error) }
type ITxPool ¶
type ITxPool interface { Get(hash common.Hash) types.Txi AddRemoteTx(tx types.Txi, noFeedBack bool) error RegisterOnNewTxReceived(c chan types.Txi, name string, allTx bool) GetLatestNonce(addr common.Address) (uint64, error) IsLocalHash(hash common.Hash) bool GetMaxWeight() uint64 GetByNonce(addr common.Address, nonce uint64) types.Txi IsBadSeq(seq *tx_types.Sequencer) error }
type IncomingMessageHandler ¶
type IncomingMessageHandler struct { Og *Og Hub *Hub TxEnable func() bool // contains filtered or unexported fields }
IncomingMessageHandler is the default handler of all incoming messages for OG
func NewIncomingMessageHandler ¶
func NewIncomingMessageHandler(og *Og, hub *Hub, cacheSize int, expireTime time.Duration) *IncomingMessageHandler
NewIncomingMessageHandler
func (*IncomingMessageHandler) GetBenchmarks ¶
func (m *IncomingMessageHandler) GetBenchmarks() map[string]interface{}
func (*IncomingMessageHandler) HandleBodiesRequest ¶
func (h *IncomingMessageHandler) HandleBodiesRequest(msgReq *p2p_message.MessageBodiesRequest, peerId string)
func (*IncomingMessageHandler) HandleBodiesResponse ¶
func (h *IncomingMessageHandler) HandleBodiesResponse(request *p2p_message.MessageBodiesResponse, peerId string)
func (*IncomingMessageHandler) HandleControlMsg ¶
func (h *IncomingMessageHandler) HandleControlMsg(req *p2p_message.MessageControl, sourceId string)
func (*IncomingMessageHandler) HandleFetchByHashRequest ¶
func (h *IncomingMessageHandler) HandleFetchByHashRequest(syncRequest *p2p_message.MessageSyncRequest, peerId string)
func (*IncomingMessageHandler) HandleGetMsg ¶
func (h *IncomingMessageHandler) HandleGetMsg(msg *p2p_message.MessageGetMsg, sourcePeerId string)
func (*IncomingMessageHandler) HandleHeaderRequest ¶
func (h *IncomingMessageHandler) HandleHeaderRequest(query *p2p_message.MessageHeaderRequest, peerId string)
func (*IncomingMessageHandler) HandleHeaderResponse ¶
func (h *IncomingMessageHandler) HandleHeaderResponse(headerMsg *p2p_message.MessageHeaderResponse, peerId string)
func (*IncomingMessageHandler) HandlePing ¶
func (h *IncomingMessageHandler) HandlePing(peerId string)
func (*IncomingMessageHandler) HandlePong ¶
func (h *IncomingMessageHandler) HandlePong()
func (*IncomingMessageHandler) HandleSequencerHeader ¶
func (h *IncomingMessageHandler) HandleSequencerHeader(msgHeader *p2p_message.MessageSequencerHeader, peerId string)
func (*IncomingMessageHandler) HandleTxsRequest ¶
func (h *IncomingMessageHandler) HandleTxsRequest(msgReq *p2p_message.MessageTxsRequest, peerId string)
func (*IncomingMessageHandler) HandleTxsResponse ¶
func (h *IncomingMessageHandler) HandleTxsResponse(request *p2p_message.MessageTxsResponse)
func (*IncomingMessageHandler) Name ¶
func (m *IncomingMessageHandler) Name() string
func (*IncomingMessageHandler) RemoveControlMsgFromCache ¶
func (h *IncomingMessageHandler) RemoveControlMsgFromCache(hash common.Hash)
func (*IncomingMessageHandler) Start ¶
func (m *IncomingMessageHandler) Start()
func (*IncomingMessageHandler) Stop ¶
func (m *IncomingMessageHandler) Stop()
type IncomingMessageHandlerOG02 ¶
IncomingMessageHandler is the default handler of all incoming messages for OG
func (*IncomingMessageHandlerOG02) HandleGetNodeDataMsg ¶
func (h *IncomingMessageHandlerOG02) HandleGetNodeDataMsg(peerId string)
func (*IncomingMessageHandlerOG02) HandleGetReceiptsMsg ¶
func (h *IncomingMessageHandlerOG02) HandleGetReceiptsMsg(peerId string)
func (*IncomingMessageHandlerOG02) HandleNodeDataMsg ¶
func (h *IncomingMessageHandlerOG02) HandleNodeDataMsg(peerId string)
type ManagerConfig ¶
type MessageCounter ¶
type MessageCounter struct {
// contains filtered or unexported fields
}
type MessageRouter ¶
type MessageRouter struct { Hub *Hub PingHandler PingHandler PongHandler PongHandler FetchByHashRequestHandler FetchByHashHandlerRequest FetchByHashResponseHandler FetchByHashResponseHandler NewTxHandler NewTxHandler NewTxsHandler NewTxsHandler NewSequencerHandler NewSequencerHandler GetMsgHandler GetMsgHandler ControlMsgHandler ControlMsgHandler SequencerHeaderHandler SequencerHeaderHandler BodiesRequestHandler BodiesRequestHandler BodiesResponseHandler BodiesResponseHandler TxsRequestHandler TxsRequestHandler TxsResponseHandler TxsResponseHandler HeaderRequestHandler HeaderRequestHandler HeaderResponseHandler HeaderResponseHandler CampaignHandler CampaignHandler TermChangeHandler TermChangeHandler ArchiveHandler ArchiveHandler ActionTxHandler ActionTxHandler ConsensusDkgDealHandler ConsensusDkgDealHandler ConsensusDkgDealResponseHandler ConsensusDkgDealResponseHandler ConsensusDkgSigSetsHandler ConsensusDkgSigSetsHandler ConsensusDkgGenesisPublicKeyHandler ConsensusDkgGenesisPublicKeyHandler ConsensusProposalHandler ConsensusProposalHandler ConsensusPreVoteHandler ConsensusPreVoteHandler ConsensusPreCommitHandler ConsensusPreCommitHandler TermChangeRequestHandler TermChangeRequestHandler TermChangeResponseHandler TermChangeResponseHandler }
MessageRouter is a bridge between hub and components
func (*MessageRouter) BroadcastMessage ¶
func (m *MessageRouter) BroadcastMessage(messageType p2p_message.MessageType, message p2p_message.Message)
BroadcastMessage send message to all peers
func (*MessageRouter) BroadcastMessageWithLink ¶
func (m *MessageRouter) BroadcastMessageWithLink(messageType p2p_message.MessageType, message p2p_message.Message)
func (*MessageRouter) MulticastMessage ¶
func (m *MessageRouter) MulticastMessage(messageType p2p_message.MessageType, message p2p_message.Message)
MulticastMessage send message to a randomly chosen peer
func (*MessageRouter) MulticastToSource ¶
func (m *MessageRouter) MulticastToSource(messageType p2p_message.MessageType, message p2p_message.Message, sourceMsgHash *common.Hash)
func (*MessageRouter) Name ¶
func (m *MessageRouter) Name() string
func (*MessageRouter) RouteActionTx ¶ added in v0.0.2
func (m *MessageRouter) RouteActionTx(msg *p2PMessage)
func (*MessageRouter) RouteArchive ¶ added in v0.0.2
func (m *MessageRouter) RouteArchive(msg *p2PMessage)
func (*MessageRouter) RouteBodiesRequest ¶
func (m *MessageRouter) RouteBodiesRequest(msg *p2PMessage)
func (*MessageRouter) RouteBodiesResponse ¶
func (m *MessageRouter) RouteBodiesResponse(msg *p2PMessage)
func (*MessageRouter) RouteCampaign ¶
func (m *MessageRouter) RouteCampaign(msg *p2PMessage)
func (*MessageRouter) RouteConsensusDkgDeal ¶
func (m *MessageRouter) RouteConsensusDkgDeal(msg *p2PMessage)
func (*MessageRouter) RouteConsensusDkgDealResponse ¶
func (m *MessageRouter) RouteConsensusDkgDealResponse(msg *p2PMessage)
func (*MessageRouter) RouteConsensusDkgGenesisPublicKey ¶
func (m *MessageRouter) RouteConsensusDkgGenesisPublicKey(msg *p2PMessage)
func (*MessageRouter) RouteConsensusDkgSigSets ¶
func (m *MessageRouter) RouteConsensusDkgSigSets(msg *p2PMessage)
func (*MessageRouter) RouteConsensusPreCommit ¶
func (m *MessageRouter) RouteConsensusPreCommit(msg *p2PMessage)
func (*MessageRouter) RouteConsensusPreVote ¶
func (m *MessageRouter) RouteConsensusPreVote(msg *p2PMessage)
func (*MessageRouter) RouteConsensusProposal ¶
func (m *MessageRouter) RouteConsensusProposal(msg *p2PMessage)
func (*MessageRouter) RouteControlMsg ¶
func (m *MessageRouter) RouteControlMsg(msg *p2PMessage)
func (*MessageRouter) RouteFetchByHashRequest ¶
func (m *MessageRouter) RouteFetchByHashRequest(msg *p2PMessage)
func (*MessageRouter) RouteFetchByHashResponse ¶
func (m *MessageRouter) RouteFetchByHashResponse(msg *p2PMessage)
func (*MessageRouter) RouteGetMsg ¶
func (m *MessageRouter) RouteGetMsg(msg *p2PMessage)
func (*MessageRouter) RouteHeaderRequest ¶
func (m *MessageRouter) RouteHeaderRequest(msg *p2PMessage)
func (*MessageRouter) RouteHeaderResponse ¶
func (m *MessageRouter) RouteHeaderResponse(msg *p2PMessage)
func (*MessageRouter) RouteNewSequencer ¶
func (m *MessageRouter) RouteNewSequencer(msg *p2PMessage)
func (*MessageRouter) RouteNewTx ¶
func (m *MessageRouter) RouteNewTx(msg *p2PMessage)
func (*MessageRouter) RouteNewTxs ¶
func (m *MessageRouter) RouteNewTxs(msg *p2PMessage)
func (*MessageRouter) RoutePing ¶
func (m *MessageRouter) RoutePing(msg *p2PMessage)
func (*MessageRouter) RoutePong ¶
func (m *MessageRouter) RoutePong(*p2PMessage)
func (*MessageRouter) RouteSequencerHeader ¶
func (m *MessageRouter) RouteSequencerHeader(msg *p2PMessage)
func (*MessageRouter) RouteTermChange ¶
func (m *MessageRouter) RouteTermChange(msg *p2PMessage)
func (*MessageRouter) RouteTermChangeRequest ¶
func (m *MessageRouter) RouteTermChangeRequest(msg *p2PMessage)
func (*MessageRouter) RouteTermChangeResponse ¶
func (m *MessageRouter) RouteTermChangeResponse(msg *p2PMessage)
func (*MessageRouter) RouteTxsRequest ¶
func (m *MessageRouter) RouteTxsRequest(msg *p2PMessage)
func (*MessageRouter) RouteTxsResponse ¶
func (m *MessageRouter) RouteTxsResponse(msg *p2PMessage)
func (*MessageRouter) SendToPeer ¶ added in v0.0.3
func (m *MessageRouter) SendToPeer(peerId string, messageType p2p_message.MessageType, msg p2p_message.Message)
func (*MessageRouter) Start ¶
func (m *MessageRouter) Start()
func (*MessageRouter) Stop ¶
func (m *MessageRouter) Stop()
type MessageRouterOG02 ¶
type MessageRouterOG02 struct { GetNodeDataMsgHandler GetNodeDataMsgHandler NodeDataMsgHandler NodeDataMsgHandler GetReceiptsMsgHandler GetReceiptsMsgHandler }
func (*MessageRouterOG02) Name ¶
func (m *MessageRouterOG02) Name() string
func (*MessageRouterOG02) RouteGetNodeDataMsg ¶
func (m *MessageRouterOG02) RouteGetNodeDataMsg(msg *p2PMessage)
func (*MessageRouterOG02) RouteGetReceiptsMsg ¶
func (m *MessageRouterOG02) RouteGetReceiptsMsg(msg *p2PMessage)
func (*MessageRouterOG02) RouteNodeDataMsg ¶
func (m *MessageRouterOG02) RouteNodeDataMsg(msg *p2PMessage)
func (*MessageRouterOG02) Start ¶
func (m *MessageRouterOG02) Start()
func (*MessageRouterOG02) Stop ¶
func (m *MessageRouterOG02) Stop()
type NewSequencerHandler ¶
type NewSequencerHandler interface {
HandleNewSequencer(msg *p2p_message.MessageNewSequencer, peerId string)
}
type NewTxHandler ¶
type NewTxHandler interface {
HandleNewTx(msg *p2p_message.MessageNewTx, peerId string)
}
type NewTxsHandler ¶
type NewTxsHandler interface {
HandleNewTxs(newTxs *p2p_message.MessageNewTxs, peerId string)
}
type NodeDataMsgHandler ¶
type NodeDataMsgHandler interface {
HandleNodeDataMsg(peerId string)
}
type NodeStatus ¶
type NodeStatus struct { Network uint64 `json:"network"` // OG network ID (1=Frontier, 2=Morden, Ropsten=3, Rinkeby=4) Difficulty *big.Int `json:"difficulty"` // Total difficulty of the host's blockchain Genesis common.Hash `json:"genesis"` // SHA3 hash of the host's genesis block Head common.Hash `json:"head"` // SHA3 hash of the host's best owned block }
NodeInfo represents a short summary of the OG sub-protocol metadata known about the host peer.
type NodeStatusDataProvider ¶
type NodeStatusDataProvider interface { GetCurrentNodeStatus() p2p_message.StatusData GetHeight() uint64 }
type OGConfig ¶
func DefaultOGConfig ¶
func DefaultOGConfig() OGConfig
type Og ¶
type Og struct { Dag *core.Dag TxPool *core.TxPool Manager *MessageRouter TxBuffer *TxBuffer NewLatestSequencerCh chan bool //for broadcasting new latest sequencer to record height NetworkId uint64 // contains filtered or unexported fields }
func (*Og) BroadcastLatestSequencer ¶
func (og *Og) BroadcastLatestSequencer()
BroadcastLatestSequencer broadcast the newest sequencer header , seuqencer header is a network state , representing peer's height other peers will know our height and know whether thy were updated and sync with the best height
func (*Og) GetCurrentNodeStatus ¶
func (og *Og) GetCurrentNodeStatus() p2p_message.StatusData
func (*Og) GetSequencerByHash ¶
type PeerInfo ¶
type PeerInfo struct { Version int `json:"version"` // Ethereum protocol version negotiated SequencerId uint64 `json:"sequencer_id"` // Total difficulty of the peer's blockchain Head string `json:"head"` // SHA3 hash of the peer's best owned block ShortId string `json:"short_id"` Link bool `json:"link"` Addrs string `json:"addrs"` InBound bool `json:"in_bound"` }
type PeerProvider ¶
type PingHandler ¶
type PingHandler interface {
HandlePing(peerId string)
}
type PongHandler ¶
type PongHandler interface {
HandlePong()
}
type RequestCache ¶
type RequestCache struct {
// contains filtered or unexported fields
}
type SendingType ¶
type SendingType uint8
type SequencerHeaderHandler ¶
type SequencerHeaderHandler interface {
HandleSequencerHeader(msgHeader *p2p_message.MessageSequencerHeader, peerId string)
}
type TermChangeHandler ¶
type TermChangeHandler interface {
HandleTermChange(request *p2p_message.MessageTermChange, peerId string)
}
type TermChangeRequestHandler ¶
type TermChangeRequestHandler interface {
HandleTermChangeRequest(request *p2p_message.MessageTermChangeRequest, peerId string)
}
type TermChangeResponseHandler ¶
type TermChangeResponseHandler interface {
HandleTermChangeResponse(request *p2p_message.MessageTermChangeResponse, peerId string)
}
type TipGenerator ¶
type TxBuffer ¶
type TxBuffer struct { Verifiers []Verifier Syncer Syncer Announcer Announcer SelfGeneratedNewTxChan chan types.Txi ReceivedNewTxChan chan types.Txi ReceivedNewTxsChan chan []types.Txi OnProposalSeqCh chan common.Hash //children *childrenCache //key : phash ,value : //HandlingQueue txQueue TestNoVerify bool // contains filtered or unexported fields }
TxBuffer rebuild graph by buffering newly incoming txs and find their parents. Tx will be buffered here until parents are got. Once the parents are got, Tx will be send to TxPool for further processing.
func NewTxBuffer ¶
func NewTxBuffer(config TxBufferConfig) *TxBuffer
func (*TxBuffer) DumpKnownCache ¶ added in v0.0.3
func (*TxBuffer) GetBenchmarks ¶
func (*TxBuffer) GetFromAllKnownSource ¶
func (*TxBuffer) IsKnownHash ¶
isKnownHash tests if the tx is ever heard of, either in local or in buffer. if tx is known, do not broadcast anymore
type TxBufferConfig ¶
type TxCreator ¶
type TxCreator struct { Miner miner.Miner TipGenerator TipGenerator // usually tx_pool MaxTxHash common.Hash // The difficultiy of TxHash MaxMinedHash common.Hash // The difficultiy of MinedHash MaxConnectingTries int // Max number of times to find a pair of parents. If exceeded, try another nonce. DebugNodeId int // Only for debug. This value indicates tx sender and is temporarily saved to tx.height GraphVerifier Verifier // To verify the graph structure NoVerifyMindHash bool NoVerifyMaxTxHash bool GetStateRoot GetStateRoot TxFormatVerifier TxFormatVerifier // contains filtered or unexported fields }
TxCreator creates tx and do the signing and mining
func (*TxCreator) GenerateSequencer ¶
func (*TxCreator) GetArchiveNonce ¶ added in v0.0.2
func (*TxCreator) NewActionTxWithSeal ¶ added in v0.0.2
func (*TxCreator) NewArchiveWithSeal ¶ added in v0.0.2
func (*TxCreator) NewSignedSequencer ¶
func (m *TxCreator) NewSignedSequencer(issuer common.Address, height uint64, accountNonce uint64, privateKey crypto.PrivateKey) types.Txi
NewSignedSequencer this function is for test
func (*TxCreator) NewSignedTx ¶
func (*TxCreator) NewTxWithSeal ¶
func (*TxCreator) NewUnsignedSequencer ¶
func (*TxCreator) NewUnsignedTx ¶
type TxFormatVerifier ¶
type TxFormatVerifier struct { MaxTxHash common.Hash // The difficulty of TxHash MaxMinedHash common.Hash // The difficulty of MinedHash NoVerifyMindHash bool NoVerifyMaxTxHash bool NoVerifySignatrue bool }
func (*TxFormatVerifier) Independent ¶ added in v0.0.2
func (v *TxFormatVerifier) Independent() bool
func (*TxFormatVerifier) Name ¶
func (v *TxFormatVerifier) Name() string
func (*TxFormatVerifier) SignatureValues ¶ added in v0.0.2
func (t *TxFormatVerifier) SignatureValues(sig []byte) (r, s, v *big.Int, err error)
SignatureValues returns signature values. This signature needs to be in the [R || S || V] format where V is 0 or 1.
func (*TxFormatVerifier) String ¶ added in v0.0.2
func (c *TxFormatVerifier) String() string
func (*TxFormatVerifier) VerifyHash ¶
func (v *TxFormatVerifier) VerifyHash(t types.Txi) bool
func (*TxFormatVerifier) VerifySignature ¶
func (v *TxFormatVerifier) VerifySignature(t types.Txi) bool
func (*TxFormatVerifier) VerifySourceAddress ¶
func (v *TxFormatVerifier) VerifySourceAddress(t types.Txi) bool
type TxsRequestHandler ¶
type TxsRequestHandler interface {
HandleTxsRequest(msgReq *p2p_message.MessageTxsRequest, peerID string)
}
type TxsResponseHandler ¶
type TxsResponseHandler interface {
HandleTxsResponse(request *p2p_message.MessageTxsResponse)
}