Post
Topic
Board Development & Technical Discussion
Re: PHP - Bidcoind check for new transactions.
by
OsNaP
on 08/09/2014, 23:24:44 UTC
So if a block has 0 confirmations its labeled an orphan block.
And listsinceblock will return all my transactions.

I just came up with some concept code.
It fixes the memory problem.
But my concept will only work if reorgs stops happening after a certain amount of confirmations (7).
Could you maybe verify.


Code:
min = 1
max = 7

lastBlockHash = database.lastBlockHash
blockData = bitcoind.getblock(lastBlockHash)

if(blockData.confirmations < min)
{
    lastBlockHash = bitcoind.getblockhash(max)
}

response = bitcoind.listsinceblock(lastBlockHash)

foreach(response.transactions)
{
    ...
}