Post
Topic
Board Development & Technical Discussion
Re: Is there a better way to get notified of receives with bitcoind?
by
kjj
on 12/08/2013, 15:02:30 UTC
Edit: I'm an idiot -blocknotify returns the new block hash not the current block height.
Edit: if anyone had the code to identify block hashes from transaction ids hook me up, otherwise I'm going to sleep and will do it tomorrow.

Blocknotify just gives the hash.  The hash isn't even important, just the event.  Most of the time, getting a block means that you've extended the main chain, but not always.

If you need 5 more confirmations, then there is no point checking the status of the transaction until you see 5 new blocks.  But, seeing 5 new blocks doesn't automatically mean that the transaction you are looking at has seen 5 additional confirmations.  If there is a fork, or a reorg, or whatever else, your confirmation count could have actually gone down.  So, once you have enough blocks that you might have enough confirmations, you then verify by checking gettransaction to be sure.