Merge pull request #120 from dinhln89/block_status

Fixed finality using percent instead of boolean value for block status
This commit is contained in:
Tuna 2018-08-09 11:43:52 +07:00 committed by GitHub
commit e96a1819c5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -854,7 +854,7 @@ func (s *PublicBlockChainAPI) rpcOutputBlock(b *types.Block, inclTx bool, fullTx
}
var signers []common.Address
var filterSigners []common.Address
finality := false
finality := int32(0)
if b.Number().Int64() > 0 {
addrBlockSigner := common.HexToAddress(common.BlockSigners)
signers, err = contracts.GetSignersFromContract(addrBlockSigner, client, b.Hash())
@ -877,9 +877,7 @@ func (s *PublicBlockChainAPI) rpcOutputBlock(b *types.Block, inclTx bool, fullTx
}
}
}
if countFinality >= len(masternodes)*75/100 {
finality = true
}
finality = int32(countFinality * 100 / len(masternodes))
}
}
}