Documentation ¶
Index ¶
- Constants
- func MakeSigChainTransaction(wallet *vault.Wallet, sigChain []byte) (*transaction.Transaction, error)
- func NewBacktrackSigChainMessage(sigChainElems []*pb.SigChainElem, hash []byte) (*pb.UnsignedMessage, error)
- func NewGetBlockHeadersMessage(startHeight, endHeight uint32) (*pb.UnsignedMessage, error)
- func NewGetBlockHeadersReply(headers []*block.Header) (*pb.UnsignedMessage, error)
- func NewGetBlocksMessage(startHeight, endHeight uint32) (*pb.UnsignedMessage, error)
- func NewGetBlocksReply(blocks []*block.Block) (*pb.UnsignedMessage, error)
- func NewGetStateMessage(hashes []common.Uint256) (*pb.UnsignedMessage, error)
- func NewGetStatesReply(nodes [][]byte) (*pb.UnsignedMessage, error)
- func NewIHaveSignatureChainTransactionMessage(height uint32, sigHash []byte) (*pb.UnsignedMessage, error)
- func NewPinSigChainMessage(hash []byte) (*pb.UnsignedMessage, error)
- func NewRelayMessage(srcIdentifier string, srcPubkey, destID, payload, blockHash, lastHash []byte, ...) (*pb.UnsignedMessage, error)
- func NewReqAddrNonceMessage() (*pb.UnsignedMessage, error)
- func NewReqSyncAddrTxnMessage(addr []byte, nonce uint64) (*pb.UnsignedMessage, error)
- func NewReqSyncTxnPoolMessage(tp *pool.TxnPool) (*pb.UnsignedMessage, error)
- func NewReqTxnPoolHashMessage() (*pb.UnsignedMessage, error)
- func NewRequestSignatureChainTransactionMessage(sigHash []byte) (*pb.UnsignedMessage, error)
- func NewRequestSignatureChainTransactionReply(transaction *transaction.Transaction) (*pb.UnsignedMessage, error)
- func NewRplAddrNonceMessage(tp *pool.TxnPool) (*pb.UnsignedMessage, error)
- func NewRplSyncAddrTxnMessage(reqMsg *pb.AddrNonce, tp *pool.TxnPool) (*pb.UnsignedMessage, error)
- func NewRplSyncTxnPoolMessage(reqMsg *pb.RequestSyncTxnPool, tp *pool.TxnPool) (*pb.UnsignedMessage, error)
- func NewRplTxnPoolHashMessage(tp *pool.TxnPool) (*pb.UnsignedMessage, error)
- func NewTransactionsMessage(transactions []*transaction.Transaction) (*pb.UnsignedMessage, error)
- func ShouldRejectAddr(localAddr, remoteAddr string) bool
- type ChordInfo
- type ChordRemoteNodeInfo
- type LocalNode
- func (localNode *LocalNode) BroadcastTransaction(txn *transaction.Transaction) error
- func (localNode *LocalNode) CheckIDChange(v interface{})
- func (localNode *LocalNode) ComputeSharedKey(remotePublicKey []byte) (*[node.SharedKeySize]byte, error)
- func (hc LocalNode) ExistHash(hash common.Uint256) bool
- func (localNode *LocalNode) FindSuccessorAddrs(key []byte, numSucc int) ([]string, error)
- func (localNode *LocalNode) FindWsAddr(key []byte) (string, string, []byte, []byte, error)
- func (localNode *LocalNode) FindWssAddr(key []byte) (string, string, []byte, []byte, error)
- func (localNode *LocalNode) GetChordInfo() node.IChordInfo
- func (nm LocalNode) GetConnectionCnt() uint
- func (localNode *LocalNode) GetGossipNeighbors(filter func(*node.RemoteNode) bool) []*node.RemoteNode
- func (localNode *LocalNode) GetHeight() uint32
- func (localNode *LocalNode) GetNeighborBlockHeaders(remoteNode *node.RemoteNode, startHeight, endHeight uint32) ([]*block.Header, error)
- func (localNode *LocalNode) GetNeighborBlocks(remoteNode *node.RemoteNode, startHeight, endHeight uint32) ([]*block.Block, error)
- func (localNode *LocalNode) GetNeighborByNNetNode(nnetRemoteNode *nnetnode.RemoteNode) *node.RemoteNode
- func (nm LocalNode) GetNeighborHeights() ([]uint32, uint)
- func (localNode *LocalNode) GetNeighborInfo() []*node.RemoteNode
- func (nm LocalNode) GetNeighborNode(id string) *node.RemoteNode
- func (localNode *LocalNode) GetNeighborStates(remoteNode *node.RemoteNode, hashes []common.Uint256) ([][]byte, error)
- func (nm LocalNode) GetNeighbors(filter func(*node.RemoteNode) bool) []*node.RemoteNode
- func (localNode *LocalNode) GetNeighborsMajorityStateRootByHeight(height uint32, neighbors []*node.RemoteNode) common.Uint256
- func (localNode *LocalNode) GetNnet() *nnet.NNet
- func (localNode *LocalNode) GetProposalSubmitted() uint32
- func (localNode *LocalNode) GetRelayMessageCount() uint64
- func (localNode *LocalNode) GetSyncState() pb.SyncState
- func (localNode *LocalNode) GetTxnPool() *pool.TxnPool
- func (localNode *LocalNode) GetVotingNeighbors(filter func(*node.RemoteNode) bool) []*node.RemoteNode
- func (localNode *LocalNode) GetWsAddr() string
- func (localNode *LocalNode) GetWssAddr() string
- func (localNode *LocalNode) IncrementProposalSubmitted()
- func (localNode *LocalNode) IncrementRelayMessageCount()
- func (localNode *LocalNode) MarshalJSON() ([]byte, error)
- func (localNode *LocalNode) NewSignatureChainObjectionMessage(height uint32, sigHash []byte) (*pb.UnsignedMessage, error)
- func (nm LocalNode) RemoveNeighborNode(id string)
- func (localNode *LocalNode) ResetSyncing()
- func (localNode *LocalNode) SendRelayMessage(srcAddr, destAddr string, payload, signature, blockHash []byte, ...) error
- func (localNode *LocalNode) SerializeMessage(unsignedMsg *pb.UnsignedMessage, sign bool) ([]byte, error)
- func (localNode *LocalNode) SetMinVerifiableHeight(height uint32)
- func (localNode *LocalNode) SetSyncState(s pb.SyncState) bool
- func (localNode *LocalNode) Start() error
- func (localNode *LocalNode) StartFastSyncing(syncRootHash common.Uint256, peers []*node.RemoteNode) error
- func (localNode *LocalNode) StartSyncRandAddrTxn()
- func (localNode *LocalNode) StartSyncTxnPool()
- func (localNode *LocalNode) StartSyncing(syncStopHash common.Uint256, syncStopHeight uint32, ...) (bool, error)
- func (localNode *LocalNode) SyncRandAddrTxn()
- func (localNode *LocalNode) SyncTxnPool()
- func (localNode *LocalNode) VerifySigChain(sc *pb.SigChain, height uint32) error
- func (localNode *LocalNode) VerifySigChainObjection(sc *pb.SigChain, reporterID []byte, height uint32) (int, error)
- type RelayService
Constants ¶
const NumNbrToSyncRandAddr = 1
Number of random neighbors to sync rand addr
const NumNbrToSyncTxnPool = 1
Number of random neighbors to sync txn pool
Variables ¶
This section is empty.
Functions ¶
func MakeSigChainTransaction ¶
func MakeSigChainTransaction(wallet *vault.Wallet, sigChain []byte) (*transaction.Transaction, error)
func NewBacktrackSigChainMessage ¶
func NewBacktrackSigChainMessage(sigChainElems []*pb.SigChainElem, hash []byte) (*pb.UnsignedMessage, error)
NewBacktrackSigChainMessage creates a BACKTRACK_SIGNATURE_CHAIN message
func NewGetBlockHeadersMessage ¶
func NewGetBlockHeadersMessage(startHeight, endHeight uint32) (*pb.UnsignedMessage, error)
NewGetBlockHeadersMessage creates a GET_BLOCK_HEADERS message
func NewGetBlockHeadersReply ¶
func NewGetBlockHeadersReply(headers []*block.Header) (*pb.UnsignedMessage, error)
NewGetBlockHeadersReply creates a GET_BLOCK_HEADERS_REPLY message in respond to GET_BLOCK_HEADERS message
func NewGetBlocksMessage ¶
func NewGetBlocksMessage(startHeight, endHeight uint32) (*pb.UnsignedMessage, error)
NewGetBlocksMessage creates a GET_BLOCKS message
func NewGetBlocksReply ¶
func NewGetBlocksReply(blocks []*block.Block) (*pb.UnsignedMessage, error)
NewGetBlocksReply creates a GET_BLOCKS_REPLY message in respond to GET_BLOCKS message
func NewGetStateMessage ¶
func NewGetStateMessage(hashes []common.Uint256) (*pb.UnsignedMessage, error)
NewGetStateMessage creates a GET_STATES message
func NewGetStatesReply ¶
func NewGetStatesReply(nodes [][]byte) (*pb.UnsignedMessage, error)
NewGetStatesReply creates a GET_STATES_REPLY message in respond to GET_STATES message
func NewIHaveSignatureChainTransactionMessage ¶
func NewIHaveSignatureChainTransactionMessage(height uint32, sigHash []byte) (*pb.UnsignedMessage, error)
NewIHaveSignatureChainTransactionMessage creates a I_HAVE_SIGNATURE_CHAIN_TRANSACTION message
func NewPinSigChainMessage ¶
func NewPinSigChainMessage(hash []byte) (*pb.UnsignedMessage, error)
NewPinSigChainMessage creates a PIN_SIGNATURE_CHAIN message
func NewRelayMessage ¶
func NewRelayMessage(srcIdentifier string, srcPubkey, destID, payload, blockHash, lastHash []byte, maxHoldingSeconds uint32) (*pb.UnsignedMessage, error)
NewRelayMessage creates a RELAY message
func NewReqAddrNonceMessage ¶
func NewReqAddrNonceMessage() (*pb.UnsignedMessage, error)
build a REQ_ADDR_NONCE request message
func NewReqSyncAddrTxnMessage ¶
func NewReqSyncAddrTxnMessage(addr []byte, nonce uint64) (*pb.UnsignedMessage, error)
build REQ_SYNC_ADDR_TXN request message This message includse my txn pool's txn address and maximum nonce.
func NewReqSyncTxnPoolMessage ¶
func NewReqSyncTxnPoolMessage(tp *pool.TxnPool) (*pb.UnsignedMessage, error)
build REQ_SYNC_TXN_POOL request message. This message includse my txn pool's txn address and maximum nonce.
func NewReqTxnPoolHashMessage ¶
func NewReqTxnPoolHashMessage() (*pb.UnsignedMessage, error)
build a REQ_TXN_POOL_HASH request message
func NewRequestSignatureChainTransactionMessage ¶
func NewRequestSignatureChainTransactionMessage(sigHash []byte) (*pb.UnsignedMessage, error)
NewRequestSignatureChainTransactionMessage creates a REQUEST_SIGNATURE_CHAIN_TRANSACTION message
func NewRequestSignatureChainTransactionReply ¶
func NewRequestSignatureChainTransactionReply(transaction *transaction.Transaction) (*pb.UnsignedMessage, error)
NewRequestSignatureChainTransactionReply creates a REQUEST_SIGNATURE_CHAIN_TRANSACTION_REPLY message
func NewRplAddrNonceMessage ¶
func NewRplAddrNonceMessage(tp *pool.TxnPool) (*pb.UnsignedMessage, error)
build RPL_ADDR_NONCE reply message reply with rand address my txn pool's with this address' nonce.
func NewRplSyncAddrTxnMessage ¶
build RPL_SYNC_ADDR_TXN message. reply transactions which are needed to sync to the requestor.
func NewRplSyncTxnPoolMessage ¶
func NewRplSyncTxnPoolMessage(reqMsg *pb.RequestSyncTxnPool, tp *pool.TxnPool) (*pb.UnsignedMessage, error)
build RPL_SYNC_TXN_POOL message. reply transactions which are needed to sync to the requestor.
func NewRplTxnPoolHashMessage ¶
func NewRplTxnPoolHashMessage(tp *pool.TxnPool) (*pb.UnsignedMessage, error)
build RPL_TXN_POOL_HASH reply message, reply with my txn pool's hash and txn count.
func NewTransactionsMessage ¶
func NewTransactionsMessage(transactions []*transaction.Transaction) (*pb.UnsignedMessage, error)
NewTransactionsMessage creates a TRANSACTIONS message
func ShouldRejectAddr ¶
ShouldRejectAddr returns if remoteAddr should be rejected by localAddr
Types ¶
type ChordInfo ¶
type ChordInfo struct { LocalNode *LocalNode `json:"localNode"` Successors []*ChordRemoteNodeInfo `json:"successors"` Predecessors []*ChordRemoteNodeInfo `json:"predecessors"` FingerTable map[int][]*ChordRemoteNodeInfo `json:"fingerTable"` }
type ChordRemoteNodeInfo ¶
type ChordRemoteNodeInfo struct {
// contains filtered or unexported fields
}
func (*ChordRemoteNodeInfo) MarshalJSON ¶
func (crn *ChordRemoteNodeInfo) MarshalJSON() ([]byte, error)
type LocalNode ¶
type LocalNode struct { *node.Node *pool.TxnPool // transaction pool of local node *node.MessageHandlerStore // contains filtered or unexported fields }
func NewLocalNode ¶
func (*LocalNode) BroadcastTransaction ¶
func (localNode *LocalNode) BroadcastTransaction(txn *transaction.Transaction) error
BroadcastTransaction broadcast a transaction to the network using TRANSACTIONS message
func (*LocalNode) CheckIDChange ¶
func (localNode *LocalNode) CheckIDChange(v interface{})
func (*LocalNode) ComputeSharedKey ¶
func (*LocalNode) FindSuccessorAddrs ¶
func (*LocalNode) FindWsAddr ¶
func (*LocalNode) FindWssAddr ¶
func (*LocalNode) GetChordInfo ¶
func (localNode *LocalNode) GetChordInfo() node.IChordInfo
func (LocalNode) GetConnectionCnt ¶
func (nm LocalNode) GetConnectionCnt() uint
func (*LocalNode) GetGossipNeighbors ¶
func (localNode *LocalNode) GetGossipNeighbors(filter func(*node.RemoteNode) bool) []*node.RemoteNode
func (*LocalNode) GetNeighborBlockHeaders ¶
func (localNode *LocalNode) GetNeighborBlockHeaders(remoteNode *node.RemoteNode, startHeight, endHeight uint32) ([]*block.Header, error)
GetBlockHeaders requests a range of consecutive block headers from a neighbor using GET_BLOCK_HEADERS message
func (*LocalNode) GetNeighborBlocks ¶
func (localNode *LocalNode) GetNeighborBlocks(remoteNode *node.RemoteNode, startHeight, endHeight uint32) ([]*block.Block, error)
GetBlocks requests a range of consecutive blocks from a neighbor using GET_BLOCKS message
func (*LocalNode) GetNeighborByNNetNode ¶
func (localNode *LocalNode) GetNeighborByNNetNode(nnetRemoteNode *nnetnode.RemoteNode) *node.RemoteNode
func (LocalNode) GetNeighborHeights ¶
func (*LocalNode) GetNeighborInfo ¶
func (localNode *LocalNode) GetNeighborInfo() []*node.RemoteNode
func (LocalNode) GetNeighborNode ¶
func (nm LocalNode) GetNeighborNode(id string) *node.RemoteNode
func (*LocalNode) GetNeighborStates ¶
func (LocalNode) GetNeighbors ¶
func (nm LocalNode) GetNeighbors(filter func(*node.RemoteNode) bool) []*node.RemoteNode
func (*LocalNode) GetNeighborsMajorityStateRootByHeight ¶
func (*LocalNode) GetProposalSubmitted ¶
func (*LocalNode) GetRelayMessageCount ¶
func (*LocalNode) GetSyncState ¶
func (*LocalNode) GetTxnPool ¶
func (*LocalNode) GetVotingNeighbors ¶
func (localNode *LocalNode) GetVotingNeighbors(filter func(*node.RemoteNode) bool) []*node.RemoteNode
func (*LocalNode) GetWssAddr ¶
func (*LocalNode) IncrementProposalSubmitted ¶
func (localNode *LocalNode) IncrementProposalSubmitted()
func (*LocalNode) IncrementRelayMessageCount ¶
func (localNode *LocalNode) IncrementRelayMessageCount()
func (*LocalNode) MarshalJSON ¶
func (*LocalNode) NewSignatureChainObjectionMessage ¶
func (localNode *LocalNode) NewSignatureChainObjectionMessage(height uint32, sigHash []byte) (*pb.UnsignedMessage, error)
NewSignatureChainObjectionMessage creates a SIGNATURE_CHAIN_OBJECTION message
func (LocalNode) RemoveNeighborNode ¶
func (nm LocalNode) RemoveNeighborNode(id string)
func (*LocalNode) ResetSyncing ¶
func (localNode *LocalNode) ResetSyncing()
ResetSyncing resets syncOnce and allows for future block syncing
func (*LocalNode) SendRelayMessage ¶
func (*LocalNode) SerializeMessage ¶
func (*LocalNode) SetMinVerifiableHeight ¶
func (*LocalNode) StartFastSyncing ¶
func (localNode *LocalNode) StartFastSyncing(syncRootHash common.Uint256, peers []*node.RemoteNode) error
StartFastSyncing quickly download the headers, full sync only at the chain
func (*LocalNode) StartSyncRandAddrTxn ¶
func (localNode *LocalNode) StartSyncRandAddrTxn()
func (*LocalNode) StartSyncTxnPool ¶
func (localNode *LocalNode) StartSyncTxnPool()
func (*LocalNode) StartSyncing ¶
func (localNode *LocalNode) StartSyncing(syncStopHash common.Uint256, syncStopHeight uint32, neighbors []*node.RemoteNode) (bool, error)
StartSyncing starts block syncing from current local ledger until it gets to block height stopHeight with block hash stopHash from given neighbors
func (*LocalNode) SyncRandAddrTxn ¶
func (localNode *LocalNode) SyncRandAddrTxn()
sync rand addr process
func (*LocalNode) VerifySigChain ¶
type RelayService ¶
func NewRelayService ¶
func NewRelayService(wallet *vault.Wallet, localNode *LocalNode) *RelayService
func (*RelayService) Start ¶
func (rs *RelayService) Start() error