當前位置: 首頁>>代碼示例>>Golang>>正文


Golang IState.GetIdentityChainID方法代碼示例

本文整理匯總了Golang中github.com/FactomProject/factomd/common/interfaces.IState.GetIdentityChainID方法的典型用法代碼示例。如果您正苦於以下問題:Golang IState.GetIdentityChainID方法的具體用法?Golang IState.GetIdentityChainID怎麽用?Golang IState.GetIdentityChainID使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/FactomProject/factomd/common/interfaces.IState的用法示例。


在下文中一共展示了IState.GetIdentityChainID方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: NewAddServerMsg

func NewAddServerMsg(state interfaces.IState, serverType int) interfaces.IMsg {
	msg := new(AddServerMsg)
	msg.ServerChainID = state.GetIdentityChainID()
	msg.ServerType = serverType
	msg.Timestamp = state.GetTimestamp()

	return msg

}
開發者ID:FactomProject,項目名稱:factomd,代碼行數:9,代碼來源:addServer.go

示例2: FollowerExecute

func (m *Heartbeat) FollowerExecute(state interfaces.IState) {
	for _, auditServer := range state.GetAuditServers(state.GetLeaderHeight()) {
		if auditServer.GetChainID().IsSameAs(m.IdentityChainID) {
			if m.IdentityChainID.IsSameAs(state.GetIdentityChainID()) {
				if m.SecretNumber != state.GetSalt(m.Timestamp) {
					panic("We have seen a heartbeat using our Identity that isn't ours")
				}
			}
			auditServer.SetOnline(true)
		}
	}
}
開發者ID:FactomProject,項目名稱:factomd,代碼行數:12,代碼來源:heartbeat.go

示例3: NewMissingMsg

// NewMissingMsg: Build a missing Message request, and add the first Height
func NewMissingMsg(state interfaces.IState, vm int, dbHeight uint32, processlistHeight uint32) *MissingMsg {

	msg := new(MissingMsg)

	msg.Asking = state.GetIdentityChainID()
	msg.Peer2Peer = true // Always a peer2peer request // .
	msg.VMIndex = vm
	msg.Timestamp = state.GetTimestamp()
	msg.DBHeight = dbHeight
	msg.ProcessListHeight = append(msg.ProcessListHeight, processlistHeight)
	msg.SystemHeight = uint32(state.GetSystemHeight(dbHeight))
	return msg
}
開發者ID:FactomProject,項目名稱:factomd,代碼行數:14,代碼來源:missingMsg.go

示例4: NewProcessList

func NewProcessList(state interfaces.IState, previous *ProcessList, dbheight uint32) *ProcessList {
	// We default to the number of Servers previous.   That's because we always
	// allocate the FUTURE directoryblock, not the current or previous...

	pl := new(ProcessList)

	pl.State = state.(*State)

	// Make a copy of the previous FedServers
	pl.FedServers = make([]interfaces.IFctServer, 0)
	pl.AuditServers = make([]interfaces.IFctServer, 0)
	pl.Requests = make(map[[32]byte]*Request)
	//pl.Requests = make(map[[20]byte]*Request)

	pl.FactoidBalancesT = map[[32]byte]int64{}
	pl.ECBalancesT = map[[32]byte]int64{}

	if previous != nil {
		pl.FedServers = append(pl.FedServers, previous.FedServers...)
		pl.AuditServers = append(pl.AuditServers, previous.AuditServers...)
		for _, auditServer := range pl.AuditServers {
			auditServer.SetOnline(false)
			if state.GetIdentityChainID().IsSameAs(auditServer.GetChainID()) {
				// Always consider yourself "online"
				auditServer.SetOnline(true)
			}
		}
		for _, fedServer := range pl.FedServers {
			fedServer.SetOnline(true)
		}
		pl.SortFedServers()
	} else {
		pl.AddFedServer(state.GetNetworkBootStrapIdentity()) // Our default fed server, dependent on network type
		// pl.AddFedServer(primitives.Sha([]byte("FNode0"))) // Our default for now fed server on LOCAL network
	}

	// We just make lots of VMs as they have nearly no impact if not used.
	pl.VMs = make([]*VM, 65)
	for i := 0; i < 65; i++ {
		pl.VMs[i] = new(VM)
		pl.VMs[i].List = make([]interfaces.IMsg, 0)
		pl.VMs[i].Synced = true
		pl.VMs[i].faultHeight = -1
		pl.VMs[i].whenFaulted = 0
	}

	pl.DBHeight = dbheight

	pl.MakeMap()

	pl.OldMsgs = make(map[[32]byte]interfaces.IMsg)
	pl.oldmsgslock = new(sync.Mutex)
	pl.OldAcks = make(map[[32]byte]interfaces.IMsg)
	pl.oldackslock = new(sync.Mutex)

	pl.NewEBlocks = make(map[[32]byte]interfaces.IEntryBlock)
	pl.neweblockslock = new(sync.Mutex)
	pl.NewEntries = make(map[[32]byte]interfaces.IEntry)

	pl.FaultMap = make(map[[32]byte]FaultState)

	pl.AmINegotiator = false

	pl.DBSignatures = make([]DBSig, 0)

	// If a federated server, this is the server index, which is our index in the FedServers list

	var err error

	if previous != nil {
		pl.DirectoryBlock = directoryBlock.NewDirectoryBlock(previous.DirectoryBlock)
		pl.AdminBlock = adminBlock.NewAdminBlock(previous.AdminBlock)
		pl.EntryCreditBlock, err = entryCreditBlock.NextECBlock(previous.EntryCreditBlock)
	} else {
		pl.DirectoryBlock = directoryBlock.NewDirectoryBlock(nil)
		pl.AdminBlock = adminBlock.NewAdminBlock(nil)
		pl.EntryCreditBlock, err = entryCreditBlock.NextECBlock(nil)
	}

	pl.ResetDiffSigTally()

	if err != nil {
		panic(err.Error())
	}

	return pl
}
開發者ID:FactomProject,項目名稱:factomd,代碼行數:87,代碼來源:processList.go


注:本文中的github.com/FactomProject/factomd/common/interfaces.IState.GetIdentityChainID方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。