本文整理匯總了Golang中github.com/FactomProject/factomd/common/interfaces.IState.FastVerifyAuthoritySignature方法的典型用法代碼示例。如果您正苦於以下問題:Golang IState.FastVerifyAuthoritySignature方法的具體用法?Golang IState.FastVerifyAuthoritySignature怎麽用?Golang IState.FastVerifyAuthoritySignature使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/FactomProject/factomd/common/interfaces.IState
的用法示例。
在下文中一共展示了IState.FastVerifyAuthoritySignature方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: SigTally
func (fs *FaultState) SigTally(state interfaces.IState) int {
validSigCount := 0
cb, err := fs.FaultCore.MarshalCore()
if err != nil {
return validSigCount
}
for _, fedSig := range fs.VoteMap {
check, err := state.FastVerifyAuthoritySignature(cb, fedSig, fs.FaultCore.DBHeight)
if err == nil && check == 1 {
validSigCount++
}
}
return validSigCount
}
示例2: Validate
// Validate the message, given the state. Three possible results:
// < 0 -- Message is invalid. Discard
// 0 -- Cannot tell if message is Valid
// 1 -- Message is valid
func (m *FullServerFault) Validate(state interfaces.IState) int {
// Check main signature
bytes, err := m.MarshalForSignature()
if err != nil {
return -1
}
//sig := m.Signature.GetSignature()
//sfSigned, err := state.VerifyAuthoritySignature(bytes, sig, m.DBHeight)
sfSigned, err := state.FastVerifyAuthoritySignature(bytes, m.Signature, m.DBHeight)
if err != nil {
return -1
}
if sfSigned < 1 {
return -1
}
_, err = m.MarshalCore()
if err != nil {
return -1
}
/*
sht := state.GetSystemHeight(m.DBHeight)
if sht < 0 {
return 0
}
if sht >= int(m.Height) {
return -1
}
if sht < int(m.Height) {
return 0
}
if state.GetLLeaderHeight() < m.DBHeight {
return 0
}
if state.GetLLeaderHeight() > m.DBHeight {
return -1
}
*/
return 1
}