good morning!!!!

Skip to content
Snippets Groups Projects
Commit 423beddf authored by Jeffrey Wilcke's avatar Jeffrey Wilcke
Browse files

nil check

parent 8119d77a
No related branches found
No related tags found
No related merge requests found
...@@ -221,9 +221,16 @@ func (bc *BlockChain) GetChainFromHash(hash []byte, max uint64) []interface{} { ...@@ -221,9 +221,16 @@ func (bc *BlockChain) GetChainFromHash(hash []byte, max uint64) []interface{} {
startNumber := parentNumber + count startNumber := parentNumber + count
num := lastNumber num := lastNumber
for ; num > startNumber; currentHash = bc.GetBlock(currentHash).PrevHash { for num > startNumber {
num-- num--
block := bc.GetBlock(currentHash)
if block == nil {
break
} }
currentHash = block.PrevHash
}
for i := uint64(0); bytes.Compare(currentHash, hash) != 0 && num >= parentNumber && i < count; i++ { for i := uint64(0); bytes.Compare(currentHash, hash) != 0 && num >= parentNumber && i < count; i++ {
// Get the block of the chain // Get the block of the chain
block := bc.GetBlock(currentHash) block := bc.GetBlock(currentHash)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment