Documentation ¶
Overview ¶
Defines the state for factoid. By using the proper interfaces, the functionality of factoid can be imported into any framework.
Index ¶
- Constants
- Variables
- func AppendExtIDs(extIDs [][]byte, start int, end int) ([]byte, error)
- func BytesToUint32(data []byte) (ret uint32, err error)
- func CheckDBKeyMR(s *State, ht uint32, hash string) error
- func CheckGrants()
- func CheckLength(length int, item []byte) bool
- func CheckSig(idKey interfaces.IHash, pub []byte, msg []byte, sig []byte) bool
- func DeleteFile(filename string) error
- func FaultCheck(pl *ProcessList)
- func FedServerVM(serverMap [10][64]int, numberOfFedServers int, minute int, fedIndex int) int
- func GenerateGenesisBlocks(networkID uint32, bootstrapIdentity interfaces.IHash) (interfaces.IDirectoryBlock, interfaces.IAdminBlock, interfaces.IFBlock, ...)
- func GetGrantPayoutsFor(currentDBHeight uint32) []interfaces.ITransAddress
- func GetMapHash(bmap map[[32]byte]int64) interfaces.IHash
- func LoadDatabase(s *State)
- func LoadFromFile(s *State, filename string) ([]byte, error)
- func MakeMap(numberFedServers int, dbheight uint32) (serverMap [10][64]int)
- func Minutes(unix int64) int
- func NetworkIDToFilename(networkName string, fileLocation string) string
- func PopBalanceMap(buf *primitives.Buffer) (map[[32]byte]int64, error)
- func PopBucketMap(buf *primitives.Buffer) (map[[32]byte]int, error)
- func PrintState(state *State)
- func ProcessIdentityToAdminBlock(st *State, chainID interfaces.IHash, servertype int) bool
- func PushBalanceMap(b *primitives.Buffer, m map[[32]byte]int64) error
- func PushBucketMap(b *primitives.Buffer, m map[[32]byte]int) error
- func RandomServer() interfaces.IServer
- func RegisterPrometheus()
- func SaveToFile(s *State, dbht uint32, b []byte, filename string) error
- func Sort(serv []interfaces.IServer) bool
- func SortServers(servers []interfaces.IServer) []interfaces.IServer
- func Uint32ToBytes(val uint32) ([]byte, error)
- type APIMSGQueue
- type ByKey
- type CrossReplayFilter
- type DBSig
- type DBState
- func (dbs *DBState) Init()
- func (a *DBState) IsSameAs(b *DBState) bool
- func (dbs *DBState) MarshalBinary() (rval []byte, err error)
- func (ds *DBState) String() string
- func (dbs *DBState) UnmarshalBinary(p []byte) error
- func (dbs *DBState) UnmarshalBinaryData(p []byte) (newData []byte, err error)
- func (d *DBState) ValidNext(state *State, next *messages.DBStateMsg) int
- type DBStateList
- func (list *DBStateList) Catchup(justDoIt bool)
- func (list *DBStateList) FixupLinks(p *DBState, d *DBState) (progress bool)
- func (list *DBStateList) Get(height int) *DBState
- func (list *DBStateList) GetHighestCompletedBlk() uint32
- func (list *DBStateList) GetHighestLockedSignedAndSavesBlk() uint32
- func (list *DBStateList) GetHighestSavedBlk() uint32
- func (list *DBStateList) GetHighestSignedBlk() uint32
- func (list *DBStateList) Highest() uint32
- func (dbsl *DBStateList) Init()
- func (a *DBStateList) IsSameAs(b *DBStateList) bool
- func (list *DBStateList) Last() *DBState
- func (dbsl *DBStateList) MarshalBinary() (rval []byte, err error)
- func (list *DBStateList) NewDBState(isNew bool, directoryBlock interfaces.IDirectoryBlock, ...) *DBState
- func (list *DBStateList) ProcessBlocks(d *DBState) (progress bool)
- func (list *DBStateList) Put(dbState *DBState) bool
- func (list *DBStateList) SaveDBStateToDB(d *DBState) (progress bool)
- func (list *DBStateList) SignDB(d *DBState) (process bool)
- func (list *DBStateList) String() string
- func (dbsl *DBStateList) UnmarshalBinary(p []byte) error
- func (dbsl *DBStateList) UnmarshalBinaryData(p []byte) (newData []byte, err error)
- func (list *DBStateList) UpdateState() (progress bool)
- func (list *DBStateList) WriteDBStateToDebugFile(d *DBState)
- type DisplayState
- type ElectionQueue
- type EntrySync
- type EntryTransaction
- type EntryUpdate
- type FactoidState
- func (fs *FactoidState) AddECBlock(blk interfaces.IEntryCreditBlock) error
- func (fs *FactoidState) AddTransaction(index int, trans interfaces.ITransaction) error
- func (fs *FactoidState) AddTransactionBlock(blk interfaces.IFBlock) error
- func (fs *FactoidState) EndOfPeriod(period int)
- func (fs *FactoidState) GetBalanceHash(TempBalanceHash bool) (rval interfaces.IHash)
- func (fs *FactoidState) GetCoinbaseTransaction(dbheight uint32, ftime interfaces.Timestamp) interfaces.ITransaction
- func (fs *FactoidState) GetCurrentBlock() interfaces.IFBlock
- func (fs *FactoidState) GetECBalance(address [32]byte) int64
- func (fs *FactoidState) GetFactoidBalance(address [32]byte) int64
- func (fs *FactoidState) GetMultipleECBalances(singleAdd [32]byte) (uint32, uint32, int64, int64, string)
- func (fs *FactoidState) GetMultipleFactoidBalances(singleAdd [32]byte) (uint32, uint32, int64, int64, string)
- func (fs *FactoidState) ProcessEndOfBlock(state interfaces.IState)
- func (fs *FactoidState) UpdateECTransaction(rt bool, trans interfaces.IECBlockEntry) error
- func (fs *FactoidState) UpdateTransaction(rt bool, trans interfaces.ITransaction) error
- func (fs *FactoidState) Validate(index int, trans interfaces.ITransaction) error
- func (fs *FactoidState) ValidateTransactionAge(trans interfaces.ITransaction) error
- type FactoidTransaction
- type FaultCore
- type GeneralMSGQueue
- type HardGrant
- type IPrometheusRateMethods
- type IdentityEntry
- type InMsgMSGQueue
- type MMRInfo
- type MarshalableUint32
- type MissingEntry
- type MissingEntryBlock
- type MovingAverage
- type NetOutMsgQueue
- type ProcessList
- func (p *ProcessList) AddAuditServer(identityChainID interfaces.IHash) int
- func (p *ProcessList) AddDBSig(serverID interfaces.IHash, sig interfaces.IFullSignature)
- func (p *ProcessList) AddFedServer(identityChainID interfaces.IHash) int
- func (p *ProcessList) AddNewEBlocks(key interfaces.IHash, value interfaces.IEntryBlock)
- func (p *ProcessList) AddNewEntry(key interfaces.IHash, value interfaces.IEntry)
- func (p *ProcessList) AddOldMsgs(m interfaces.IMsg)
- func (p *ProcessList) AddToProcessList(s *State, ack *messages.Ack, m interfaces.IMsg)
- func (p *ProcessList) CheckDiffSigTally() bool
- func (p *ProcessList) Complete() bool
- func (p *ProcessList) ContainsDBSig(serverID interfaces.IHash) bool
- func (p *ProcessList) FedServerFor(minute int, hash []byte) interfaces.IServer
- func (p *ProcessList) GetAckAt(vmIndex int, height int) *messages.Ack
- func (p *ProcessList) GetAuditServerIndexHash(identityChainID interfaces.IHash) (bool, int)
- func (p *ProcessList) GetDBHeight() uint32
- func (p *ProcessList) GetFedServerIndexHash(identityChainID interfaces.IHash) (bool, int)
- func (p *ProcessList) GetKeysNewEntries() (keys [][32]byte)
- func (p *ProcessList) GetNewEBlocks(key interfaces.IHash) interfaces.IEntryBlock
- func (p *ProcessList) GetNewEntry(key [32]byte) interfaces.IEntry
- func (p *ProcessList) GetOldAck(key interfaces.IHash) interfaces.IMsg
- func (p *ProcessList) GetVMStatsForFedServer(index int) (vmIndex int, listHeight int, listLength int, nextNil int)
- func (p *ProcessList) GetVirtualServers(minute int, identityChainID interfaces.IHash) (found bool, index int)
- func (p *ProcessList) IncrementDiffSigTally()
- func (p *ProcessList) IsPendingChainHead(chainid interfaces.IHash) bool
- func (p *ProcessList) LenNewEntries() int
- func (p *ProcessList) LogPrintLeaders(log string)
- func (p *ProcessList) MakeMap()
- func (p *ProcessList) PrintMap() string
- func (p *ProcessList) Process(s *State) (progress bool)
- func (p *ProcessList) RemoveAuditServerHash(identityChainID interfaces.IHash)
- func (p *ProcessList) RemoveFedServerHash(identityChainID interfaces.IHash)
- func (p *ProcessList) Reset() bool
- func (p *ProcessList) ResetDiffSigTally()
- func (p *ProcessList) SetStartingAuthoritySet()
- func (p *ProcessList) SortAuditServers()
- func (p *ProcessList) SortDBSigs()
- func (p *ProcessList) SortFedServers()
- func (p *ProcessList) String() string
- func (p *ProcessList) TrimVMList(h uint32, vmIndex int)
- func (p *ProcessList) VMIndexFor(hash []byte) int
- type ProcessLists
- type RateCalculator
- type ReCheck
- type Replay
- func (r *Replay) Clear(mask int, hash [32]byte)
- func (r *Replay) Init()
- func (r *Replay) IsHashUnique(mask int, hash [32]byte) bool
- func (r *Replay) IsHashUnique_internal(mask int, hash [32]byte) bool
- func (a *Replay) IsSameAs(b *Replay) bool
- func (r *Replay) IsTSValid(mask int, hash interfaces.IHash, timestamp interfaces.Timestamp) bool
- func (r *Replay) IsTSValidAndUpdateState(mask int, hash [32]byte, timestamp interfaces.Timestamp, ...) (rval bool)
- func (r *Replay) MarshalBinary() (rval []byte, err error)
- func (r *Replay) Recenter(systemtime interfaces.Timestamp)
- func (r *Replay) Save() *Replay
- func (r *Replay) SetHashNow(mask int, hash [32]byte, now interfaces.Timestamp)
- func (r *Replay) UnmarshalBinary(p []byte) error
- func (r *Replay) UnmarshalBinaryData(p []byte) ([]byte, error)
- func (r *Replay) Valid(mask int, hash [32]byte, timestamp interfaces.Timestamp, ...) (index int, valid bool)
- type SafeMsgMap
- func (m *SafeMsgMap) Cleanup(s *State)
- func (m *SafeMsgMap) Copy() *SafeMsgMap
- func (m *SafeMsgMap) Delete(key [32]byte) (msg interfaces.IMsg, found bool)
- func (m *SafeMsgMap) Get(key [32]byte) (msg interfaces.IMsg)
- func (m *SafeMsgMap) GetRaw() map[[32]byte]interfaces.IMsg
- func (m *SafeMsgMap) Len() int
- func (m *SafeMsgMap) Put(key [32]byte, msg interfaces.IMsg)
- func (m *SafeMsgMap) RemoveExpired(s *State)
- func (m *SafeMsgMap) Reset()
- type SaveState
- func (ss *SaveState) Init()
- func (a *SaveState) IsSameAs(b *SaveState) bool
- func (e *SaveState) JSONByte() ([]byte, error)
- func (e *SaveState) JSONString() (string, error)
- func (ss *SaveState) MarshalBinary() (rval []byte, err error)
- func (ss *SaveState) RestoreFactomdState(s *State)
- func (e *SaveState) String() string
- func (ss *SaveState) TrimBack(s *State, d *DBState)
- func (ss *SaveState) UnmarshalBinary(p []byte) error
- func (ss *SaveState) UnmarshalBinaryData(p []byte) (newData []byte, err error)
- type Server
- func (s *Server) GetChainID() (rval interfaces.IHash)
- func (s *Server) GetName() string
- func (s *Server) Init()
- func (s *Server) IsOnline() bool
- func (s *Server) IsSameAs(b interfaces.IServer) bool
- func (e *Server) JSONByte() ([]byte, error)
- func (e *Server) JSONString() (string, error)
- func (s *Server) LeaderToReplace() (rval interfaces.IHash)
- func (s *Server) MarshalBinary() (rval []byte, err error)
- func (s *Server) SetOnline(o bool)
- func (s *Server) SetReplace(h interfaces.IHash)
- func (s *Server) String() string
- func (s *Server) UnmarshalBinary(p []byte) error
- func (s *Server) UnmarshalBinaryData(p []byte) (newData []byte, err error)
- type State
- func (s *State) APIQueue() interfaces.IQueue
- func (s *State) AckQueue() chan interfaces.IMsg
- func (s *State) AddAuditServer(dbheight uint32, hash interfaces.IHash) int
- func (s *State) AddAuthorityDelta(authSet string)
- func (s *State) AddDBSig(dbheight uint32, chainID interfaces.IHash, sig interfaces.IFullSignature)
- func (s *State) AddDBState(isNew bool, directoryBlock interfaces.IDirectoryBlock, ...) *DBState
- func (s *State) AddFedServer(dbheight uint32, hash interfaces.IHash) int
- func (st *State) AddIdentityEblocks(cid interfaces.IHash, rootChain bool) error
- func (st *State) AddIdentityFromChainID(cid interfaces.IHash) error
- func (st *State) AddNewIdentityEblocks(eblocks []interfaces.IEntryBlock, dblockTimestamp interfaces.Timestamp)
- func (s *State) AddPrefix(prefix string)
- func (s *State) AddStatus(status string)
- func (s *State) AddToHolding(hash [32]byte, msg interfaces.IMsg)
- func (s *State) AddToReplayFilter(mask int, hash [32]byte, timestamp interfaces.Timestamp, ...) (rval bool)
- func (s *State) Ask(DBHeight int, vmIndex int, height int, when int64)
- func (s *State) CalculateTransactionRate() (totalTPS float64, instantTPS float64)
- func (s *State) CheckFileName(name string) bool
- func (s *State) CheckForIDChange()
- func (s *State) Clone(cloneNumber int) interfaces.IState
- func (s *State) ComputeVMIndex(hash []byte) int
- func (s *State) ConstructAuthoritySetString() (authSets []string)
- func (s *State) CopyStateToControlPanel() error
- func (s *State) CreateDBSig(dbheight uint32, vmIndex int) (interfaces.IMsg, interfaces.IMsg)
- func (s *State) CreateEOM(force bool, m interfaces.IMsg, vmIdx int) (eom *messages.EOM, ack interfaces.IMsg)
- func (s *State) CrossReplayAddSalt(height uint32, salt [8]byte) error
- func (s *State) DatabaseContains(hash interfaces.IHash) bool
- func (s *State) DebugExec() (ret bool)
- func (s *State) DeleteFromHolding(hash [32]byte, msg interfaces.IMsg, reason string)
- func (s *State) DidCreateLastBlockFromDBState() bool
- func (s *State) DoProcessing()
- func (s *State) DoReset()
- func (s *State) ElectionsQueue() interfaces.IQueue
- func (this *State) ExchangeRateAuthorityIsValid(e interfaces.IEBEntry) bool
- func (s *State) ExecuteEntriesInDBState(dbmsg *messages.DBStateMsg)
- func (st *State) FastVerifyAuthoritySignature(msg []byte, sig interfaces.IFullSignature, dbheight uint32) (int, error)
- func (this *State) FerEntryIsValid(passedFEREntry interfaces.IFEREntry) bool
- func (s *State) FetchECTransactionByHash(hash interfaces.IHash) (interfaces.IECBlockEntry, error)
- func (s *State) FetchEntryByHash(hash interfaces.IHash) (interfaces.IEBEntry, error)
- func (s *State) FetchEntryHashFromProcessListsByTxID(txID string) (interfaces.IHash, error)
- func (s *State) FetchEntryRevealAndCommitFromHolding(hash interfaces.IHash) (reveal interfaces.IMsg, commit interfaces.IMsg)
- func (s *State) FetchFactoidTransactionByHash(hash interfaces.IHash) (interfaces.ITransaction, error)
- func (s *State) FetchHoldingMessageByHash(hash interfaces.IHash) (int, byte, interfaces.IMsg, error)
- func (s *State) FetchIdentityChainEntriesInCreateOrder(chainid interfaces.IHash) ([]IdentityEntry, error)
- func (s *State) FetchPaidFor(hash interfaces.IHash) (interfaces.IHash, error)
- func (s *State) FixMissingKeys(id *Identity) error
- func (s *State) FollowerExecuteAck(msg interfaces.IMsg)
- func (s *State) FollowerExecuteCommitChain(m interfaces.IMsg)
- func (s *State) FollowerExecuteCommitEntry(m interfaces.IMsg)
- func (s *State) FollowerExecuteDBState(msg interfaces.IMsg)
- func (s *State) FollowerExecuteDataResponse(m interfaces.IMsg)
- func (s *State) FollowerExecuteEOM(m interfaces.IMsg)
- func (s *State) FollowerExecuteFullFault(m interfaces.IMsg)
- func (s *State) FollowerExecuteMMR(m interfaces.IMsg)
- func (s *State) FollowerExecuteMissingMsg(msg interfaces.IMsg)
- func (s *State) FollowerExecuteMsg(m interfaces.IMsg)
- func (s *State) FollowerExecuteRevealEntry(m interfaces.IMsg)
- func (s *State) FollowerExecuteSFault(m interfaces.IMsg)
- func (s *State) GetACKStatus(hash interfaces.IHash) (int, interfaces.IHash, interfaces.Timestamp, interfaces.Timestamp, error)
- func (s *State) GetAckChange() (bool, error)
- func (s *State) GetAnchor() interfaces.IAnchor
- func (s *State) GetAuditHeartBeats() []interfaces.IMsg
- func (s *State) GetAuditServers(dbheight uint32) []interfaces.IServer
- func (s *State) GetAuthorities() []interfaces.IAuthority
- func (st *State) GetAuthority(serverID interfaces.IHash) (*Authority, int)
- func (s *State) GetAuthorityDeltas() string
- func (s *State) GetAuthorityInterface(chainid interfaces.IHash) interfaces.IAuthority
- func (st *State) GetAuthorityServerType(chainID interfaces.IHash) int
- func (s *State) GetAuthoritySetString() string
- func (s *State) GetBootTime() int64
- func (s *State) GetCfg() interfaces.IFactomConfig
- func (s *State) GetConfigPath() string
- func (s *State) GetCorsDomains() []string
- func (s *State) GetCurrentBlockStartTime() int64
- func (s *State) GetCurrentMinute() int
- func (s *State) GetCurrentMinuteStartTime() int64
- func (s *State) GetCurrentTime() int64
- func (s *State) GetDB() interfaces.DBOverlaySimple
- func (s *State) GetDBHeightAtBoot() uint32
- func (s *State) GetDBHeightComplete() uint32
- func (s *State) GetDBState(height uint32) *DBState
- func (s *State) GetDBStatesSent() []*interfaces.DBStateSent
- func (s *State) GetDelay() int64
- func (s *State) GetDirectoryBlock() interfaces.IDirectoryBlock
- func (s *State) GetDirectoryBlockByHeight(height uint32) interfaces.IDirectoryBlock
- func (s *State) GetDirectoryBlockInSeconds() int
- func (s *State) GetDropRate() int
- func (s *State) GetE(rt bool, adr [32]byte) (v int64)
- func (s *State) GetEBlockKeyMRFromEntryHash(entryHash interfaces.IHash) (rval interfaces.IHash)
- func (s *State) GetElections() interfaces.IElections
- func (s *State) GetEntryBlockDBHeightComplete() uint32
- func (s *State) GetEntryBlockDBHeightProcessing() uint32
- func (s *State) GetEntryCommitAckByEntryHash(hash interfaces.IHash) (status int, commit interfaces.IMsg)
- func (s *State) GetEntryCommitAckByTXID(hash interfaces.IHash) (status int, blktime interfaces.Timestamp, commit interfaces.IMsg, ...)
- func (s *State) GetEntryDBHeightComplete() uint32
- func (s *State) GetEntryRevealAckByEntryHash(hash interfaces.IHash) (status int, blktime interfaces.Timestamp, commit interfaces.IMsg)
- func (s *State) GetF(rt bool, adr [32]byte) (v int64)
- func (s *State) GetFactoidState() interfaces.IFactoidState
- func (s *State) GetFactomNodeName() string
- func (s *State) GetFactomdLocations() string
- func (s *State) GetFactomdVersion() string
- func (s *State) GetFactoshisPerEC() uint64
- func (s *State) GetFaultTimeout() int
- func (s *State) GetFaultWait() int
- func (s *State) GetFedServers(dbheight uint32) []interfaces.IServer
- func (s *State) GetHighestAck() uint32
- func (s *State) GetHighestCompletedBlk() uint32
- func (s *State) GetHighestKnownBlock() uint32
- func (s *State) GetHighestLockedSignedAndSavesBlk() uint32
- func (s *State) GetHighestSavedBlk() uint32
- func (s *State) GetIdentityChainID() (rval interfaces.IHash)
- func (s *State) GetInvalidMsg(hash interfaces.IHash) interfaces.IMsg
- func (s *State) GetJournalMessages() [][]byte
- func (s *State) GetLLeaderHeight() uint32
- func (s *State) GetLastStatus() string
- func (s *State) GetLeaderHeight() uint32
- func (s *State) GetLeaderPL() interfaces.IProcessList
- func (s *State) GetLeaderTimestamp() interfaces.Timestamp
- func (s *State) GetLeaderVM() int
- func (s *State) GetMatryoshka(dbheight uint32) (rval interfaces.IHash)
- func (s *State) GetMessageFilterTimestamp() interfaces.Timestamp
- func (s *State) GetMessageTalliesReceived(i int) int
- func (s *State) GetMessageTalliesSent(i int) int
- func (s *State) GetMissingDBState(height uint32) error
- func (s *State) GetMissingEntryCount() uint32
- func (s *State) GetMsg(vmIndex int, dbheight int, height int) (interfaces.IMsg, error)
- func (s *State) GetNetStateOff() bool
- func (s *State) GetNetworkBootStrapIdentity() (rval interfaces.IHash)
- func (s *State) GetNetworkBootStrapKey() (rval interfaces.IHash)
- func (s *State) GetNetworkID() uint32
- func (s *State) GetNetworkIdentityRegistrationChain() (rval interfaces.IHash)
- func (s *State) GetNetworkName() string
- func (s *State) GetNetworkNumber() int
- func (s *State) GetNetworkSkeletonIdentity() (rval interfaces.IHash)
- func (st *State) GetNetworkSkeletonKey() (rval interfaces.IHash)
- func (s *State) GetNewEBlocks(dbheight uint32, hash interfaces.IHash) interfaces.IEntryBlock
- func (s *State) GetNewHash() (rval interfaces.IHash)
- func (s *State) GetOnlineAuditServers(dbheight uint32) []interfaces.IServer
- func (s *State) GetOut() bool
- func (s *State) GetPendingEntries(params interface{}) []interfaces.IPendingEntry
- func (s *State) GetPendingTransactions(params interface{}) []interfaces.IPendingTransaction
- func (s *State) GetPort() int
- func (this *State) GetPredictiveFER() uint64
- func (s *State) GetPreviousMinuteStartTime() int64
- func (s *State) GetRpcAuthHash() []byte
- func (s *State) GetRpcPass() string
- func (s *State) GetRpcUser() string
- func (s *State) GetSalt(ts interfaces.Timestamp) uint32
- func (s *State) GetServerPrivateKey() *primitives.PrivateKey
- func (s *State) GetServerPublicKey() *primitives.PublicKey
- func (s *State) GetServerPublicKeyString() string
- func (st *State) GetSigningKey(id interfaces.IHash) (interfaces.IHash, int)
- func (s *State) GetSpecificACKStatus(hash interfaces.IHash) (int, interfaces.IHash, interfaces.Timestamp, interfaces.Timestamp, error)
- func (s *State) GetStatus() []string
- func (s *State) GetSystemHeight(dbheight uint32) int
- func (s *State) GetSystemMsg(dbheight uint32, height uint32) interfaces.IMsg
- func (s *State) GetTimeOffset() interfaces.Timestamp
- func (s *State) GetTimestamp() interfaces.Timestamp
- func (s *State) GetTlsInfo() (bool, string, string)
- func (s *State) GetTrueLeaderHeight() uint32
- func (s *State) GetUnsyncedServers(dbheight uint32) []interfaces.IHash
- func (s *State) GetUnsyncedServersString(dbheight uint32) string
- func (s *State) GetVirtualServers(dbheight uint32, minute int, identityChainID interfaces.IHash) (bool, int)
- func (s *State) GoSyncEntries()
- func (s *State) HookLogstash() error
- func (s *State) InMsgQueue() interfaces.IQueue
- func (s *State) InMsgQueue2() interfaces.IQueue
- func (s *State) IncDBStateAnswerCnt()
- func (s *State) IncECCommits()
- func (s *State) IncECommits()
- func (s *State) IncEntries()
- func (s *State) IncEntryChains()
- func (s *State) IncFCTSubmits()
- func (s *State) IncFactoidTrans()
- func (s *State) Init()
- func (s *State) InitBoltDB() error
- func (s *State) InitLevelDB() error
- func (s *State) InitMapDB() error
- func (st *State) InitiateNetworkIdentityRegistration() error
- func (st *State) IntiateNetworkSkeletonIdentity() error
- func (s *State) IsActive(id activations.ActivationType) bool
- func (s *State) IsHighestCommit(hash interfaces.IHash, msg interfaces.IMsg) bool
- func (s *State) IsLeader() bool
- func (s *State) IsNewOrPendingEBlocks(dbheight uint32, hash interfaces.IHash) bool
- func (s *State) IsStalled() bool
- func (s *State) IsStateFullySynced() bool
- func (s *State) IsSyncing() bool
- func (s *State) IsSyncingDBSigs() bool
- func (s *State) IsSyncingEOMs() bool
- func (s *State) JournalMessage(msg interfaces.IMsg)
- func (s *State) LeaderExecute(m interfaces.IMsg)
- func (s *State) LeaderExecuteCommitChain(m interfaces.IMsg)
- func (s *State) LeaderExecuteCommitEntry(m interfaces.IMsg)
- func (s *State) LeaderExecuteDBSig(m interfaces.IMsg)
- func (s *State) LeaderExecuteEOM(m interfaces.IMsg)
- func (s *State) LeaderExecuteRevealEntry(m interfaces.IMsg)
- func (s *State) LoadAcksMap() map[[32]byte]interfaces.IMsg
- func (s *State) LoadConfig(filename string, networkFlag string)
- func (s *State) LoadDBState(dbheight uint32) (interfaces.IMsg, error)
- func (s *State) LoadDataByHash(requestedHash interfaces.IHash) (interfaces.BinaryMarshallable, int, error)
- func (s *State) LoadHoldingMap() map[[32]byte]interfaces.IMsg
- func (st *State) LoadIdentityByEntry(ent interfaces.IEBEntry, height uint32, dblockTimestamp interfaces.Timestamp, ...)
- func (s *State) LoadSpecificMsg(dbheight uint32, vm int, plistheight uint32) (interfaces.IMsg, error)
- func (s *State) LoadSpecificMsgAndAck(dbheight uint32, vmIndex int, plistheight uint32) (interfaces.IMsg, interfaces.IMsg, error)
- func (s *State) Log(level string, message string)
- func (s *State) LogMessage(logName string, comment string, msg interfaces.IMsg)
- func (s *State) LogPrintf(logName string, format string, more ...interface{})
- func (s *State) Logf(level string, format string, args ...interface{})
- func (st *State) LookupIdentityInBlockchainByChainID(cid interfaces.IHash) error
- func (s *State) MoveStateToHeight(dbheight uint32, newMinute int)
- func (s *State) MsgQueue() chan interfaces.IMsg
- func (s *State) Needed(eb interfaces.IEntryBlock) bool
- func (s *State) NetworkInvalidMsgQueue() chan interfaces.IMsg
- func (s *State) NetworkOutMsgQueue() interfaces.IQueue
- func (s *State) NewAck(msg interfaces.IMsg, balanceHash interfaces.IHash) interfaces.IMsg
- func (s *State) NextCommit(hash interfaces.IHash) interfaces.IMsg
- func (s *State) NoEntryYet(entryhash interfaces.IHash, ts interfaces.Timestamp) bool
- func (s *State) Print(a ...interface{}) (n int, err error)
- func (s *State) Println(a ...interface{}) (n int, err error)
- func (s *State) Process() (progress bool)
- func (s *State) ProcessAddServer(dbheight uint32, addServerMsg interfaces.IMsg) bool
- func (s *State) ProcessChangeServerKey(dbheight uint32, changeServerKeyMsg interfaces.IMsg) bool
- func (s *State) ProcessCommitChain(dbheight uint32, commitChain interfaces.IMsg) bool
- func (s *State) ProcessCommitEntry(dbheight uint32, commitEntry interfaces.IMsg) bool
- func (s *State) ProcessDBSig(dbheight uint32, msg interfaces.IMsg) bool
- func (s *State) ProcessDBlock(finishedDBlocks chan int, finishedEntries chan int, dbrcs []*ReCheck)
- func (s *State) ProcessEOM(dbheight uint32, msg interfaces.IMsg) bool
- func (s *State) ProcessInvalidMsgQueue()
- func (this *State) ProcessRecentFERChainEntries()
- func (s *State) ProcessRemoveServer(dbheight uint32, removeServerMsg interfaces.IMsg) bool
- func (s *State) ProcessRevealEntry(dbheight uint32, m interfaces.IMsg) (worked bool)
- func (s *State) PutCommit(hash interfaces.IHash, msg interfaces.IMsg)
- func (s *State) PutE(rt bool, adr [32]byte, v int64)
- func (s *State) PutF(rt bool, adr [32]byte, v int64)
- func (s *State) PutNewEBlocks(dbheight uint32, hash interfaces.IHash, eb interfaces.IEntryBlock)
- func (s *State) PutNewEntries(dbheight uint32, hash interfaces.IHash, e interfaces.IEntry)
- func (s *State) ReadCfg(filename string) interfaces.IFactomConfig
- func (s *State) RemoveAuditServer(dbheight uint32, hash interfaces.IHash)
- func (s *State) RemoveFedServer(dbheight uint32, hash interfaces.IHash)
- func (s *State) RepairAuthorities()
- func (s *State) RequestAndCollectMissingEntries()
- func (s *State) Reset()
- func (s *State) ReviewHolding()
- func (s *State) RunUploadController()
- func (s *State) Running() bool
- func (s *State) SendDBSig(dbheight uint32, vmIndex int)
- func (s *State) SendHeartBeat()
- func (s *State) SendManager()
- func (s *State) SetAuthoritySetString(authSet string)
- func (s *State) SetDBStateManagerCompletedHeight(height uint32) error
- func (s *State) SetDBStatesSent(sents []*interfaces.DBStateSent)
- func (s *State) SetDelay(delay int64)
- func (s *State) SetDirectoryBlockInSeconds(t int)
- func (s *State) SetDropRate(droprate int)
- func (s *State) SetEntryBlockDBHeightComplete(newHeight uint32)
- func (s *State) SetEntryBlockDBHeightProcessing(newHeight uint32)
- func (s *State) SetFactoidState(dbheight uint32, fs interfaces.IFactoidState)
- func (s *State) SetFactoshisPerEC(factoshisPerEC uint64)
- func (s *State) SetFaultTimeout(timeout int)
- func (s *State) SetFaultWait(wait int)
- func (s *State) SetHighestAck(dbht uint32)
- func (s *State) SetIdentityChainID(chainID interfaces.IHash)
- func (s *State) SetIsDoneReplaying()
- func (s *State) SetIsReplaying()
- func (s *State) SetLeaderTimestamp(ts interfaces.Timestamp)
- func (s *State) SetMessageFilterTimestamp(leaderTS interfaces.Timestamp)
- func (s *State) SetNetStateOff(net bool)
- func (s *State) SetOut(o bool)
- func (s *State) SetPendingSigningKey(p *primitives.PrivateKey)
- func (s *State) SetPort(port int)
- func (s *State) SetRpcAuthHash(authHash []byte)
- func (s *State) SetString()
- func (s *State) SetStringConsensus()
- func (s *State) SetStringQueues()
- func (s *State) SetTorrentUploader(setVal bool)
- func (s *State) SetUseTorrent(setVal bool)
- func (s *State) SetupCrossBootReplay(path string)
- func (s *State) ShortString() string
- func (s *State) Sign(b []byte) interfaces.IFullSignature
- func (s *State) SimGetSigKey() string
- func (s *State) SimSetNewKeys(p *primitives.PrivateKey)
- func (s *State) StartTorrentSyncing() error
- func (s *State) String() string
- func (s *State) SummaryHeader() string
- func (st *State) SyncIdentities(d *DBState)
- func (s *State) TallyReceived(msgType int)
- func (s *State) TallySent(msgType int)
- func (s *State) TickerQueue() chan int
- func (s *State) TimerMsgQueue() chan interfaces.IMsg
- func (s *State) TorrentUploader() bool
- func (s *State) TrimVMList(dbheight uint32, height uint32, vmIndex int)
- func (st *State) UpdateAuthSigningKeys(height uint32)
- func (st *State) UpdateAuthorityFromABEntry(entry interfaces.IABEntry) error
- func (s *State) UpdateECs(ec interfaces.IEntryCreditBlock)
- func (s *State) UpdateState() (progress bool)
- func (s *State) UploadDBState(dbheight uint32)
- func (s *State) UsingTorrent() bool
- func (s *State) Validate(msg interfaces.IMsg) (validToSend int, validToExec int)
- func (s *State) ValidatePrevious(dbheight uint32) error
- func (s *State) ValidatorLoop()
- func (st *State) VerifyAuthoritySignature(msg []byte, sig *[constants.SIGNATURE_LENGTH]byte, dbheight uint32) (rval int, err error)
- func (st *State) VerifyIsAuthority(cid interfaces.IHash) bool
- func (s *State) WriteEntries()
- type StateSaverStruct
- func (sss *StateSaverStruct) DeleteSaveState(networkName string) error
- func (sss *StateSaverStruct) LoadDBStateList(s *State, statelist *DBStateList, networkName string) error
- func (sss *StateSaverStruct) SaveDBStateList(s *State, ss *DBStateList, networkName string) error
- func (sss *StateSaverStruct) StopSaving()
- type UploadController
- type VM
- type WholeBlock
- func (wb *WholeBlock) AddEblock(eb interfaces.IEntryBlock)
- func (wb *WholeBlock) AddEntry(e interfaces.IEntry)
- func (wb *WholeBlock) AddIEBEntry(e interfaces.IEBEntry)
- func (wb *WholeBlock) BlockToDBStateMsg() interfaces.IMsg
- func (a *WholeBlock) IsSameAs(b *WholeBlock) (resp bool)
- func (wb *WholeBlock) MarshalBinary() (b []byte, err error)
- func (wb *WholeBlock) UnmarshalBinary(data []byte) (err error)
- func (wb *WholeBlock) UnmarshalBinaryData(data []byte) (newData []byte, err error)
- func (wb *WholeBlock) UnmarshalBinaryDataBuffer(buffer io.ReadSeeker, whence int) (read int64, err error)
Constants ¶
const BATCH_SIZE uint32 = 250
BATCH_SIZE is the amount of blocks per torrent
const Range = 60 // Double this for the period we protect, i.e. 120 means +/- 120 minutes
Variables ¶
var ( // Time window for identity to require registration: 24hours = 144 blocks TIME_WINDOW uint32 = 144 // Where all Identities register MAIN_FACTOM_IDENTITY_LIST = "888888001750ede0eff4b05f0c3f557890b256450cabbb84cada937f9c258327" )
var ( // Entry Syncing Controller ESMissingQueue = prometheus.NewGauge(prometheus.GaugeOpts{ Name: "factomd_state_es_missing_entry_queue", Help: "Number of known missing entries in our queue to find.", }) ESMissing = prometheus.NewGauge(prometheus.GaugeOpts{ Name: "factomd_state_es_missing_entries", Help: "Number of known missing entries", }) ESFound = prometheus.NewGauge(prometheus.GaugeOpts{ Name: "factomd_state_es_found_entries", Help: "Number of known missing entries found.", }) ESAsking = prometheus.NewGauge(prometheus.GaugeOpts{ Name: "factomd_state_es_asking_missing_entries", Help: "Number we are asking for of the known missing entries.", }) ESHighestAsking = prometheus.NewGauge(prometheus.GaugeOpts{ Name: "factomd_state_es_highest_asking_entries", Help: "Highest entry DBHeight which has has a request made.", }) ESHighestMissing = prometheus.NewGauge(prometheus.GaugeOpts{ Name: "factomd_state_es_highest_missing_entries", Help: "Highest DBHeight of the entries we know are missing.", }) ESFirstMissing = prometheus.NewGauge(prometheus.GaugeOpts{ Name: "factomd_state_es_first_missing_entries", Help: "First DBHeight with a missing entry", }) ESDBHTComplete = prometheus.NewGauge(prometheus.GaugeOpts{ Name: "factomd_state_es_entry_dbheight_complete", Help: "First DBHeight with a missing entry", }) ESAvgRequests = prometheus.NewGauge(prometheus.GaugeOpts{ Name: "factomd_state_es_average_requests", Help: "Average number of times we have had to request a missing entry", }) HighestAck = prometheus.NewGauge(prometheus.GaugeOpts{ Name: "factomd_state_highest_ack", Help: "Acknowledgement with the highest directory block height", }) HighestKnown = prometheus.NewGauge(prometheus.GaugeOpts{ Name: "factomd_state_highest_known", Help: "Highest known block (which can be different than the highest ack)", }) HighestSaved = prometheus.NewGauge(prometheus.GaugeOpts{ Name: "factomd_state_highest_saved", Help: "Highest saved block to the database", }) HighestCompleted = prometheus.NewGauge(prometheus.GaugeOpts{ Name: "factomd_state_highest_completed", Help: "Highest completed block, which may or may not be saved to the database", }) // TPS TotalTransactionPerSecond = prometheus.NewGauge(prometheus.GaugeOpts{ Name: "factomd_state_txrate_total_tps", Help: "Total transactions over life of node", }) InstantTransactionPerSecond = prometheus.NewGauge(prometheus.GaugeOpts{ Name: "factomd_state_txrate_instant_tps", Help: "Total transactions over life of node weighted for last 3 seconds", }) // Queues CurrentMessageQueueInMsgGeneralVec = prometheus.NewGaugeVec(prometheus.GaugeOpts{ Name: "factomd_state_queue_current_general_inmsg_vec", Help: "Instrumenting the current inmsg queue ", }, []string{"message"}) TotalMessageQueueInMsgGeneralVec = prometheus.NewGaugeVec(prometheus.GaugeOpts{ Name: "factomd_state_queue_total_general_inmsg_vec", Help: "Instrumenting the inmsg queue ", }, []string{"message"}) CurrentMessageQueueApiGeneralVec = prometheus.NewGaugeVec(prometheus.GaugeOpts{ Name: "factomd_state_queue_current_general_api_vec", Help: "Instrumenting the current API queue ", }, []string{"message"}) TotalMessageQueueApiGeneralVec = prometheus.NewGaugeVec(prometheus.GaugeOpts{ Name: "factomd_state_queue_total_general_api_vec", Help: "Instrumenting the API queue ", }, []string{"message"}) TotalMessageQueueNetOutMsgGeneralVec = prometheus.NewGaugeVec(prometheus.GaugeOpts{ Name: "factomd_state_queue_total_general_netoutmsg_vec", Help: "Instrumenting the netoutmsg queue ", }, []string{"message"}) // MsgQueue chan TotalMsgQueueInputs = prometheus.NewCounter(prometheus.CounterOpts{ Name: "factomd_state_msgqueue_total_inputs", Help: "Tally of total messages gone into MsgQueue (useful for rating)", }) TotalMsgQueueOutputs = prometheus.NewCounter(prometheus.CounterOpts{ Name: "factomd_state_msgqueue_total_outputs", Help: "Tally of total messages drained out of MsgQueue (useful for rating)", }) // Holding Queue TotalHoldingQueueInputs = prometheus.NewCounter(prometheus.CounterOpts{ Name: "factomd_state_holding_queue_total_inputs", Help: "Tally of total messages gone into Holding (useful for rating)", }) TotalHoldingQueueOutputs = prometheus.NewCounter(prometheus.CounterOpts{ Name: "factomd_state_holding_queue_total_outputs", Help: "Tally of total messages drained out of Holding (useful for rating)", }) TotalHoldingQueueRecycles = prometheus.NewCounter(prometheus.CounterOpts{ Name: "factomd_state_holding_queue_total_recycles", Help: "Tally of total messages recycled thru Holding (useful for rating)", }) HoldingQueueDBSigInputs = prometheus.NewCounter(prometheus.CounterOpts{ Name: "factomd_state_holding_queue_dbsig_inputs", Help: "Tally of DBSig messages gone into Holding (useful for rating)", }) HoldingQueueDBSigOutputs = prometheus.NewCounter(prometheus.CounterOpts{ Name: "factomd_state_holding_queue_dbsig_outputs", Help: "Tally of DBSig messages drained out of Holding", }) HoldingQueueCommitEntryInputs = prometheus.NewCounter(prometheus.CounterOpts{ Name: "factomd_state_holding_queue_commitentry_inputs", Help: "Tally of CommitEntry messages gone into Holding (useful for rating)", }) HoldingQueueCommitEntryOutputs = prometheus.NewCounter(prometheus.CounterOpts{ Name: "factomd_state_holding_queue_commitentry_outputs", Help: "Tally of CommitEntry messages drained out of Holding", }) HoldingQueueCommitChainInputs = prometheus.NewCounter(prometheus.CounterOpts{ Name: "factomd_state_holding_queue_commitchain_inputs", Help: "Tally of CommitChain messages gone into Holding (useful for rating)", }) HoldingQueueCommitChainOutputs = prometheus.NewCounter(prometheus.CounterOpts{ Name: "factomd_state_holding_queue_commitchain_outputs", Help: "Tally of CommitChain messages drained out of Holding", }) HoldingQueueRevealEntryInputs = prometheus.NewCounter(prometheus.CounterOpts{ Name: "factomd_state_holding_queue_revealentry_inputs", Help: "Tally of RevealEntry messages gone into Holding (useful for rating)", }) HoldingQueueRevealEntryOutputs = prometheus.NewCounter(prometheus.CounterOpts{ Name: "factomd_state_holding_queue_revealentry_outputs", Help: "Tally of RevealEntry messages drained out of Holding", }) // Acks Queue TotalAcksInputs = prometheus.NewCounter(prometheus.CounterOpts{ Name: "factomd_state_acks_total_inputs", Help: "Tally of total messages gone into Acks (useful for rating)", }) TotalAcksOutputs = prometheus.NewCounter(prometheus.CounterOpts{ Name: "factomd_state_acks_total_outputs", Help: "Tally of total messages drained out of Acks (useful for rating)", }) // Commits map TotalCommitsInputs = prometheus.NewCounter(prometheus.CounterOpts{ Name: "factomd_state_commits_total_inputs", Help: "Tally of total messages gone into Commits (useful for rating)", }) TotalCommitsOutputs = prometheus.NewCounter(prometheus.CounterOpts{ Name: "factomd_state_commits_total_outputs", Help: "Tally of total messages drained out of Commits (useful for rating)", }) // XReview Queue TotalXReviewQueueInputs = prometheus.NewCounter(prometheus.CounterOpts{ Name: "factomd_state_xreview_queue_total_inputs", Help: "Tally of total messages gone into XReview (useful for rating)", }) TotalXReviewQueueOutputs = prometheus.NewCounter(prometheus.CounterOpts{ Name: "factomd_state_xreview_queue_total_outputs", Help: "Tally of total messages drained out of XReview (useful for rating)", }) // Executions LeaderExecutions = prometheus.NewCounter(prometheus.CounterOpts{ Name: "factomd_state_leader_executions", Help: "Tally of total messages executed via LeaderExecute", }) FollowerExecutions = prometheus.NewCounter(prometheus.CounterOpts{ Name: "factomd_state_follower_executions", Help: "Tally of total messages executed via FollowerExecute", }) LeaderEOMExecutions = prometheus.NewCounter(prometheus.CounterOpts{ Name: "factomd_state_leader_eom_executions", Help: "Tally of total messages executed via LeaderExecuteEOM", }) FollowerEOMExecutions = prometheus.NewCounter(prometheus.CounterOpts{ Name: "factomd_state_follower_eom_executions", Help: "Tally of total messages executed via FollowerExecuteEOM", }) FollowerMissingMsgExecutions = prometheus.NewCounter(prometheus.CounterOpts{ Name: "factomd_state_follower_mm_executions", Help: "Tally of total messages executed via FollowerExecuteMissingMsg", }) // ProcessList TotalProcessListInputs = prometheus.NewCounter(prometheus.CounterOpts{ Name: "factomd_state_process_list_inputs", Help: "Tally of total messages gone into ProcessLists (useful for rating)", }) TotalProcessListProcesses = prometheus.NewCounter(prometheus.CounterOpts{ Name: "factomd_state_process_list_processes", Help: "Tally of total messages processed from ProcessLists (useful for rating)", }) TotalProcessEOMs = prometheus.NewCounter(prometheus.CounterOpts{ Name: "factomd_state_process_eom_processes", Help: "Tally of EOM messages processed from ProcessLists (useful for rating)", }) // Durations TotalReviewHoldingTime = prometheus.NewGauge(prometheus.GaugeOpts{ Name: "factomd_state_review_holding_time", Help: "Time spent in ReviewHolding()", }) TotalProcessXReviewTime = prometheus.NewGauge(prometheus.GaugeOpts{ Name: "factomd_state_process_xreview_time", Help: "Time spent Processing XReview", }) TotalProcessProcChanTime = prometheus.NewGauge(prometheus.GaugeOpts{ Name: "factomd_state_process_proc_chan_time", Help: "Time spent Processing Process Chan", }) TotalEmptyLoopTime = prometheus.NewGauge(prometheus.GaugeOpts{ Name: "factomd_state_empty_loop_time", Help: "Time spent in empty loop", }) TotalAckLoopTime = prometheus.NewGauge(prometheus.GaugeOpts{ Name: "factomd_state_ack_loop_time", Help: "Time spent in ack loop", }) TotalExecuteMsgTime = prometheus.NewGauge(prometheus.GaugeOpts{ Name: "factomd_state_execute_msg_time", Help: "Time spent in executeMsg", }) )
var ControlPanelAllowedSize int = 2
var FACTOID_CHAINID_HASH = primitives.NewHash(constants.FACTOID_CHAINID)
var MMR_enable bool = true
Used by debug code only
var ValidationDebug bool = false
Functions ¶
func BytesToUint32 ¶
func CheckDBKeyMR ¶
*************************************************************** Checkpoint DBKeyMR ***************************************************************
func CheckGrants ¶
func CheckGrants()
func CheckLength ¶
func DeleteFile ¶
func FaultCheck ¶
func FaultCheck(pl *ProcessList)
func FedServerVM ¶
func GenerateGenesisBlocks ¶
func GenerateGenesisBlocks(networkID uint32, bootstrapIdentity interfaces.IHash) (interfaces.IDirectoryBlock, interfaces.IAdminBlock, interfaces.IFBlock, interfaces.IEntryCreditBlock)
func GetGrantPayoutsFor ¶
func GetGrantPayoutsFor(currentDBHeight uint32) []interfaces.ITransAddress
return a (possibly empty) of coinbase payouts to be scheduled at this height
func GetMapHash ¶
func GetMapHash(bmap map[[32]byte]int64) interfaces.IHash
func LoadDatabase ¶
func LoadDatabase(s *State)
func MakeMap ¶
This function will be replaced by a calculation from the Matryoshka hashes from the servers but for now, we are just going to make it a function of the dbheight. serverMap[minute][vmIndex] => Index of the Federated Server responsible for that minute
func Minutes ¶
Remember that Unix time is in seconds since 1970. This code wants to be handed time in seconds.
func NetworkIDToFilename ¶
func PopBalanceMap ¶
func PopBalanceMap(buf *primitives.Buffer) (map[[32]byte]int64, error)
func PopBucketMap ¶
func PopBucketMap(buf *primitives.Buffer) (map[[32]byte]int, error)
func PrintState ¶
func PrintState(state *State)
func ProcessIdentityToAdminBlock ¶
func ProcessIdentityToAdminBlock(st *State, chainID interfaces.IHash, servertype int) bool
Called by AddServer Message
func PushBalanceMap ¶
func PushBalanceMap(b *primitives.Buffer, m map[[32]byte]int64) error
func PushBucketMap ¶
func PushBucketMap(b *primitives.Buffer, m map[[32]byte]int) error
func RandomServer ¶
func RandomServer() interfaces.IServer
func RegisterPrometheus ¶
func RegisterPrometheus()
RegisterPrometheus registers the variables to be exposed. This can only be run once, hence the boolean flag to prevent panics if launched more than once. This is called in NetStart
func Sort ¶
func Sort(serv []interfaces.IServer) bool
duplicate function in election but cannot import because of a dependency loop
func SortServers ¶
func SortServers(servers []interfaces.IServer) []interfaces.IServer
func Uint32ToBytes ¶
Types ¶
type APIMSGQueue ¶
type APIMSGQueue chan interfaces.IMsg
APIMSGQueue counts incoming and outgoing messages for API queue
func NewAPIQueue ¶
func NewAPIQueue(capacity int) APIMSGQueue
func (APIMSGQueue) BlockingDequeue ¶
func (q APIMSGQueue) BlockingDequeue() interfaces.IMsg
BlockingDequeue will block until it retrieves from queue
func (APIMSGQueue) Dequeue ¶
func (q APIMSGQueue) Dequeue() interfaces.IMsg
Dequeue removes an item from channel and instruments based on type. Returns nil if nothing in queue
func (APIMSGQueue) Enqueue ¶
func (q APIMSGQueue) Enqueue(m interfaces.IMsg)
Enqueue adds item to channel and instruments based on type
type CrossReplayFilter ¶
type CrossReplayFilter struct { Currentheight int LowestHeight int // contains filtered or unexported fields }
CrossReplayFilter checks for old messages across reboots based on the salts inside the ack messages. It saves all salts of leaders it sees while running. On reboot, it will ignore all messages that have an old salt (for a set duration). After the duration, no new salts are saved (extra overhead we don't need) and will stop ignoring messages based on salts (so a single leader reboot will rejoin the network).
func NewCrossReplayFilter ¶
func NewCrossReplayFilter(path string) *CrossReplayFilter
func (*CrossReplayFilter) AddSalt ¶
func (c *CrossReplayFilter) AddSalt(height uint32, salt [8]byte) error
AddSalt will add the salt to the replay filter that is used on reboot
func (*CrossReplayFilter) Close ¶
func (c *CrossReplayFilter) Close()
func (*CrossReplayFilter) ExistOldSalt ¶
func (c *CrossReplayFilter) ExistOldSalt(salt [8]byte) bool
ExistOldSalt checks to see if the salt existed on the previous boot
func (*CrossReplayFilter) ExistSalt ¶
func (c *CrossReplayFilter) ExistSalt(salt [8]byte) (bool, error)
Exists check if the hash is in the replay filter, and if it encounters a db error, it will report false
func (*CrossReplayFilter) Run ¶
func (c *CrossReplayFilter) Run()
Run is a simple loop that ensures we discard old data we do not need.
type DBSig ¶
type DBSig struct { ChainID interfaces.IHash Signature interfaces.IFullSignature VMIndex int }
Data needed to add to admin block
type DBState ¶
type DBState struct { IsNew bool SaveStruct *SaveState DBHash interfaces.IHash ABHash interfaces.IHash FBHash interfaces.IHash ECHash interfaces.IHash DirectoryBlock interfaces.IDirectoryBlock AdminBlock interfaces.IAdminBlock FactoidBlock interfaces.IFBlock EntryCreditBlock interfaces.IEntryCreditBlock EntryBlocks []interfaces.IEntryBlock Entries []interfaces.IEBEntry Repeat bool ReadyToSave bool Locked bool Signed bool Saved bool Added interfaces.Timestamp FinalExchangeRate uint64 NextTimestamp interfaces.Timestamp }
func (*DBState) MarshalBinary ¶
func (*DBState) UnmarshalBinary ¶
func (*DBState) UnmarshalBinaryData ¶
func (*DBState) ValidNext ¶
func (d *DBState) ValidNext(state *State, next *messages.DBStateMsg) int
Validate this directory block given the next Directory Block. Need to check the signatures as being from the authority set, and valid. Also check that this DBState holds a previous KeyMR that matches the previous DBState KeyMR.
Return a -1 on failure.
type DBStateList ¶
type DBStateList struct { LastEnd int LastBegin int TimeToAsk interfaces.Timestamp ProcessHeight uint32 SavedHeight uint32 State *State Base uint32 Complete uint32 DBStates []*DBState }
func (*DBStateList) Catchup ¶
func (list *DBStateList) Catchup(justDoIt bool)
Once a second at most, we check to see if we need to pull down some blocks to catch up.
func (*DBStateList) FixupLinks ¶
func (list *DBStateList) FixupLinks(p *DBState, d *DBState) (progress bool)
p is previous, d is current
func (*DBStateList) Get ¶
func (list *DBStateList) Get(height int) *DBState
func (*DBStateList) GetHighestCompletedBlk ¶
func (list *DBStateList) GetHighestCompletedBlk() uint32
func (*DBStateList) GetHighestLockedSignedAndSavesBlk ¶
func (list *DBStateList) GetHighestLockedSignedAndSavesBlk() uint32
func (*DBStateList) GetHighestSavedBlk ¶
func (list *DBStateList) GetHighestSavedBlk() uint32
func (*DBStateList) GetHighestSignedBlk ¶
func (list *DBStateList) GetHighestSignedBlk() uint32
func (*DBStateList) Highest ¶
func (list *DBStateList) Highest() uint32
func (*DBStateList) Init ¶
func (dbsl *DBStateList) Init()
func (*DBStateList) IsSameAs ¶
func (a *DBStateList) IsSameAs(b *DBStateList) bool
func (*DBStateList) Last ¶
func (list *DBStateList) Last() *DBState
func (*DBStateList) MarshalBinary ¶
func (dbsl *DBStateList) MarshalBinary() (rval []byte, err error)
func (*DBStateList) NewDBState ¶
func (list *DBStateList) NewDBState(isNew bool, directoryBlock interfaces.IDirectoryBlock, adminBlock interfaces.IAdminBlock, factoidBlock interfaces.IFBlock, entryCreditBlock interfaces.IEntryCreditBlock, eBlocks []interfaces.IEntryBlock, entries []interfaces.IEBEntry) *DBState
func (*DBStateList) ProcessBlocks ¶
func (list *DBStateList) ProcessBlocks(d *DBState) (progress bool)
func (*DBStateList) Put ¶
func (list *DBStateList) Put(dbState *DBState) bool
Return true if we actually added the dbstate to the list
func (*DBStateList) SaveDBStateToDB ¶
func (list *DBStateList) SaveDBStateToDB(d *DBState) (progress bool)
func (*DBStateList) SignDB ¶
func (list *DBStateList) SignDB(d *DBState) (process bool)
We don't really do the signing here, but just check that we have all the signatures. If we do, we count that as progress.
func (*DBStateList) String ¶
func (list *DBStateList) String() string
func (*DBStateList) UnmarshalBinary ¶
func (dbsl *DBStateList) UnmarshalBinary(p []byte) error
func (*DBStateList) UnmarshalBinaryData ¶
func (dbsl *DBStateList) UnmarshalBinaryData(p []byte) (newData []byte, err error)
func (*DBStateList) UpdateState ¶
func (list *DBStateList) UpdateState() (progress bool)
func (*DBStateList) WriteDBStateToDebugFile ¶
func (list *DBStateList) WriteDBStateToDebugFile(d *DBState)
WriteDBStateToDebugFile will write the marshaled dbstate to a file alongside the database. This can be written on the processblocks, so in the event the block does not get written to disk in the event of a stall, the dbstate can be analyzed. The written dbstate does NOT include entries.
type DisplayState ¶
type DisplayState struct { NodeName string ControlPanelPort int ControlPanelSetting int // DB Info CurrentNodeHeight uint32 CurrentLeaderHeight uint32 CurrentEBDBHeight uint32 LeaderHeight uint32 LastDirectoryBlock interfaces.IDirectoryBlock // Identity Info IdentityChainID interfaces.IHash Identities []*Identity Authorities []*Authority PublicKey *primitives.PublicKey // Process List PLFactoid []FactoidTransaction PLEntry []EntryTransaction // DataDump RawSummary string PrintMap string ProcessList0 string ProcessList string ProcessList2 string Election string SimElection string SyncingState [256]string SyncingStateCurrent int }
This struct will contain all information wanted by the control panel from the state.
func DeepStateDisplayCopy ¶
func DeepStateDisplayCopy(s *State) (*DisplayState, error)
func DeepStateDisplayCopyDifference ¶
func DeepStateDisplayCopyDifference(s *State, prev *DisplayState) (*DisplayState, error)
func NewDisplayState ¶
func NewDisplayState() *DisplayState
func (*DisplayState) Clone ¶
func (d *DisplayState) Clone() *DisplayState
Used for display dump. Allows a clone of the display state to be made
func (*DisplayState) CopyDirectoryBlock ¶
func (ds *DisplayState) CopyDirectoryBlock(s *State, prev *DisplayState, height uint32)
type ElectionQueue ¶
type ElectionQueue chan interfaces.IMsg
ElectionQueue counts incoming and outgoing messages for inmsg queue
func NewElectionQueue ¶
func NewElectionQueue(capacity int) ElectionQueue
func (ElectionQueue) BlockingDequeue ¶
func (q ElectionQueue) BlockingDequeue() interfaces.IMsg
BlockingDequeue will block until it retrieves from queue
func (ElectionQueue) Dequeue ¶
func (q ElectionQueue) Dequeue() interfaces.IMsg
Dequeue removes an item from channel and instruments based on type. Returns nil if nothing in queue
func (ElectionQueue) Enqueue ¶
func (q ElectionQueue) Enqueue(m interfaces.IMsg)
Enqueue adds item to channel and instruments based on type
type EntrySync ¶
type EntrySync struct { MissingDBlockEntries chan []*ReCheck // We don't have these entries. Each list is from a directory block. DBHeightBase int // This is the highest block with entries not yet checked or are missing TotalEntries int // Total Entries in the database SyncingBlocks map[int][]*ReCheck // Map of Directory blocks by height SendRequest chan *messages.MissingData // Channel for messages being requested Processing int // Directory block we are processing EntriesProcessing int // Total of Entries being processed EntryRequests int // Requests made EntriesFound int // Entries found DirectoryBlocksInProcess int // Number of Directory blocks we are processing // contains filtered or unexported fields }
type EntryTransaction ¶
type EntryUpdate ¶
type EntryUpdate struct { Hash interfaces.IHash Timestamp interfaces.Timestamp }
type FactoidState ¶
type FactoidState struct { DBHeight uint32 State *State CurrentBlock interfaces.IFBlock Wallet interfaces.ISCWallet }
func (*FactoidState) AddECBlock ¶
func (fs *FactoidState) AddECBlock(blk interfaces.IEntryCreditBlock) error
func (*FactoidState) AddTransaction ¶
func (fs *FactoidState) AddTransaction(index int, trans interfaces.ITransaction) error
Only add valid transactions to the current
func (*FactoidState) AddTransactionBlock ¶
func (fs *FactoidState) AddTransactionBlock(blk interfaces.IFBlock) error
When we are playing catchup, adding the transaction block is a pretty useful feature.
func (*FactoidState) EndOfPeriod ¶
func (fs *FactoidState) EndOfPeriod(period int)
func (*FactoidState) GetBalanceHash ¶
func (fs *FactoidState) GetBalanceHash(TempBalanceHash bool) (rval interfaces.IHash)
GetBalanceHash() Compute either a Hash of the temporary balance hash map, or the Permanent Balance hash map
func (*FactoidState) GetCoinbaseTransaction ¶
func (fs *FactoidState) GetCoinbaseTransaction(dbheight uint32, ftime interfaces.Timestamp) interfaces.ITransaction
func (*FactoidState) GetCurrentBlock ¶
func (fs *FactoidState) GetCurrentBlock() interfaces.IFBlock
func (*FactoidState) GetECBalance ¶
func (fs *FactoidState) GetECBalance(address [32]byte) int64
func (*FactoidState) GetFactoidBalance ¶
func (fs *FactoidState) GetFactoidBalance(address [32]byte) int64
func (*FactoidState) GetMultipleECBalances ¶
func (*FactoidState) GetMultipleFactoidBalances ¶
func (*FactoidState) ProcessEndOfBlock ¶
func (fs *FactoidState) ProcessEndOfBlock(state interfaces.IState)
End of Block means packing the current block away, and setting up the next
func (*FactoidState) UpdateECTransaction ¶
func (fs *FactoidState) UpdateECTransaction(rt bool, trans interfaces.IECBlockEntry) error
func (*FactoidState) UpdateTransaction ¶
func (fs *FactoidState) UpdateTransaction(rt bool, trans interfaces.ITransaction) error
Assumes validation has already been done.
func (*FactoidState) Validate ¶
func (fs *FactoidState) Validate(index int, trans interfaces.ITransaction) error
Returns an error message about what is wrong with the transaction if it is invalid, otherwise you are good to go.
func (*FactoidState) ValidateTransactionAge ¶
func (fs *FactoidState) ValidateTransactionAge(trans interfaces.ITransaction) error
Checks the transaction timestamp for validity in being included in the current No node has any responsibility to forward on transactions that do not fall within the timeframe around a block defined by TRANSACTION_PRIOR_LIMIT and TRANSACTION_POST_LIMIT
type FactoidTransaction ¶
type FaultCore ¶
type FaultCore struct { // The following 5 fields represent the "Core" of the message // This should match the Core of FullServerFault messages ServerID interfaces.IHash AuditServerID interfaces.IHash VMIndex byte DBHeight uint32 Height uint32 SystemHeight uint32 Timestamp interfaces.Timestamp }
func (*FaultCore) GetHash ¶
func (fc *FaultCore) GetHash() (rval interfaces.IHash)
func (*FaultCore) MarshalCore ¶
type GeneralMSGQueue ¶
type GeneralMSGQueue chan interfaces.IMsg
Returning this is non-instrumented way
func (GeneralMSGQueue) BlockingDequeue ¶
func (q GeneralMSGQueue) BlockingDequeue() interfaces.IMsg
func (GeneralMSGQueue) Dequeue ¶
func (q GeneralMSGQueue) Dequeue() interfaces.IMsg
Dequeue returns the channel dequeue
func (GeneralMSGQueue) Enqueue ¶
func (q GeneralMSGQueue) Enqueue(t interfaces.IMsg)
Enqueue adds item to channel
type HardGrant ¶
type HardGrant struct { DBh uint32 Amount uint64 Address interfaces.IAddress }
func GetHardCodedGrants ¶
func GetHardCodedGrants() []HardGrant
Return the Hard Coded Grants. Buried in an func so other code cannot easily Address the array and change it
type IPrometheusRateMethods ¶
type IPrometheusRateMethods interface { // Arrival SetArrivalInstantAvg(v float64) SetArrivalTotalAvg(v float64) SetArrivalBackup(v float64) SetMovingArrival(v float64) // Complete SetCompleteInstantAvg(v float64) SetCompleteTotalAvg(v float64) SetMovingComplete(v float64) }
IPrometheusRateMethods indicated which prometheus counters/gauges to set
type IdentityEntry ¶
type IdentityEntry struct { Entry interfaces.IEBEntry Timestamp interfaces.Timestamp Blockheight uint32 }
type InMsgMSGQueue ¶
type InMsgMSGQueue chan interfaces.IMsg
InMsgMSGQueue counts incoming and outgoing messages for inmsg queue
func NewInMsgQueue ¶
func NewInMsgQueue(capacity int) InMsgMSGQueue
func (InMsgMSGQueue) BlockingDequeue ¶
func (q InMsgMSGQueue) BlockingDequeue() interfaces.IMsg
BlockingDequeue will block until it retrieves from queue
func (InMsgMSGQueue) Dequeue ¶
func (q InMsgMSGQueue) Dequeue() interfaces.IMsg
Dequeue removes an item from channel and instruments based on type. Returns nil if nothing in queue
func (InMsgMSGQueue) Enqueue ¶
func (q InMsgMSGQueue) Enqueue(m interfaces.IMsg)
Enqueue adds item to channel and instruments based on type
type MarshalableUint32 ¶
type MarshalableUint32 uint32
func (*MarshalableUint32) MarshalBinary ¶
func (m *MarshalableUint32) MarshalBinary() (rval []byte, err error)
func (*MarshalableUint32) UnmarshalBinary ¶
func (m *MarshalableUint32) UnmarshalBinary(data []byte) error
func (*MarshalableUint32) UnmarshalBinaryData ¶
func (m *MarshalableUint32) UnmarshalBinaryData(data []byte) ([]byte, error)
type MissingEntry ¶
type MissingEntry struct { Cnt int LastTime time.Time EBHash interfaces.IHash EntryHash interfaces.IHash DBHeight uint32 }
func RandomMissingEntry ¶
func RandomMissingEntry() *MissingEntry
func (*MissingEntry) IsSameAs ¶
func (s *MissingEntry) IsSameAs(b *MissingEntry) bool
func (*MissingEntry) MarshalBinary ¶
func (s *MissingEntry) MarshalBinary() (rval []byte, err error)
func (*MissingEntry) UnmarshalBinary ¶
func (s *MissingEntry) UnmarshalBinary(p []byte) error
func (*MissingEntry) UnmarshalBinaryData ¶
func (s *MissingEntry) UnmarshalBinaryData(p []byte) (newData []byte, err error)
type MissingEntryBlock ¶
type MissingEntryBlock struct { EBHash interfaces.IHash DBHeight uint32 }
func RandomMissingEntryBlock ¶
func RandomMissingEntryBlock() *MissingEntryBlock
func (*MissingEntryBlock) IsSameAs ¶
func (s *MissingEntryBlock) IsSameAs(b *MissingEntryBlock) bool
func (*MissingEntryBlock) MarshalBinary ¶
func (s *MissingEntryBlock) MarshalBinary() (rval []byte, err error)
func (*MissingEntryBlock) UnmarshalBinary ¶
func (s *MissingEntryBlock) UnmarshalBinary(p []byte) error
func (*MissingEntryBlock) UnmarshalBinaryData ¶
func (s *MissingEntryBlock) UnmarshalBinaryData(p []byte) (newData []byte, err error)
type MovingAverage ¶
type MovingAverage struct { Window int // contains filtered or unexported fields }
func NewMovingAverage ¶
func NewMovingAverage(window int) *MovingAverage
func (*MovingAverage) Add ¶
func (ma *MovingAverage) Add(val float64)
func (*MovingAverage) Avg ¶
func (ma *MovingAverage) Avg() float64
type NetOutMsgQueue ¶
type NetOutMsgQueue chan interfaces.IMsg
NetOutMsgQueue counts incoming and outgoing messages for netout queue
func NewNetOutMsgQueue ¶
func NewNetOutMsgQueue(capacity int) NetOutMsgQueue
func (NetOutMsgQueue) BlockingDequeue ¶
func (q NetOutMsgQueue) BlockingDequeue() interfaces.IMsg
BlockingDequeue will block until it retrieves from queue
func (NetOutMsgQueue) Dequeue ¶
func (q NetOutMsgQueue) Dequeue() interfaces.IMsg
Dequeue removes an item from channel and instruments based on type. Returns nil if nothing in queue
func (NetOutMsgQueue) Enqueue ¶
func (q NetOutMsgQueue) Enqueue(m interfaces.IMsg)
Enqueue adds item to channel and instruments based on type
type ProcessList ¶
type ProcessList struct { DBHeight uint32 // The directory block height for these lists // Temporary balances from updating transactions in real time. FactoidBalancesT map[[32]byte]int64 FactoidBalancesTMutex sync.Mutex ECBalancesT map[[32]byte]int64 ECBalancesTMutex sync.Mutex State *State VMs []*VM // Process list for each server (up to 32) ServerMap [10][64]int // Map of FedServers to all Servers for each minute System VM // System Faults and other system wide messages SysHighest int // messages processed in this list OldMsgs map[[32]byte]interfaces.IMsg // Chains that are executed, but not processed. There is a small window of a pending chain that the ack // will pass and the chainhead will fail. This covers that window. This is only used by WSAPI, // do not use it anywhere internally. PendingChainHeads *SafeMsgMap OldAcks map[[32]byte]interfaces.IMsg // Entry Blocks added within 10 minutes (follower and leader) NewEBlocks map[[32]byte]interfaces.IEntryBlock NewEntriesMutex sync.RWMutex NewEntries map[[32]byte]interfaces.IEntry // State information about the directory block while it is under construction. We may // have to start building the next block while still building the previous block. AdminBlock interfaces.IAdminBlock EntryCreditBlock interfaces.IEntryCreditBlock DirectoryBlock interfaces.IDirectoryBlock // Number of Servers acknowledged by Factom Matryoshka []interfaces.IHash // Reverse Hash AuditServers []interfaces.IServer // List of Audit Servers FedServers []interfaces.IServer // List of Federated Servers // The Fedlist and Audlist at the START of the block. Server faults // can change the list, and we can calculate the deltas at the end StartingAuditServers []interfaces.IServer // List of Audit Servers StartingFedServers []interfaces.IServer // List of Federated Servers // DB Sigs DBSignatures []DBSig DBSigAlreadySent bool NextHeightToProcess [64]int // contains filtered or unexported fields }
func NewProcessList ¶
func NewProcessList(state interfaces.IState, previous *ProcessList, dbheight uint32) *ProcessList
func (*ProcessList) AddAuditServer ¶
func (p *ProcessList) AddAuditServer(identityChainID interfaces.IHash) int
Add the given serverChain to this processlist as an Audit Server, and return the server index number of the added server
func (*ProcessList) AddDBSig ¶
func (p *ProcessList) AddDBSig(serverID interfaces.IHash, sig interfaces.IFullSignature)
func (*ProcessList) AddFedServer ¶
func (p *ProcessList) AddFedServer(identityChainID interfaces.IHash) int
Add the given serverChain to this processlist as a Federated Server, and return the server index number of the added server
func (*ProcessList) AddNewEBlocks ¶
func (p *ProcessList) AddNewEBlocks(key interfaces.IHash, value interfaces.IEntryBlock)
func (*ProcessList) AddNewEntry ¶
func (p *ProcessList) AddNewEntry(key interfaces.IHash, value interfaces.IEntry)
func (*ProcessList) AddOldMsgs ¶
func (p *ProcessList) AddOldMsgs(m interfaces.IMsg)
func (*ProcessList) AddToProcessList ¶
func (p *ProcessList) AddToProcessList(s *State, ack *messages.Ack, m interfaces.IMsg)
func (*ProcessList) CheckDiffSigTally ¶
func (p *ProcessList) CheckDiffSigTally() bool
func (*ProcessList) Complete ¶
func (p *ProcessList) Complete() bool
func (*ProcessList) ContainsDBSig ¶
func (p *ProcessList) ContainsDBSig(serverID interfaces.IHash) bool
func (*ProcessList) FedServerFor ¶
func (p *ProcessList) FedServerFor(minute int, hash []byte) interfaces.IServer
Returns the Federated Server responsible for this hash in this minute
func (*ProcessList) GetAckAt ¶
func (p *ProcessList) GetAckAt(vmIndex int, height int) *messages.Ack
Given a server index, return the last Ack
func (*ProcessList) GetAuditServerIndexHash ¶
func (p *ProcessList) GetAuditServerIndexHash(identityChainID interfaces.IHash) (bool, int)
Returns true and the index of this server, or false and the insertion point for this server
func (*ProcessList) GetDBHeight ¶
func (p *ProcessList) GetDBHeight() uint32
func (*ProcessList) GetFedServerIndexHash ¶
func (p *ProcessList) GetFedServerIndexHash(identityChainID interfaces.IHash) (bool, int)
Returns true and the index of this server, or false and the insertion point for this server
func (*ProcessList) GetKeysNewEntries ¶
func (p *ProcessList) GetKeysNewEntries() (keys [][32]byte)
func (*ProcessList) GetNewEBlocks ¶
func (p *ProcessList) GetNewEBlocks(key interfaces.IHash) interfaces.IEntryBlock
func (*ProcessList) GetNewEntry ¶
func (p *ProcessList) GetNewEntry(key [32]byte) interfaces.IEntry
func (*ProcessList) GetOldAck ¶
func (p *ProcessList) GetOldAck(key interfaces.IHash) interfaces.IMsg
func (*ProcessList) GetVMStatsForFedServer ¶
func (*ProcessList) GetVirtualServers ¶
func (p *ProcessList) GetVirtualServers(minute int, identityChainID interfaces.IHash) (found bool, index int)
func (*ProcessList) IncrementDiffSigTally ¶
func (p *ProcessList) IncrementDiffSigTally()
func (*ProcessList) IsPendingChainHead ¶
func (p *ProcessList) IsPendingChainHead(chainid interfaces.IHash) bool
IsPendingChainHead returns if a chainhead is about to be updated (In PL)
func (*ProcessList) LenNewEntries ¶
func (p *ProcessList) LenNewEntries() int
func (*ProcessList) LogPrintLeaders ¶
func (p *ProcessList) LogPrintLeaders(log string)
func (*ProcessList) MakeMap ¶
func (p *ProcessList) MakeMap()
func (*ProcessList) PrintMap ¶
func (p *ProcessList) PrintMap() string
This function will be replaced by a calculation from the Matryoshka hashes from the servers but for now, we are just going to make it a function of the dbheight.
func (*ProcessList) Process ¶
func (p *ProcessList) Process(s *State) (progress bool)
Process messages and update our state.
func (*ProcessList) RemoveAuditServerHash ¶
func (p *ProcessList) RemoveAuditServerHash(identityChainID interfaces.IHash)
Remove the given serverChain from this processlist's Audit Servers
func (*ProcessList) RemoveFedServerHash ¶
func (p *ProcessList) RemoveFedServerHash(identityChainID interfaces.IHash)
Remove the given serverChain from this processlist's Federated Servers
func (*ProcessList) Reset ¶
func (p *ProcessList) Reset() bool
Intended to let a demoted leader come back before the next DB state but interfered with boot under load so disable for now that means demoted leaders are not sane till the next DBState (up to 10 minutes). Maybe revisit after the missing message storms are fixed.
func (*ProcessList) ResetDiffSigTally ¶
func (p *ProcessList) ResetDiffSigTally()
func (*ProcessList) SetStartingAuthoritySet ¶
func (p *ProcessList) SetStartingAuthoritySet()
Will set the starting fed/aud list for delta comparison at the end of the block
func (*ProcessList) SortAuditServers ¶
func (p *ProcessList) SortAuditServers()
func (*ProcessList) SortDBSigs ¶
func (p *ProcessList) SortDBSigs()
func (*ProcessList) SortFedServers ¶
func (p *ProcessList) SortFedServers()
func (*ProcessList) String ¶
func (p *ProcessList) String() string
func (*ProcessList) TrimVMList ¶
func (p *ProcessList) TrimVMList(h uint32, vmIndex int)
func (*ProcessList) VMIndexFor ¶
func (p *ProcessList) VMIndexFor(hash []byte) int
Returns the Virtual Server index for this hash for the given minute
type ProcessLists ¶
type ProcessLists struct { State *State // Pointer to the state object DBHeightBase uint32 // Height of the first Process List in this structure. Lists []*ProcessList // Pointer to the ProcessList structure for each DBHeight under construction SetString bool Str string }
func NewProcessLists ¶
func NewProcessLists(state interfaces.IState) *ProcessLists
func (*ProcessLists) Get ¶
func (lists *ProcessLists) Get(dbheight uint32) *ProcessList
func (*ProcessLists) GetSafe ¶
func (lists *ProcessLists) GetSafe(dbheight uint32) (pl *ProcessList)
Only gets an existing process list
func (*ProcessLists) LastList ¶
func (lists *ProcessLists) LastList() *ProcessList
func (*ProcessLists) String ¶
func (lists *ProcessLists) String() string
func (*ProcessLists) UpdateState ¶
func (lists *ProcessLists) UpdateState(dbheight uint32) (progress bool)
UpdateState is executed from a Follower's perspective. So the block we are building is always the block above the HighestRecordedBlock, but we only care about messages that are at the highest known block, as long as that is above the highest recorded block.
type RateCalculator ¶
type RateCalculator struct {
// contains filtered or unexported fields
}
RateCalculator will maintain the rate of msgs arriving and rate of msgs leaving a queue. The instant rate is a 2s avg
func NewRateCalculator ¶
func NewRateCalculator(p IPrometheusRateMethods) *RateCalculator
func NewRateCalculatorTime ¶
func NewRateCalculatorTime(p IPrometheusRateMethods, td time.Duration) *RateCalculator
NewRateCalculatorTime is good for unit tests, or if you want to change the measureing time
func (*RateCalculator) Arrival ¶
func (r *RateCalculator) Arrival()
Arrival indicates a new item added to the queue
func (*RateCalculator) Complete ¶
func (r *RateCalculator) Complete()
Complete indicates something left the queue
func (*RateCalculator) StartTime ¶
func (r *RateCalculator) StartTime(start time.Time)
StartTime is good for unit tests
type Replay ¶
type Replay struct { Mutex sync.Mutex Buckets [numBuckets]map[[32]byte]int Basetime int // hours since 1970 Center int // Hour of the current time. // contains filtered or unexported fields }
func RandomReplay ¶
func RandomReplay() *Replay
func (*Replay) IsHashUnique ¶
Returns True if there is no record of this hash in the Replay structures. Returns false if we have seen this hash before.
func (*Replay) IsHashUnique_internal ¶
Returns True if there is no record of this hash in the Replay structures. Returns false if we have seen this hash before. Assume locking is done by caller
func (*Replay) IsTSValid ¶
func (r *Replay) IsTSValid(mask int, hash interfaces.IHash, timestamp interfaces.Timestamp) bool
Checks if the timestamp is valid. If the timestamp is too old or too far into the future, then we don't consider it valid. Or if we have seen this hash before, then it is not valid. To that end, this code remembers hashes tested in the past, and rejects the second submission of the same hash.
func (*Replay) IsTSValidAndUpdateState ¶
func (r *Replay) IsTSValidAndUpdateState(mask int, hash [32]byte, timestamp interfaces.Timestamp, systemtime interfaces.Timestamp) (rval bool)
To make the function testable, the logic accepts the current time as a parameter. This way, the test code can manipulate the clock at will.
func (*Replay) MarshalBinary ¶
func (*Replay) Recenter ¶
func (r *Replay) Recenter(systemtime interfaces.Timestamp)
This move the center time of the replay filter to the current systemtime. Really it should track the time for the current block.
func (*Replay) SetHashNow ¶
func (r *Replay) SetHashNow(mask int, hash [32]byte, now interfaces.Timestamp)
Fixed conflicting lock path Add a hash/mask at a specific time if it did not exist prior.
func (*Replay) UnmarshalBinary ¶
type SafeMsgMap ¶
SafeMsgMap is a threadsafe map[[32]byte]interfaces.IMsg
func NewSafeMsgMap ¶
func NewSafeMsgMap(name string, s *State) *SafeMsgMap
func (*SafeMsgMap) Cleanup ¶
func (m *SafeMsgMap) Cleanup(s *State)
Cleanup will clean old elements out from the commit map.
func (*SafeMsgMap) Copy ¶
func (m *SafeMsgMap) Copy() *SafeMsgMap
func (*SafeMsgMap) Delete ¶
func (m *SafeMsgMap) Delete(key [32]byte) (msg interfaces.IMsg, found bool)
func (*SafeMsgMap) Get ¶
func (m *SafeMsgMap) Get(key [32]byte) (msg interfaces.IMsg)
func (*SafeMsgMap) GetRaw ¶
func (m *SafeMsgMap) GetRaw() map[[32]byte]interfaces.IMsg
GetRaw is used in testing and simcontrol. Do no use this in production
func (*SafeMsgMap) Len ¶
func (m *SafeMsgMap) Len() int
func (*SafeMsgMap) Put ¶
func (m *SafeMsgMap) Put(key [32]byte, msg interfaces.IMsg)
func (*SafeMsgMap) RemoveExpired ¶
func (m *SafeMsgMap) RemoveExpired(s *State)
RemoveExpired is used when treating this as a commit map. Do not
type SaveState ¶
type SaveState struct { DBHeight uint32 FedServers []interfaces.IServer AuditServers []interfaces.IServer // The old balances must be restored FactoidBalancesP map[[32]byte]int64 ECBalancesP map[[32]byte]int64 IdentityControl *IdentityManager // Identities AuthorityServerCount int // number of federated or audit servers allowed // Server State LLeaderHeight uint32 Leader bool LeaderVMIndex int LeaderPL *ProcessList CurrentMinute int EOMsyncing bool EOM bool // Set to true when the first EOM is encountered EOMLimit int EOMProcessed int EOMDone bool EOMMinute int EOMSys bool // At least one EOM has covered the System List DBSig bool DBSigLimit int DBSigProcessed int // Number of DBSignatures received and processed. DBSigDone bool DBSigSys bool // At least one DBSig has covered the System List Newblk bool // True if we are starting a new block, and a dbsig is needed. Saving bool // True if we are in the process of saving to the database Syncing bool // Looking for messages from leaders to sync LeaderTimestamp interfaces.Timestamp Holding map[[32]byte]interfaces.IMsg // Hold Messages XReview []interfaces.IMsg // After the EOM, we must review the messages in Holding Acks map[[32]byte]interfaces.IMsg // Hold Acknowledgements Commits *SafeMsgMap // map[[32]byte]interfaces.IMsg // Commit Messages InvalidMessages map[[32]byte]interfaces.IMsg // DBlock Height at which node has a complete set of eblocks+entries EntryBlockDBHeightComplete uint32 // DBlock Height at which we have started asking for entry blocks EntryBlockDBHeightProcessing uint32 // Entry Blocks we don't have that we are asking our neighbors for MissingEntryBlocks []MissingEntryBlock // DBlock Height at which node has a complete set of eblocks+entries EntryDBHeightComplete uint32 // Height in the DBlock where we have all the entries EntryHeightComplete int // DBlock Height at which we have started asking for or have all entries EntryDBHeightProcessing uint32 // Height in the Directory Block where we have // Entries we don't have that we are asking our neighbors for MissingEntries []MissingEntry // FER section FactoshisPerEC uint64 FERChainId string ExchangeRateAuthorityPublicKey string FERChangeHeight uint32 FERChangePrice uint64 FERPriority uint32 FERPrioritySetHeight uint32 }
Because we have to go back to a previous state should the network be partitioned and we are on a separate branch, we need to log our state periodically so we can reset to a state prior to the network partition. The need to go back to a SaveState should be rare. And even more rare would be the need to go back two levels. However, it is possible that a minority partition is able to see a level of consensus and save a state to disk that the majority of the nodes did not see. However it is not possible for this to occur more than once. This is because any consensus a node can see requires that all the nodes saw the previous consensus.
func SaveFactomdState ¶
func (*SaveState) JSONString ¶
func (*SaveState) MarshalBinary ¶
func (*SaveState) RestoreFactomdState ¶
func (*SaveState) UnmarshalBinary ¶
type Server ¶
type Server struct { ChainID interfaces.IHash Name string Online bool Replace interfaces.IHash }
func (*Server) GetChainID ¶
func (s *Server) GetChainID() (rval interfaces.IHash)
func (*Server) JSONString ¶
func (*Server) LeaderToReplace ¶
func (s *Server) LeaderToReplace() (rval interfaces.IHash)
func (*Server) MarshalBinary ¶
func (*Server) SetReplace ¶
func (s *Server) SetReplace(h interfaces.IHash)
func (*Server) UnmarshalBinary ¶
type State ¶
type State struct { Logger *log.Entry IsRunning bool NetworkController *p2p.Controller Salt interfaces.IHash Cfg interfaces.IFactomConfig ConfigFilePath string // $HOME/.factom/m2/factomd.conf by default Prefix string FactomNodeName string FactomdVersion string LogPath string LdbPath string BoltDBPath string LogLevel string ConsoleLogLevel string NodeMode string DBType string CheckChainHeads struct { CheckChainHeads bool Fix bool } CloneDBType string ExportData bool ExportDataSubpath string LogBits int64 // Bit zero is for logging the Directory Block on DBSig [5] DBStatesSent []*interfaces.DBStateSent DBStatesReceivedBase int DBStatesReceived []*messages.DBStateMsg LocalServerPrivKey string DirectoryBlockInSeconds int PortNumber int Replay *Replay FReplay *Replay CrossReplay *CrossReplayFilter DropRate int Delay int64 // Simulation delays sending messages this many milliseconds ControlPanelPort int ControlPanelSetting int // Keeping the last display state lets us know when to send over the new blocks LastDisplayState *DisplayState ControlPanelChannel chan DisplayState ControlPanelDataRequest bool // If true, update Display state // Network Configuration Network string MainNetworkPort string PeersFile string MainSeedURL string MainSpecialPeers string TestNetworkPort string TestSeedURL string TestSpecialPeers string LocalNetworkPort string LocalSeedURL string LocalSpecialPeers string CustomNetworkPort string CustomSeedURL string CustomSpecialPeers string CustomNetworkID []byte CustomBootstrapIdentity string CustomBootstrapKey string IdentityChainID interfaces.IHash // If this node has an identity, this is it //Identities []*Identity // Identities of all servers in management chain // Authorities []*Authority // Identities of all servers in management chain AuthorityServerCount int // number of federated or audit servers allowed IdentityControl *IdentityManager // Just to print (so debugging doesn't drive functionality) Status int // Return a status (0 do nothing, 1 provide queues, 2 provide consensus data) StatusMutex sync.Mutex StatusStrs []string Starttime time.Time ResetTryCnt int ResetCnt int // pending entry/transaction api calls for the holding queue do not have proper scope // This is used to create a temporary, correctly scoped holding queue snapshot for the calls on demand HoldingMutex sync.RWMutex HoldingLast int64 HoldingMap map[[32]byte]interfaces.IMsg // Elections are managed through the Elections Structure EFactory interfaces.IElectionsFactory Elections interfaces.IElections Election0 string // Title Election1 string // Election state for display Election2 string // Election state for display Election3 string // Election leader list // pending entry/transaction api calls for the ack queue do not have proper scope // This is used to create a temporary, correctly scoped ackqueue snapshot for the calls on demand AcksMutex sync.RWMutex AcksLast int64 AcksMap map[[32]byte]interfaces.IMsg DBStateAskCnt int DBStateReplyCnt int DBStateIgnoreCnt int DBStateAppliedCnt int MissingRequestAskCnt int MissingRequestReplyCnt int MissingRequestIgnoreCnt int MissingResponseAppliedCnt int ResendCnt int ExpireCnt int TimeOffset interfaces.Timestamp MaxTimeOffset interfaces.Timestamp ShutdownChan chan int // For gracefully halting Factom JournalFile string Journaling bool ServerPrivKey *primitives.PrivateKey ServerPubKey *primitives.PublicKey // RPC connection config RpcUser string RpcPass string RpcAuthHash []byte FactomdTLSEnable bool FactomdLocations string CorsDomains []string // Server State StartDelay int64 // Time in Milliseconds since the last DBState was applied StartDelayLimit int64 DBFinished bool RunLeader bool BootTime int64 // Time in seconds that we last booted // Ignore missing messages for a period to allow rebooting a network where your // own messages from the previously executing network can confuse you. IgnoreDone bool IgnoreMissing bool LLeaderHeight uint32 Leader bool LeaderVMIndex int LeaderPL *ProcessList PLProcessHeight uint32 // Height cutoff where no missing messages below this height DBHeightAtBoot uint32 TimestampAtBoot interfaces.Timestamp OneLeader bool OutputAllowed bool LeaderNewMin int CurrentMinute int // These are the start times for blocks and minutes PreviousMinuteStartTime int64 CurrentMinuteStartTime int64 CurrentBlockStartTime int64 EOMsyncing bool EOMSyncTime int64 EOM bool // Set to true when the first EOM is encountered EOMLimit int EOMProcessed int EOMDone bool EOMMinute int EOMSys bool // At least one EOM has covered the System List DBSig bool DBSigLimit int DBSigProcessed int // Number of DBSignatures received and processed. DBSigDone bool DBSigSys bool // At least one DBSig has covered the System List CreatedLastBlockFromDBState bool // By default, this is false, which means DBstates are discarded // when a majority of leaders disagree with the hash we have via DBSigs KeepMismatch bool DBSigFails int // Keep track of how many blockhash mismatches we've had to correct Saving bool // True if we are in the process of saving to the database Syncing bool // Looking for messages from leaders to sync NetStateOff bool // Disable if true, Enable if false DebugConsensus bool // If true, dump consensus trace FactoidTrans int ECCommits int ECommits int FCTSubmits int NewEntryChains int NewEntries int LeaderTimestamp interfaces.Timestamp MessageFilterTimestamp interfaces.Timestamp // Maps // ==== // For Follower ResendHolding interfaces.Timestamp // Timestamp to gate resending holding to neighbors Holding map[[32]byte]interfaces.IMsg // Hold Messages XReview []interfaces.IMsg // After the EOM, we must review the messages in Holding Acks map[[32]byte]interfaces.IMsg // Hold Acknowledgements Commits *SafeMsgMap // map[[32]byte]interfaces.IMsg // Commit Messages InvalidMessages map[[32]byte]interfaces.IMsg InvalidMessagesMutex sync.RWMutex AuditHeartBeats []interfaces.IMsg // The checklist of HeartBeats for this period FaultTimeout int FaultWait int EOMfaultIndex int LastTiebreak int64 AuthoritySetString string // Network MAIN = 0, TEST = 1, LOCAL = 2, CUSTOM = 3 NetworkNumber int // Encoded into Directory Blocks(s.Cfg.(*util.FactomdConfig)).String() // Database DB interfaces.DBOverlaySimple Anchor interfaces.IAnchor // Directory Block State DBStates *DBStateList // Holds all DBStates not yet processed. ResetRequest bool // Set to true to trigger a reset ProcessLists *ProcessLists HighestKnown uint32 HighestAck uint32 AuthorityDeltas string // Factom State FactoidState interfaces.IFactoidState NumTransactions int // Permanent balances from processing blocks. RestoreFCT map[[32]byte]int64 RestoreEC map[[32]byte]int64 FactoidBalancesPapi map[[32]byte]int64 FactoidBalancesP map[[32]byte]int64 FactoidBalancesPMutex sync.Mutex ECBalancesPapi map[[32]byte]int64 ECBalancesP map[[32]byte]int64 ECBalancesPMutex sync.Mutex TempBalanceHash interfaces.IHash Balancehash interfaces.IHash // Web Services Port int // For Replay / journal IsReplaying bool ReplayTimestamp interfaces.Timestamp // State for the Entry Syncing process EntrySyncState *EntrySync MissingEntryBlockRepeat interfaces.Timestamp // DBlock Height at which node has a complete set of eblocks+entries EntryBlockDBHeightComplete uint32 // DBlock Height at which we have started asking for entry blocks EntryBlockDBHeightProcessing uint32 // Entry Blocks we don't have that we are asking our neighbors for MissingEntryBlocks []MissingEntryBlock MissingEntryRepeat interfaces.Timestamp // DBlock Height at which node has a complete set of eblocks+entries EntryDBHeightComplete uint32 // DBlock Height at which we have started asking for or have all entries EntryDBHeightProcessing uint32 // Height in the Directory Block where we have // Entries we don't have that we are asking our neighbors for MissingEntries chan *MissingEntry // Holds leaders and followers up until all missing entries are processed, if true WaitForEntries bool UpdateEntryHash chan *EntryUpdate // Channel for updating entry Hashes tracking (repeats and such) WriteEntry chan interfaces.IEBEntry // MessageTally causes the node to keep track of (and display) running totals of each // type of message received during the tally interval MessageTally bool MessageTalliesReceived [constants.NUM_MESSAGES]int MessageTalliesSent [constants.NUM_MESSAGES]int LastPrint string LastPrintCnt int // FER section FactoshisPerEC uint64 FERChainId string ExchangeRateAuthorityPublicKey string FERChangeHeight uint32 FERChangePrice uint64 FERPriority uint32 FERPrioritySetHeight uint32 AckChange uint32 StateSaverStruct StateSaverStruct // Logstash UseLogstash bool LogstashURL string Uploader *UploadController // Controls the uploads of torrents. Prevents backups DBStateManager interfaces.IManagerController HighestCompletedTorrent uint32 FastBoot bool FastBootLocation string FastSaveRate int // These stats are collected when we write the dbstate to the database. NumNewChains int // Number of new Chains in this block NumNewEntries int // Number of new Entries, not counting the first entry in a chain NumEntries int // Number of entries in this block (including the entries that create chains) NumEntryBlocks int // Number of Entry Blocks NumFCTTrans int // Number of Factoid Transactions in this block SyncingState [256]string SyncingStateCurrent int ProcessListProcessCnt int64 // count of attempts to process .. so we can see if the thread is running StateProcessCnt int64 StateUpdateState int64 ValidatorLoopSleepCnt int64 MMRInfo // fields for MMR processing // contains filtered or unexported fields }
func (*State) APIQueue ¶
func (s *State) APIQueue() interfaces.IQueue
func (*State) AckQueue ¶
func (s *State) AckQueue() chan interfaces.IMsg
func (*State) AddAuditServer ¶
func (s *State) AddAuditServer(dbheight uint32, hash interfaces.IHash) int
func (*State) AddAuthorityDelta ¶
func (*State) AddDBSig ¶
func (s *State) AddDBSig(dbheight uint32, chainID interfaces.IHash, sig interfaces.IFullSignature)
func (*State) AddDBState ¶
func (s *State) AddDBState(isNew bool, directoryBlock interfaces.IDirectoryBlock, adminBlock interfaces.IAdminBlock, factoidBlock interfaces.IFBlock, entryCreditBlock interfaces.IEntryCreditBlock, eBlocks []interfaces.IEntryBlock, entries []interfaces.IEBEntry) *DBState
Adds blocks that are either pulled locally from a database, or acquired from peers.
func (*State) AddFedServer ¶
func (s *State) AddFedServer(dbheight uint32, hash interfaces.IHash) int
func (*State) AddIdentityEblocks ¶
func (st *State) AddIdentityEblocks(cid interfaces.IHash, rootChain bool) error
AddIdentityEblocks will find all eblocks for a root/management chain and add them to the sync list
func (*State) AddIdentityFromChainID ¶
func (st *State) AddIdentityFromChainID(cid interfaces.IHash) error
AddIdentityFromChainID will add an identity to our list to watch and sync it.
func (*State) AddNewIdentityEblocks ¶
func (st *State) AddNewIdentityEblocks(eblocks []interfaces.IEntryBlock, dblockTimestamp interfaces.Timestamp)
AddNewIdentityEblocks will scan the new eblock list and identify any eblocks of interest. If an eblock belongs to a current identity, we add it to the eblock lists of the identity to be synced.
func (*State) AddToHolding ¶
func (s *State) AddToHolding(hash [32]byte, msg interfaces.IMsg)
func (*State) AddToReplayFilter ¶
func (s *State) AddToReplayFilter(mask int, hash [32]byte, timestamp interfaces.Timestamp, systemtime interfaces.Timestamp) (rval bool)
Check and Add a hash to the network replay filter
func (*State) CalculateTransactionRate ¶
CalculateTransactionRate calculates how many transactions this node is processing
totalTPS : Transaction rate over life of node (totaltime / totaltrans) instantTPS : Transaction rate weighted over last 3 seconds
func (*State) CheckFileName ¶
func (*State) CheckForIDChange ¶
func (s *State) CheckForIDChange()
func (*State) ComputeVMIndex ¶
Returns the Virtual Server Index for this hash if this server is the leader; returns -1 if we are not the leader for this hash
func (*State) ConstructAuthoritySetString ¶
func (*State) CopyStateToControlPanel ¶
Sends the copy of State over channel to control panel
func (*State) CreateDBSig ¶
func (s *State) CreateDBSig(dbheight uint32, vmIndex int) (interfaces.IMsg, interfaces.IMsg)
func (*State) CreateEOM ¶
func (s *State) CreateEOM(force bool, m interfaces.IMsg, vmIdx int) (eom *messages.EOM, ack interfaces.IMsg)
func (*State) CrossReplayAddSalt ¶
CrossReplayAddSalt adds the salt to the DB
func (*State) DatabaseContains ¶
func (s *State) DatabaseContains(hash interfaces.IHash) bool
func (*State) DeleteFromHolding ¶
func (s *State) DeleteFromHolding(hash [32]byte, msg interfaces.IMsg, reason string)
func (*State) DidCreateLastBlockFromDBState ¶
func (*State) DoProcessing ¶
func (s *State) DoProcessing()
This is the tread with access to state. It does process and update state
func (*State) ElectionsQueue ¶
func (s *State) ElectionsQueue() interfaces.IQueue
func (*State) ExchangeRateAuthorityIsValid ¶
func (this *State) ExchangeRateAuthorityIsValid(e interfaces.IEBEntry) bool
func (*State) ExecuteEntriesInDBState ¶
func (s *State) ExecuteEntriesInDBState(dbmsg *messages.DBStateMsg)
func (*State) FastVerifyAuthoritySignature ¶
func (st *State) FastVerifyAuthoritySignature(msg []byte, sig interfaces.IFullSignature, dbheight uint32) (int, error)
Checks the signature of a message. Returns an int based on who signed it:
1 -> Federated Signature 0 -> Audit Signature -1 -> Neither Fed or Audit Signature
func (*State) FerEntryIsValid ¶
func (this *State) FerEntryIsValid(passedFEREntry interfaces.IFEREntry) bool
func (*State) FetchECTransactionByHash ¶
func (s *State) FetchECTransactionByHash(hash interfaces.IHash) (interfaces.IECBlockEntry, error)
func (*State) FetchEntryByHash ¶
func (s *State) FetchEntryByHash(hash interfaces.IHash) (interfaces.IEBEntry, error)
func (*State) FetchEntryHashFromProcessListsByTxID ¶
func (s *State) FetchEntryHashFromProcessListsByTxID(txID string) (interfaces.IHash, error)
might want to make this search the database at some point to be more generic
func (*State) FetchEntryRevealAndCommitFromHolding ¶
func (s *State) FetchEntryRevealAndCommitFromHolding(hash interfaces.IHash) (reveal interfaces.IMsg, commit interfaces.IMsg)
FetchEntryRevealAndCommitFromHolding will look for the commit and reveal for a given hash. It will check the hash as an entryhash and a txid, and return any reveals that match the entryhash and any commits that match the entryhash or txid
Returns reveal = The reveal message if found commit = The commit message if found
func (*State) FetchFactoidTransactionByHash ¶
func (s *State) FetchFactoidTransactionByHash(hash interfaces.IHash) (interfaces.ITransaction, error)
func (*State) FetchHoldingMessageByHash ¶
func (s *State) FetchHoldingMessageByHash(hash interfaces.IHash) (int, byte, interfaces.IMsg, error)
func (*State) FetchIdentityChainEntriesInCreateOrder ¶
func (s *State) FetchIdentityChainEntriesInCreateOrder(chainid interfaces.IHash) ([]IdentityEntry, error)
FetchIdentityChainEntriesInCreateOrder will grab all entries in a chain for an identity in the order they were created.
func (*State) FetchPaidFor ¶
func (s *State) FetchPaidFor(hash interfaces.IHash) (interfaces.IHash, error)
func (*State) FixMissingKeys ¶
func (*State) FollowerExecuteAck ¶
func (s *State) FollowerExecuteAck(msg interfaces.IMsg)
Ack messages always match some message in the Process List. That is done here, though the only msg that should call this routine is the Ack message.
func (*State) FollowerExecuteCommitChain ¶
func (s *State) FollowerExecuteCommitChain(m interfaces.IMsg)
func (*State) FollowerExecuteCommitEntry ¶
func (s *State) FollowerExecuteCommitEntry(m interfaces.IMsg)
func (*State) FollowerExecuteDBState ¶
func (s *State) FollowerExecuteDBState(msg interfaces.IMsg)
func (*State) FollowerExecuteDataResponse ¶
func (s *State) FollowerExecuteDataResponse(m interfaces.IMsg)
func (*State) FollowerExecuteEOM ¶
func (s *State) FollowerExecuteEOM(m interfaces.IMsg)
Messages that will go into the Process List must match an Acknowledgement. The code for this is the same for all such messages, so we put it here.
Returns true if it finds a match, puts the message in holding, or invalidates the message
func (*State) FollowerExecuteFullFault ¶
func (s *State) FollowerExecuteFullFault(m interfaces.IMsg)
When we execute a FullFault message, it could be complete (includes all necessary signatures + pledge) or incomplete, in which case it is just a negotiation ping
func (*State) FollowerExecuteMMR ¶
func (s *State) FollowerExecuteMMR(m interfaces.IMsg)
func (*State) FollowerExecuteMissingMsg ¶
func (s *State) FollowerExecuteMissingMsg(msg interfaces.IMsg)
func (*State) FollowerExecuteMsg ¶
func (s *State) FollowerExecuteMsg(m interfaces.IMsg)
Messages that will go into the Process List must match an Acknowledgement. The code for this is the same for all such messages, so we put it here.
Returns true if it finds a match, puts the message in holding, or invalidates the message
func (*State) FollowerExecuteRevealEntry ¶
func (s *State) FollowerExecuteRevealEntry(m interfaces.IMsg)
func (*State) FollowerExecuteSFault ¶
func (s *State) FollowerExecuteSFault(m interfaces.IMsg)
func (*State) GetACKStatus ¶
func (s *State) GetACKStatus(hash interfaces.IHash) (int, interfaces.IHash, interfaces.Timestamp, interfaces.Timestamp, error)
GetACKStatus also checks the oldmsgs map
func (*State) GetAckChange ¶
func (*State) GetAnchor ¶
func (s *State) GetAnchor() interfaces.IAnchor
func (*State) GetAuditHeartBeats ¶
func (s *State) GetAuditHeartBeats() []interfaces.IMsg
func (*State) GetAuditServers ¶
func (s *State) GetAuditServers(dbheight uint32) []interfaces.IServer
func (*State) GetAuthorities ¶
func (s *State) GetAuthorities() []interfaces.IAuthority
GetAuthorities will return a list of the network authorities
func (*State) GetAuthority ¶
func (st *State) GetAuthority(serverID interfaces.IHash) (*Authority, int)
Gets the authority matching the identity ChainID. Returns the authority and the int of its type:
1 -> Federated 0 -> Audit -1 -> Not fed or audit -2 -> Not found
func (*State) GetAuthorityDeltas ¶
func (*State) GetAuthorityInterface ¶
func (s *State) GetAuthorityInterface(chainid interfaces.IHash) interfaces.IAuthority
GetAuthorityInterface will the authority as an interface. Because of import issues we cannot access IdentityControl Directly
func (*State) GetAuthorityServerType ¶
func (st *State) GetAuthorityServerType(chainID interfaces.IHash) int
func (*State) GetAuthoritySetString ¶
func (*State) GetBootTime ¶
func (*State) GetCfg ¶
func (s *State) GetCfg() interfaces.IFactomConfig
Getting the cfg state for Factom doesn't force a read of the config file unless it hasn't been read yet.
func (*State) GetConfigPath ¶
func (*State) GetCorsDomains ¶
func (*State) GetCurrentBlockStartTime ¶
func (*State) GetCurrentMinute ¶
func (*State) GetCurrentMinuteStartTime ¶
func (*State) GetCurrentTime ¶
func (*State) GetDB ¶
func (s *State) GetDB() interfaces.DBOverlaySimple
func (*State) GetDBHeightAtBoot ¶
func (*State) GetDBHeightComplete ¶
func (*State) GetDBState ¶
func (*State) GetDBStatesSent ¶
func (s *State) GetDBStatesSent() []*interfaces.DBStateSent
func (*State) GetDirectoryBlock ¶
func (s *State) GetDirectoryBlock() interfaces.IDirectoryBlock
func (*State) GetDirectoryBlockByHeight ¶
func (s *State) GetDirectoryBlockByHeight(height uint32) interfaces.IDirectoryBlock
Return the Directory block if it is in memory, or hit the database if it must be loaded.
func (*State) GetDirectoryBlockInSeconds ¶
func (*State) GetDropRate ¶
func (*State) GetEBlockKeyMRFromEntryHash ¶
func (s *State) GetEBlockKeyMRFromEntryHash(entryHash interfaces.IHash) (rval interfaces.IHash)
func (*State) GetElections ¶
func (s *State) GetElections() interfaces.IElections
func (*State) GetEntryBlockDBHeightComplete ¶
func (*State) GetEntryBlockDBHeightProcessing ¶
func (*State) GetEntryCommitAckByEntryHash ¶
func (s *State) GetEntryCommitAckByEntryHash(hash interfaces.IHash) (status int, commit interfaces.IMsg)
GetEntryCommitAck will fetch the status of a entrycommit by ENTRYHASH. The places it checks are:
CommitMap --> This indicates if the entry made it into the processlist within the last 4 hrs Last PL --> Check if still in a processList Holding --> See if it is in holding Returns: status = Status of reveal from possible ack responses commit = The commit message
func (*State) GetEntryCommitAckByTXID ¶
func (s *State) GetEntryCommitAckByTXID(hash interfaces.IHash) (status int, blktime interfaces.Timestamp, commit interfaces.IMsg, entryhash interfaces.IHash)
GetEntryCommitAckByTXID will fetch the status of a commit by TxID
Searches this order: Database --> Check if it made it to blockchain PL --> See if it is still in the processlist PL - 1 --> Only if min 0, because then it's not in DB yet, but still in this PL Holding --> See if it is in holding
func (*State) GetEntryDBHeightComplete ¶
func (*State) GetEntryRevealAckByEntryHash ¶
func (s *State) GetEntryRevealAckByEntryHash(hash interfaces.IHash) (status int, blktime interfaces.Timestamp, commit interfaces.IMsg)
GetEntryRevealAck will fetch the status of a entryreveal. The places it checks are:
ReplayMap --> This indicates if the entry made it into the processlist within the last 4 hrs Database --> Check if it made it to blockchain Holding --> See if it is in holding. Will also look for commit if it finds that Returns: status = Status of reveal from possible ack responses blktime = The time of the block if found in the database, nil if not found in blockchain commit = Only returned if found from holding. This will be empty if found in dbase or in processlist
func (*State) GetF ¶
GetF() If rt == true, read the Temp balances. Otherwise read the Permanent balances. concurrency safe to call
func (*State) GetFactoidState ¶
func (s *State) GetFactoidState() interfaces.IFactoidState
func (*State) GetFactomNodeName ¶
func (*State) GetFactomdLocations ¶
func (*State) GetFactomdVersion ¶
func (*State) GetFactoshisPerEC ¶
func (*State) GetFaultTimeout ¶
func (*State) GetFaultWait ¶
func (*State) GetFedServers ¶
func (s *State) GetFedServers(dbheight uint32) []interfaces.IServer
func (*State) GetHighestAck ¶
func (*State) GetHighestCompletedBlk ¶
This is the highest block signed off, but not necessarily validated.
func (*State) GetHighestKnownBlock ¶
The highest block for which we have received a message. Sometimes the same as BuildingBlock(), but can be different depending or the order messages are received.
func (*State) GetHighestLockedSignedAndSavesBlk ¶
func (*State) GetHighestSavedBlk ¶
This is the highest block signed off and recorded in the Database.
func (*State) GetIdentityChainID ¶
func (s *State) GetIdentityChainID() (rval interfaces.IHash)
func (*State) GetInvalidMsg ¶
func (s *State) GetInvalidMsg(hash interfaces.IHash) interfaces.IMsg
func (*State) GetJournalMessages ¶
GetJournalMessages gets all messages from the message journal
func (*State) GetLLeaderHeight ¶
func (*State) GetLastStatus ¶
func (*State) GetLeaderHeight ¶
This is lowest block currently under construction under the "leader".
func (*State) GetLeaderPL ¶
func (s *State) GetLeaderPL() interfaces.IProcessList
GetLeaderPL returns the leader process list from the state. this method is for debugging and should not be called in normal production code.
func (*State) GetLeaderTimestamp ¶
func (s *State) GetLeaderTimestamp() interfaces.Timestamp
func (*State) GetLeaderVM ¶
func (*State) GetMatryoshka ¶
func (s *State) GetMatryoshka(dbheight uint32) (rval interfaces.IHash)
func (*State) GetMessageFilterTimestamp ¶
func (s *State) GetMessageFilterTimestamp() interfaces.Timestamp
func (*State) GetMessageTalliesReceived ¶
func (*State) GetMessageTalliesSent ¶
func (*State) GetMissingDBState ¶
func (*State) GetMissingEntryCount ¶
func (*State) GetNetStateOff ¶
func (*State) GetNetworkBootStrapIdentity ¶
func (s *State) GetNetworkBootStrapIdentity() (rval interfaces.IHash)
The initial identity that can sign the first block
func (*State) GetNetworkBootStrapKey ¶
func (s *State) GetNetworkBootStrapKey() (rval interfaces.IHash)
The initial public key that can sign the first block
func (*State) GetNetworkID ¶
func (*State) GetNetworkIdentityRegistrationChain ¶
func (s *State) GetNetworkIdentityRegistrationChain() (rval interfaces.IHash)
func (*State) GetNetworkName ¶
func (*State) GetNetworkNumber ¶
func (*State) GetNetworkSkeletonIdentity ¶
func (s *State) GetNetworkSkeletonIdentity() (rval interfaces.IHash)
The identity for validating messages
func (*State) GetNetworkSkeletonKey ¶
func (st *State) GetNetworkSkeletonKey() (rval interfaces.IHash)
func (*State) GetNewEBlocks ¶
func (s *State) GetNewEBlocks(dbheight uint32, hash interfaces.IHash) interfaces.IEntryBlock
func (*State) GetNewHash ¶
func (s *State) GetNewHash() (rval interfaces.IHash)
func (*State) GetOnlineAuditServers ¶
func (s *State) GetOnlineAuditServers(dbheight uint32) []interfaces.IServer
func (*State) GetPendingEntries ¶
func (s *State) GetPendingEntries(params interface{}) []interfaces.IPendingEntry
func (*State) GetPendingTransactions ¶
func (s *State) GetPendingTransactions(params interface{}) []interfaces.IPendingTransaction
func (*State) GetPredictiveFER ¶
Returns the higher of the current factoid exchange rate and what it knows will change in the future
func (*State) GetPreviousMinuteStartTime ¶
func (*State) GetRpcAuthHash ¶
func (*State) GetRpcPass ¶
func (*State) GetRpcUser ¶
func (*State) GetServerPrivateKey ¶
func (s *State) GetServerPrivateKey() *primitives.PrivateKey
func (*State) GetServerPublicKey ¶
func (s *State) GetServerPublicKey() *primitives.PublicKey
func (*State) GetServerPublicKeyString ¶
func (*State) GetSigningKey ¶
func (st *State) GetSigningKey(id interfaces.IHash) (interfaces.IHash, int)
GetSigningKey will return the signing key of the identity, and it's type
Returns: -1 --> Follower 0 --> Audit Server 1 --> Federated
func (*State) GetSpecificACKStatus ¶
func (s *State) GetSpecificACKStatus(hash interfaces.IHash) (int, interfaces.IHash, interfaces.Timestamp, interfaces.Timestamp, error)
GetSpecificACKStatus does NOT check the oldmsgs map. This is because the processlists map for entries and entry blocks is updated after the oldmsgs. This means an EntryACK will returns TransactionACK, but GetChain will return not found To fix this, for some calls (entries) we don't want to check the oldmsgs.
func (*State) GetSystemHeight ¶
func (*State) GetSystemMsg ¶
func (s *State) GetSystemMsg(dbheight uint32, height uint32) interfaces.IMsg
Gets the system message at the given dbheight, and given height in the System list
func (*State) GetTimeOffset ¶
func (s *State) GetTimeOffset() interfaces.Timestamp
func (*State) GetTimestamp ¶
func (s *State) GetTimestamp() interfaces.Timestamp
Returns a millisecond timestamp
func (*State) GetTrueLeaderHeight ¶
returns what finished block height this node thinks the leader is at, assuming that the local node has the process list the leader is working on plus an extra empty one on top of it.
func (*State) GetUnsyncedServers ¶
func (s *State) GetUnsyncedServers(dbheight uint32) []interfaces.IHash
GetUnsyncedServers returns an array of the IDs for all unsynced VMs
func (*State) GetUnsyncedServersString ¶
GetUnsyncedServersString returns a string with the short IDs for all unsynced VMs
func (*State) GetVirtualServers ¶
func (*State) GoSyncEntries ¶
func (s *State) GoSyncEntries()
GoSyncEntries() Start up all of our supporting go routines, and run through the directory blocks and make sure we have all the entries they reference.
func (*State) HookLogstash ¶
func (*State) InMsgQueue ¶
func (s *State) InMsgQueue() interfaces.IQueue
func (*State) InMsgQueue2 ¶
func (s *State) InMsgQueue2() interfaces.IQueue
func (*State) IncDBStateAnswerCnt ¶
func (s *State) IncDBStateAnswerCnt()
func (*State) IncECCommits ¶
func (s *State) IncECCommits()
func (*State) IncECommits ¶
func (s *State) IncECommits()
func (*State) IncEntries ¶
func (s *State) IncEntries()
func (*State) IncEntryChains ¶
func (s *State) IncEntryChains()
func (*State) IncFCTSubmits ¶
func (s *State) IncFCTSubmits()
func (*State) IncFactoidTrans ¶
func (s *State) IncFactoidTrans()
func (*State) InitBoltDB ¶
func (*State) InitLevelDB ¶
func (*State) InitiateNetworkIdentityRegistration ¶
func (*State) IntiateNetworkSkeletonIdentity ¶
Add the skeleton identity and try to build it
func (*State) IsActive ¶
func (s *State) IsActive(id activations.ActivationType) bool
Return if a feature is active for the current height
func (*State) IsHighestCommit ¶
func (s *State) IsHighestCommit(hash interfaces.IHash, msg interfaces.IMsg) bool
IsHighestCommit will determine if the commit given has more entry credits than the current commit in the commit hashmap. If there is no prior commit, this will also return true.
func (*State) IsNewOrPendingEBlocks ¶
func (s *State) IsNewOrPendingEBlocks(dbheight uint32, hash interfaces.IHash) bool
func (*State) IsStateFullySynced ¶
func (*State) IsSyncingDBSigs ¶
func (*State) IsSyncingEOMs ¶
func (*State) JournalMessage ¶
func (s *State) JournalMessage(msg interfaces.IMsg)
JournalMessage writes the message to the message journal for debugging
func (*State) LeaderExecute ¶
func (s *State) LeaderExecute(m interfaces.IMsg)
func (*State) LeaderExecuteCommitChain ¶
func (s *State) LeaderExecuteCommitChain(m interfaces.IMsg)
func (*State) LeaderExecuteCommitEntry ¶
func (s *State) LeaderExecuteCommitEntry(m interfaces.IMsg)
func (*State) LeaderExecuteDBSig ¶
func (s *State) LeaderExecuteDBSig(m interfaces.IMsg)
func (*State) LeaderExecuteEOM ¶
func (s *State) LeaderExecuteEOM(m interfaces.IMsg)
func (*State) LeaderExecuteRevealEntry ¶
func (s *State) LeaderExecuteRevealEntry(m interfaces.IMsg)
func (*State) LoadAcksMap ¶
func (s *State) LoadAcksMap() map[[32]byte]interfaces.IMsg
this is called from the APIs that do not have access directly to the Acks. State makes a copy and puts it in AcksMap
func (*State) LoadConfig ¶
func (*State) LoadDBState ¶
func (s *State) LoadDBState(dbheight uint32) (interfaces.IMsg, error)
func (*State) LoadDataByHash ¶
func (s *State) LoadDataByHash(requestedHash interfaces.IHash) (interfaces.BinaryMarshallable, int, error)
func (*State) LoadHoldingMap ¶
func (s *State) LoadHoldingMap() map[[32]byte]interfaces.IMsg
func (*State) LoadIdentityByEntry ¶
func (st *State) LoadIdentityByEntry(ent interfaces.IEBEntry, height uint32, dblockTimestamp interfaces.Timestamp, d *DBState)
LoadIdentityByEntry is only useful when initial is set to false. If initial is false, it will track changes in an identity that corresponds to an authority. If initial is true, then calling ProcessIdentityEntry directly will have the same result.
func (*State) LoadSpecificMsg ¶
func (*State) LoadSpecificMsgAndAck ¶
func (s *State) LoadSpecificMsgAndAck(dbheight uint32, vmIndex int, plistheight uint32) (interfaces.IMsg, interfaces.IMsg, error)
func (*State) LogMessage ¶
func (s *State) LogMessage(logName string, comment string, msg interfaces.IMsg)
func (*State) LookupIdentityInBlockchainByChainID ¶
func (st *State) LookupIdentityInBlockchainByChainID(cid interfaces.IHash) error
func (*State) MoveStateToHeight ¶
func (*State) MsgQueue ¶
func (s *State) MsgQueue() chan interfaces.IMsg
func (*State) Needed ¶
func (s *State) Needed(eb interfaces.IEntryBlock) bool
Checks ChainIDs to determine if we need their entries to process entries and transactions.
func (*State) NetworkInvalidMsgQueue ¶
func (s *State) NetworkInvalidMsgQueue() chan interfaces.IMsg
func (*State) NetworkOutMsgQueue ¶
func (s *State) NetworkOutMsgQueue() interfaces.IQueue
func (*State) NewAck ¶
func (s *State) NewAck(msg interfaces.IMsg, balanceHash interfaces.IHash) interfaces.IMsg
Create a new Acknowledgement. Must be called by a leader. This call assumes all the pieces are in place to create a new acknowledgement
func (*State) NextCommit ¶
func (s *State) NextCommit(hash interfaces.IHash) interfaces.IMsg
Returns the oldest, not processed, Commit received
func (*State) NoEntryYet ¶
func (s *State) NoEntryYet(entryhash interfaces.IHash, ts interfaces.Timestamp) bool
Returns true if this hash exists nowhere in the Replay structures. Returns False if we have already seen this hash before. Replay is NOT updated yet.
func (*State) ProcessAddServer ¶
func (s *State) ProcessAddServer(dbheight uint32, addServerMsg interfaces.IMsg) bool
func (*State) ProcessChangeServerKey ¶
func (s *State) ProcessChangeServerKey(dbheight uint32, changeServerKeyMsg interfaces.IMsg) bool
func (*State) ProcessCommitChain ¶
func (s *State) ProcessCommitChain(dbheight uint32, commitChain interfaces.IMsg) bool
func (*State) ProcessCommitEntry ¶
func (s *State) ProcessCommitEntry(dbheight uint32, commitEntry interfaces.IMsg) bool
func (*State) ProcessDBSig ¶
func (s *State) ProcessDBSig(dbheight uint32, msg interfaces.IMsg) bool
When we process the directory Signature, and we are the leader for said signature, it is then that we push it out to the rest of the network. Otherwise, if we are not the leader for the signature, it marks the sig complete for that list
func (*State) ProcessDBlock ¶
func (*State) ProcessEOM ¶
func (s *State) ProcessEOM(dbheight uint32, msg interfaces.IMsg) bool
TODO: Should fault the server if we don't have the proper sequence of EOM messages.
func (*State) ProcessInvalidMsgQueue ¶
func (s *State) ProcessInvalidMsgQueue()
func (*State) ProcessRecentFERChainEntries ¶
func (this *State) ProcessRecentFERChainEntries()
Go through the factoid exchange rate chain and determine if an FER change should be scheduled
func (*State) ProcessRemoveServer ¶
func (s *State) ProcessRemoveServer(dbheight uint32, removeServerMsg interfaces.IMsg) bool
func (*State) ProcessRevealEntry ¶
func (s *State) ProcessRevealEntry(dbheight uint32, m interfaces.IMsg) (worked bool)
func (*State) PutCommit ¶
func (s *State) PutCommit(hash interfaces.IHash, msg interfaces.IMsg)
func (*State) PutE ¶
PutE() If rt == true, update the Temp balances. Otherwise update the Permanent balances. concurrency safe to call
func (*State) PutF ¶
PutF() If rt == true, update the Temp balances. Otherwise update the Permanent balances. concurrency safe to call
func (*State) PutNewEBlocks ¶
func (s *State) PutNewEBlocks(dbheight uint32, hash interfaces.IHash, eb interfaces.IEntryBlock)
func (*State) PutNewEntries ¶
func (s *State) PutNewEntries(dbheight uint32, hash interfaces.IHash, e interfaces.IEntry)
func (*State) ReadCfg ¶
func (s *State) ReadCfg(filename string) interfaces.IFactomConfig
ReadCfg forces a read of the Factom config file. However, it does not change the state of any cfg object held by other processes... Only what will be returned by future calls to Cfg().(s.Cfg.(*util.FactomdConfig)).String()
func (*State) RemoveAuditServer ¶
func (s *State) RemoveAuditServer(dbheight uint32, hash interfaces.IHash)
func (*State) RemoveFedServer ¶
func (s *State) RemoveFedServer(dbheight uint32, hash interfaces.IHash)
func (*State) RepairAuthorities ¶
func (s *State) RepairAuthorities()
RepairAuthorities will put the management chain of an identity in the authority if it is missing.
func (*State) RequestAndCollectMissingEntries ¶
func (s *State) RequestAndCollectMissingEntries()
RequestAndCollectMissingEntries() Manage go routines that are requesting and checking for missing entries
func (*State) ReviewHolding ¶
func (s *State) ReviewHolding()
Places the entries in the holding map back into the XReview list for review if this is a leader, and those messages are that leader's responsibility
func (*State) RunUploadController ¶
func (s *State) RunUploadController()
func (*State) SendDBSig ¶
dbheight is the height of the process list, and vmIndex is the vm that is missing the DBSig. If the DBSig isn't our responsibility, then this call will do nothing. Assumes the state for the leader is set properly
func (*State) SendHeartBeat ¶
func (s *State) SendHeartBeat()
func (*State) SendManager ¶
func (s *State) SendManager()
SendManager keeps us from double sending entries on repeats.
func (*State) SetAuthoritySetString ¶
func (*State) SetDBStateManagerCompletedHeight ¶
func (*State) SetDBStatesSent ¶
func (s *State) SetDBStatesSent(sents []*interfaces.DBStateSent)
func (*State) SetDirectoryBlockInSeconds ¶
func (*State) SetDropRate ¶
func (*State) SetEntryBlockDBHeightComplete ¶
func (*State) SetEntryBlockDBHeightProcessing ¶
func (*State) SetFactoidState ¶
func (s *State) SetFactoidState(dbheight uint32, fs interfaces.IFactoidState)
func (*State) SetFactoshisPerEC ¶
func (*State) SetFaultTimeout ¶
func (*State) SetFaultWait ¶
func (*State) SetHighestAck ¶
func (*State) SetIdentityChainID ¶
func (s *State) SetIdentityChainID(chainID interfaces.IHash)
func (*State) SetIsDoneReplaying ¶
func (s *State) SetIsDoneReplaying()
func (*State) SetIsReplaying ¶
func (s *State) SetIsReplaying()
func (*State) SetLeaderTimestamp ¶
func (s *State) SetLeaderTimestamp(ts interfaces.Timestamp)
func (*State) SetMessageFilterTimestamp ¶
func (s *State) SetMessageFilterTimestamp(leaderTS interfaces.Timestamp)
the MessageFilterTimestamp is used to filter messages from the past or before the replay filter. We will not set it to a time that is before (20 minutes before) boot or more than one hour in the past. this ensure messages from prior boot and messages that predate the current replay filter are are dropped. It marks the start of the replay filter content
func (*State) SetNetStateOff ¶
func (*State) SetPendingSigningKey ¶
func (s *State) SetPendingSigningKey(p *primitives.PrivateKey)
func (*State) SetRpcAuthHash ¶
func (*State) SetStringConsensus ¶
func (s *State) SetStringConsensus()
func (*State) SetStringQueues ¶
func (s *State) SetStringQueues()
func (*State) SetTorrentUploader ¶
Only called once to set the torrent flag.
func (*State) SetUseTorrent ¶
Only called once to set the torrent flag.
func (*State) SetupCrossBootReplay ¶
SetupCrossBootReplay will construct the database
func (*State) ShortString ¶
func (*State) Sign ¶
func (s *State) Sign(b []byte) interfaces.IFullSignature
func (*State) SimGetSigKey ¶
func (*State) SimSetNewKeys ¶
func (s *State) SimSetNewKeys(p *primitives.PrivateKey)
func (*State) StartTorrentSyncing ¶
StartTorrentSyncing is an endless loop that uses torrents to sync missing blocks It will grab any block higher than the highest dblock saved in the database up to the highest known block.
func (*State) SummaryHeader ¶
func (*State) SyncIdentities ¶
SyncIdentities will run through the identities and sync any identities that need to be updated. If the current height is equal to the eblock+1, then this entry can trigger a change in key to the admin block
func (*State) TallyReceived ¶
func (*State) TickerQueue ¶
func (*State) TimerMsgQueue ¶
func (s *State) TimerMsgQueue() chan interfaces.IMsg
func (*State) TorrentUploader ¶
func (*State) UpdateAuthSigningKeys ¶
We keep a 2 block history of their keys, this is so if we change their key and need to verify a message from 1 block ago, we still can. This function garbage collects old keys
func (*State) UpdateAuthorityFromABEntry ¶
func (st *State) UpdateAuthorityFromABEntry(entry interfaces.IABEntry) error
func (*State) UpdateECs ¶
func (s *State) UpdateECs(ec interfaces.IEntryCreditBlock)
func (*State) UpdateState ¶
func (*State) UploadDBState ¶
All calls get sent here and redirected into the uploadcontroller queue.
func (*State) UsingTorrent ¶
func (*State) Validate ¶
func (s *State) Validate(msg interfaces.IMsg) (validToSend int, validToExec int)
this is the common validation to all messages. they must not be a reply, they must not be out size the time window for the replay filter.
func (*State) ValidatePrevious ¶
func (*State) ValidatorLoop ¶
func (s *State) ValidatorLoop()
func (*State) VerifyAuthoritySignature ¶
func (st *State) VerifyAuthoritySignature(msg []byte, sig *[constants.SIGNATURE_LENGTH]byte, dbheight uint32) (rval int, err error)
Checks the signature of a message. Returns an int based on who signed it:
1 -> Federated Signature 0 -> Audit Signature -1 -> Neither Fed or Audit Signature
func (*State) VerifyIsAuthority ¶
func (st *State) VerifyIsAuthority(cid interfaces.IHash) bool
Verifies if is authority
Return true if authority, false if not
func (*State) WriteEntries ¶
func (s *State) WriteEntries()
WriteEntriesToTheDB() As Entries come in and are validated, then write them to the database
type StateSaverStruct ¶
type StateSaverStruct struct { FastBoot bool FastBootLocation string TmpDBHt uint32 TmpState []byte Mutex sync.Mutex Stop bool }
func (*StateSaverStruct) DeleteSaveState ¶
func (sss *StateSaverStruct) DeleteSaveState(networkName string) error
func (*StateSaverStruct) LoadDBStateList ¶
func (sss *StateSaverStruct) LoadDBStateList(s *State, statelist *DBStateList, networkName string) error
func (*StateSaverStruct) SaveDBStateList ¶
func (sss *StateSaverStruct) SaveDBStateList(s *State, ss *DBStateList, networkName string) error
func (*StateSaverStruct) StopSaving ¶
func (sss *StateSaverStruct) StopSaving()
type UploadController ¶
type UploadController struct { DBStateManager interfaces.IManagerController // contains filtered or unexported fields }
Controls the flow of uploading torrents
func NewUploadController ¶
func NewUploadController(dbsm interfaces.IManagerController) *UploadController
func (*UploadController) Close ¶
func (u *UploadController) Close()
type VM ¶
type VM struct { List []interfaces.IMsg // Lists of acknowledged messages ListAck []*messages.Ack // Acknowledgements Height int // Height of first unprocessed message (count of messages processed) EomMinuteIssued int // Last Minute Issued on this VM (from the leader, when we are the leader) LeaderMinute int // Where the leader is in acknowledging messages Synced bool // Is this VM synced yet? Signed bool // We have signed the previous block. WhenFaulted int64 // WhenFaulted is a timestamp of when this VM was faulted FaultFlag int // FaultFlag tracks what the VM was faulted for (0 = EOM missing, 1 = negotiation issue) ProcessTime interfaces.Timestamp // Last time we made progress on this VM VmIndex int // the index of this MV HighestAsk int // highest ask sent to MMR for this VM HighestNil int // Debug highest nil reported // contains filtered or unexported fields }
func (*VM) ReportMissing ¶
Ask VM for an MMR for this height with delay ms before asking the network
type WholeBlock ¶
type WholeBlock struct { // Header and entry headers DBlock interfaces.IDirectoryBlock // Block and admin block entries ABlock interfaces.IAdminBlock // Block and transactions FBlock interfaces.IFBlock // Block and entries ECBlock interfaces.IEntryCreditBlock EBlocks []interfaces.IEntryBlock Entries []interfaces.IEBEntry SigList []interfaces.IFullSignature }
func NewWholeBlock ¶
func NewWholeBlock() *WholeBlock
func ReadDBStateFromDebugFile ¶
func ReadDBStateFromDebugFile(filename string) (*WholeBlock, error)
func (*WholeBlock) AddEblock ¶
func (wb *WholeBlock) AddEblock(eb interfaces.IEntryBlock)
func (*WholeBlock) AddEntry ¶
func (wb *WholeBlock) AddEntry(e interfaces.IEntry)
func (*WholeBlock) AddIEBEntry ¶
func (wb *WholeBlock) AddIEBEntry(e interfaces.IEBEntry)
func (*WholeBlock) BlockToDBStateMsg ¶
func (wb *WholeBlock) BlockToDBStateMsg() interfaces.IMsg
func (*WholeBlock) IsSameAs ¶
func (a *WholeBlock) IsSameAs(b *WholeBlock) (resp bool)
func (*WholeBlock) MarshalBinary ¶
func (wb *WholeBlock) MarshalBinary() (b []byte, err error)
func (*WholeBlock) UnmarshalBinary ¶
func (wb *WholeBlock) UnmarshalBinary(data []byte) (err error)
func (*WholeBlock) UnmarshalBinaryData ¶
func (wb *WholeBlock) UnmarshalBinaryData(data []byte) (newData []byte, err error)
func (*WholeBlock) UnmarshalBinaryDataBuffer ¶
func (wb *WholeBlock) UnmarshalBinaryDataBuffer(buffer io.ReadSeeker, whence int) (read int64, err error)
Source Files ¶
- MMR.go
- ack.go
- apiQueue.go
- authority.go
- createEOM.go
- crossBootReplay.go
- dbStateManager.go
- dbstateCatchup.go
- entrySyncing.go
- factoidstate.go
- fault.go
- fullBlock.go
- grants.go
- identity.go
- identityUtils.go
- instrumentation.go
- loadDatabase.go
- missingEntry.go
- netOutMsgQueue.go
- plugins.go
- printState.go
- processList.go
- processListManager.go
- queues.go
- rateCalculator.go
- replay.go
- safeMsgMap.go
- saveAndRestore.go
- server.go
- simState.go
- specialQueues.go
- state.go
- stateConsensus.go
- stateDisplay.go
- stateFER.go
- stateSaver.go
- torrentSync.go
- validation.go