Documentation
¶
Overview ¶
nolint 20160901 - Initial version by user johnstuartmill, public key 02fb4acf944c84d48341e3c1cb14d707034a68b7f931d6be6d732bec03597d6ff6 20161025 - Code revision by user johnstuartmill.
nolint 20160901 - Initial version by user johnstuartmill, public key 02fb4acf944c84d48341e3c1cb14d707034a68b7f931d6be6d732bec03597d6ff6 20161025 - Code revision by user johnstuartmill.
nolint 20160901 - Initial version by user johnstuartmill, public key 02fb4acf944c84d48341e3c1cb14d707034a68b7f931d6be6d732bec03597d6ff6 20161025 - Code revision by user johnstuartmill.
nolint 20160901 - Initial version by user johnstuartmill, public key 02fb4acf944c84d48341e3c1cb14d707034a68b7f931d6be6d732bec03597d6ff6 20161025 - Code revision by user johnstuartmill.
Index ¶
- Variables
- type BlockBase
- type BlockStat
- type BlockStatQueue
- type BlockchainTail
- type ConnectionManagerInterface
- type ConsensusParticipant
- func (self *ConsensusParticipant) GetConnectionManager() ConnectionManagerInterface
- func (self *ConsensusParticipant) GetNextBlockSeqNo() uint64
- func (self *ConsensusParticipant) Get_block_stat_queue_Len() int
- func (self *ConsensusParticipant) Get_block_stat_queue_element_at(j int) *BlockStat
- func (self *ConsensusParticipant) OnBlockHeaderArrived(blockPtr *BlockBase)
- func (self *ConsensusParticipant) Print()
- func (self *ConsensusParticipant) SetPubkeySeckey(pubkey cipher.PubKey, seckey cipher.SecKey)
- func (self *ConsensusParticipant) SignatureOf(hash cipher.SHA256) cipher.Sig
- type HashCandidate
- type PriorityQueue
Constants ¶
This section is empty.
Variables ¶
var Cfg_blockchain_tail_length int = 100
How many blocks we hold in memory. Older blocks are expected (not implemented yest as of 20160920) to be written to disk.
var Cfg_consensus_candidate_max_seqno_gap uint64 = 10
To limit memory use and prevent some mild attacks:
var Cfg_consensus_max_candidate_messages = 10
//////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////// How many (hash,signer_pubkey) pairs to acquire for decision-making. This also limits forwarded traffic, because the messages in excess of this limit are discarded hence not forwarded:
var Cfg_consensus_waiting_time_as_seqno_diff uint64 = 7
When to decide on selecting the best hash from BlockStat so that it can be moved to BlockChain:
var Cfg_debug_HashCandidate bool = false
var Cfg_debug_block_accepted bool = false
var Cfg_debug_block_duplicate bool = false
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
var Cfg_debug_block_out_of_sequence bool = true
Functions ¶
This section is empty.
Types ¶
type BlockBase ¶
//////////////////////////////////////////////////////////////////////////////
BlockBase ¶
//////////////////////////////////////////////////////////////////////////////
func (*BlockBase) Init ¶
//////////////////////////////////////////////////////////////////////////////
type BlockStat ¶
type BlockStat struct {
// contains filtered or unexported fields
}
//////////////////////////////////////////////////////////////////////////////
BlockStat ¶
//////////////////////////////////////////////////////////////////////////////
func (*BlockStat) Clear ¶
func (self *BlockStat) Clear()
//////////////////////////////////////////////////////////////////////////////
func (*BlockStat) GetBestHashPubkeySig ¶
//////////////////////////////////////////////////////////////////////////////
func (*BlockStat) GetSeqno ¶
//////////////////////////////////////////////////////////////////////////////
type BlockStatQueue ¶
type BlockStatQueue struct {
// contains filtered or unexported fields
}
//////////////////////////////////////////////////////////////////////////////
BlockStatQueue ¶
//////////////////////////////////////////////////////////////////////////////
func (*BlockStatQueue) Len ¶
func (self *BlockStatQueue) Len() int
//////////////////////////////////////////////////////////////////////////////
func (*BlockStatQueue) Print ¶
func (self *BlockStatQueue) Print()
//////////////////////////////////////////////////////////////////////////////
type BlockchainTail ¶
type BlockchainTail struct {
// contains filtered or unexported fields
}
//////////////////////////////////////////////////////////////////////////////
BlockchainTail is the most recent part of blockchain that is held in memory ¶
//////////////////////////////////////////////////////////////////////////////
func (*BlockchainTail) GetNextSeqNo ¶
func (self *BlockchainTail) GetNextSeqNo() uint64
//////////////////////////////////////////////////////////////////////////////
func (*BlockchainTail) Init ¶
func (self *BlockchainTail) Init()
//////////////////////////////////////////////////////////////////////////////
func (*BlockchainTail) Print ¶
func (self *BlockchainTail) Print()
//////////////////////////////////////////////////////////////////////////////
type ConnectionManagerInterface ¶
type ConnectionManagerInterface interface { SendBlockToAllMySubscriber(blockPtr *BlockBase) Print() // For debugging }
//////////////////////////////////////////////////////////////////////////////
type ConsensusParticipant ¶
type ConsensusParticipant struct { Pubkey cipher.PubKey // Who we are Seckey cipher.SecKey // For signing Incoming_block_count int // contains filtered or unexported fields }
//////////////////////////////////////////////////////////////////////////////
Struct ConsensusParticipant is inteneded to extend (or be contained in) github.com/samoslab/haicoin/src/mesh*/node struct Node, so that Node can participate in consensus.
//////////////////////////////////////////////////////////////////////////////
func NewConsensusParticipantPtr ¶
func NewConsensusParticipantPtr(pMan ConnectionManagerInterface) *ConsensusParticipant
//////////////////////////////////////////////////////////////////////////////
func (*ConsensusParticipant) GetConnectionManager ¶
func (self *ConsensusParticipant) GetConnectionManager() ConnectionManagerInterface
func (*ConsensusParticipant) GetNextBlockSeqNo ¶
func (self *ConsensusParticipant) GetNextBlockSeqNo() uint64
//////////////////////////////////////////////////////////////////////////////
func (*ConsensusParticipant) Get_block_stat_queue_Len ¶
func (self *ConsensusParticipant) Get_block_stat_queue_Len() int
//////////////////////////////////////////////////////////////////////////////
func (*ConsensusParticipant) Get_block_stat_queue_element_at ¶
func (self *ConsensusParticipant) Get_block_stat_queue_element_at( j int) *BlockStat
//////////////////////////////////////////////////////////////////////////////
func (*ConsensusParticipant) OnBlockHeaderArrived ¶
func (self *ConsensusParticipant) OnBlockHeaderArrived(blockPtr *BlockBase)
//////////////////////////////////////////////////////////////////////////////
func (*ConsensusParticipant) Print ¶
func (self *ConsensusParticipant) Print()
//////////////////////////////////////////////////////////////////////////////
func (*ConsensusParticipant) SetPubkeySeckey ¶
func (self *ConsensusParticipant) SetPubkeySeckey( pubkey cipher.PubKey, seckey cipher.SecKey)
//////////////////////////////////////////////////////////////////////////////
func (*ConsensusParticipant) SignatureOf ¶
func (self *ConsensusParticipant) SignatureOf(hash cipher.SHA256) cipher.Sig
////////////////////////////////////////////////////////////////////////////// Reasons for this function: 1st, we want to minimize exposure of SecKey, even in same process space. 2nd, functions Sign and SignHash already exist, so want keep search/browse/jump-to-tag unambiguous.
type HashCandidate ¶
type HashCandidate struct {
// contains filtered or unexported fields
}
//////////////////////////////////////////////////////////////////////////////
HashCandidate ¶
//////////////////////////////////////////////////////////////////////////////
func (*HashCandidate) Clear ¶
func (self *HashCandidate) Clear()
//////////////////////////////////////////////////////////////////////////////
func (*HashCandidate) Init ¶
func (self *HashCandidate) Init()
//////////////////////////////////////////////////////////////////////////////
func (*HashCandidate) ObserveSigAndPubkey ¶
func (self *HashCandidate) ObserveSigAndPubkey( sig cipher.Sig, pubkey cipher.PubKey)
//////////////////////////////////////////////////////////////////////////////
type PriorityQueue ¶
type PriorityQueue []*BlockStat // Contained in BlockStatQueue
//////////////////////////////////////////////////////////////////////////////
func (PriorityQueue) Len ¶
func (pq PriorityQueue) Len() int
NOTE: a shallow copy (of the slice) is made here
func (PriorityQueue) Less ¶
func (pq PriorityQueue) Less(i int, j int) bool
NOTE: a shallow copy (of the slice) is made here
func (*PriorityQueue) Pop ¶
func (pq *PriorityQueue) Pop() interface{}
func (*PriorityQueue) Push ¶
func (pq *PriorityQueue) Push(x interface{})
func (PriorityQueue) Swap ¶
func (pq PriorityQueue) Swap(i int, j int)
NOTE: a shallow copy (of the slice) is made here