Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: redPanda on December 17, 2015, 02:00:21 PM



Title: watch new Tx in mempool (testnet)
Post by: redPanda on December 17, 2015, 02:00:21 PM
I'm developping a wallet and I want to listen to the mempool (testnet) for incoming transactions.
I run a node on the same computer so I ping bitcoind every 1 sec with getmempoolinfo.

If getmempoolinfo.size is greater that 1 sec ago, it means there is at least one new transaction
in the mempool, then I get the array of all Tx in the mempool with getrawmempool.

My question : It seems that the new Tx hash is inserted anywhere in the array.
Is there a way to avoid comparing the old rawmempool (~ 1000 Tx) with the new rawmempool
to figure which Tx are new ? Or: why the new Tx are not append at the end
or at the beginning of the array ?


Title: Re: watch new Tx in mempool (testnet)
Post by: redPanda on January 08, 2016, 04:18:46 PM
UPDATE: no answer ?


Title: Re: watch new Tx in mempool (testnet)
Post by: achow101 on January 08, 2016, 08:26:54 PM
UPDATE: no answer ?
I do not think there is any way to do this. Bitcoin Core has a few notification things that it can do but not for every new transaction you receive. You can have it for every new block and transaction relevant to you (so not when a new transaction is added to the mempool). You could modify the source code and add that function in yourself though.