Post
Topic
Board Development & Technical Discussion
Re: Is there a better way to get notified of receives with bitcoind?
by
kjj
on 09/08/2013, 03:59:04 UTC
Yeah, don't do that unless you are sure that your transaction volume will be extremely low.

You want the process run by -walletnotify to be very fast.  Ideally, it should spit out a line into a pipe (or file or socket) and end promptly.

You should then have a different process, either a daemon or a cron job, read that stream and gather whatever information you need.  You should be checking the confirmation count of the transactions, not the balance of the account.  For that matter, using accounts can get you into trouble.  Make sure you know what you are doing if you are going to use them at all.

-walletnotify will trigger when a transaction is included in a block, but it might also trigger if the transaction shows up over the network as a loose transaction.  So, you should check the confirmation count each time -walletnotify hits, until you see at least one confirmation.  After that, you should check it every time you see a block to make sure the count has reached your threshold.  You could optimize that a bit by skipping the slow RPC calls until number of blocks have been seen after the transaction was first included.