Subject: Re: [Bitcoin-development] Implementing batch processing for -blocknotify

From: Jeff Garzik <[email-masked]>
Date: Fri, 31 May 2013 09:05:54 -0400

On Fri, May 31, 2013 at 7:56 AM, Rune Kjær Svendsen <[email-masked]> wrote:
> Hello dear list
>
> I have an application that wants to keep up with new blocks as they come in.
> For that I can use the -blocknotify option with bitcoind, which will execute
> my application for each new block.
>
> The problem is that my app isn't necessarily quick enough to finish its work
> before a new block comes in and the app is executed again. This means the
> that bitcoind might keep executing my application even though the previous
> instance hasn't finished, and that's fairly inefficient resource-wise, as
> many instances of the application will be running simultaneously.
>
> I've discussed this with wumpus on bitcoin-dev, and we figured out a
> solution that might be better. It could replace -blocknotify or we could put
> it in a new function called -batchblocknotify

Similar to other suggestions in this thread,

If your -blocknotify execution is too slow, then create a solution
that simply queues work.  There is no need to add this code to
bitcoind itself.

Another solution is modifying pynode to directly listen to a trusted
node (bitcoind), and monitor blocks as they arrive and are announced.
That does not fix the problem of slow block processing on your side,
but is another way to implement -blocknotify-like behavior.

-- 
Jeff Garzik
Senior Software Engineer and open source evangelist
BitPay, Inc.      https://bitpay.com/