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.
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)
{
...
}