lib/sibit.rb in sibit-0.14.4 vs lib/sibit.rb in sibit-0.14.5

- old
+ new

@@ -173,11 +173,12 @@ # callback provided. When finished, the method returns the hash of # a new block, seen last. # # The callback will be called with three arguments: # 1) Bitcoin address of the receiver, 2) transaction hash, 3) amount - # in satoshi. + # in satoshi. The callback should return non-false if the transaction + # found was useful. def scan(start, max: 4) block = start count = 0 wrong = [] loop do @@ -200,11 +201,12 @@ t[:outputs].each_with_index do |o, i| address = o[:address] checked_outputs += 1 hash = "#{t[:hash]}:#{i}" satoshi = o[:value] - yield(address, hash, satoshi) - @log.info("Bitcoin tx found at #{hash} for #{satoshi} sent to #{address}") + if yield(address, hash, satoshi) + @log.info("Bitcoin tx found at #{hash} for #{satoshi} sent to #{address}") + end end checked += 1 end @log.info("We checked #{checked} txns and #{checked_outputs} outputs in block #{block}") n = json[:next]