lib/sibit.rb in sibit-0.18.0 vs lib/sibit.rb in sibit-0.18.1

- old
+ new

@@ -169,11 +169,11 @@ # You call this method and provide a callback. You provide the hash # of the starting block. The method will go through the Blockchain, # fetch blocks and find transactions, one by one, passing them to the # callback provided. When finished, the method returns the hash of - # a new block, seen last. + # a new block, not scanned yet or NIL if it's the end of Blockchain. # # The callback will be called with three arguments: # 1) Bitcoin address of the receiver, 2) transaction hash, 3) amount # in satoshi. The callback should return non-false if the transaction # found was useful. @@ -208,15 +208,14 @@ end end checked += 1 end @log.info("We checked #{checked} txns and #{checked_outputs} outputs in block #{block}") - n = json[:next] - if n.nil? - @log.info("The next_block is empty in block #{block}, this is the end of Blockchain") + block = json[:next] + if block.nil? + @log.info("The next_block is empty in block #{json[:hash]}, this is the end of Blockchain") break end - block = n count += 1 if count > max @log.info("Too many blocks (#{count}) in one go, let's get back to it next time") break end