Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: bukaj on May 05, 2013, 01:23:07 PM



Title: Transaction tracking with listsinceblock
Post by: bukaj on May 05, 2013, 01:23:07 PM
Hi, I'm trying to track incomming transactions using bitcoind RPC API, --blocknotify and listsinceblock:

0. wait for --blocknotify hint
1. execute listsinceblock blockhash, 6 (target-confirmations), where blockhash is empty if running for the first time or lastblock returned by listsinceblock last time (step 3)
2. save to database transactions with confirmations >= 6 and with txid not already in database
3. remember lastblock returned by listsinceblock
4. goto 0

It is working fine and thanks to listsinceblock target-confirmation parameter lastblock is correctly shifted by 6 so I don't ommit any transactions.

If I understand correctly during chain fork blocks are lost and listsinceblock will return all transactions again because lastblock won't exist in new blockchain.

Questions:

A. Is it safe to rely on txid while ignoring already imported transactions in such situation?

B. I should also delete already imported transactions not existing in new blockchain, how to detect block chain fork easily using bitcoind RPC API?

C. Should I worry about it if accepting only txs with 6 confirmations?