1

I created a light wallet which can receive and send transactions. It works fine in normal situation.

My (first) question is what are the situations where things can go wrong ? Is there a reference explaining the life cycle of a transaction with all the possibilities ?

Example: the wallet is notified when it receives bitcoins. If the fees are very low or even zero, the transaction can stay for few days in the mempool. Eventually, after 2 weeks (right?), if the tx is not included in a block, the tx will be discarded.

I have a script which scans the mempool and another one which scans all new blocks. The first one will see the tx but the second one will never see it.

How can I know for sure that the tx is discarded so I can notify the wallet ? My guess: save the unconfirmed tx with a date and make another cron job that will go through those tx and check if the tx is older than 2 weeks and is not anymore in bitcoind (mempool or block).

  • 1
    It's misleading to speak of "the" mempool. Every node has its own, and different nodes may have different policies as to how long they keep unconfirmed transactions. Two weeks is simply the default for Bitcoin Core. – Nate Eldredge Feb 1 at 15:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.