fix getScore 32bit bug

This commit is contained in:
andri lim 2018-12-25 21:21:47 +07:00 committed by zah
parent 3a10f99694
commit ab0fb7fdf0
1 changed files with 3 additions and 3 deletions

View File

@ -83,8 +83,8 @@ proc getBlockHeader*(self: BaseChainDB; n: BlockNumber): BlockHeader =
## Raises BlockNotFound error if the block is not in the DB. ## Raises BlockNotFound error if the block is not in the DB.
self.getBlockHeader(self.getBlockHash(n)) self.getBlockHeader(self.getBlockHash(n))
proc getScore*(self: BaseChainDB; blockHash: Hash256): int = proc getScore*(self: BaseChainDB; blockHash: Hash256): uint64 =
rlp.decode(self.db.get(blockHashToScoreKey(blockHash).toOpenArray).toRange, int) rlp.decode(self.db.get(blockHashToScoreKey(blockHash).toOpenArray).toRange, uint64)
iterator findNewAncestors(self: BaseChainDB; header: BlockHeader): BlockHeader = iterator findNewAncestors(self: BaseChainDB; header: BlockHeader): BlockHeader =
## Returns the chain leading up from the given header until the first ancestor it has in ## Returns the chain leading up from the given header until the first ancestor it has in
@ -226,7 +226,7 @@ proc persistHeaderToDb*(self: BaseChainDB; header: BlockHeader): seq[BlockHeader
self.addBlockNumberToHashLookup(header) self.addBlockNumberToHashLookup(header)
var headScore: int var headScore: uint64
try: try:
headScore = self.getScore(self.getCanonicalHead().hash) headScore = self.getScore(self.getCanonicalHead().hash)
except CanonicalHeadNotFound: except CanonicalHeadNotFound: