Skip to content

Conversation

@jonasschnelli
Copy link
Contributor

If a wallet transaction gets evicted from the mempool (through maxmempool or similar ways of eviction like a bitcoind restart), the particular transaction was marked as conflicted (confirmations = -1) and the inputs can be spent again.

This PR enabled detection of conflicted transactions by actually checking the mempool and the utxo set. The "conflicted" flag is cached in memory and re-checked during a block tip update.

The check could be further improved:

[10:51:21]  <sipa>  or even cache the blockindex itself, and as long as the active one descends from it, don't reevaluate if true

@jonasschnelli
Copy link
Contributor Author

Also includes a simple mempool limiting RPC test, PR passed this new test (confirmations = 0) as well as the txn_doublespend.py (confirmations = -1).

<0 (-1) stands for conflicted transactions. Broadcast everything that is not in the chain.
@jonasschnelli
Copy link
Contributor Author

Added two commits:

  • 4006e1e reaccept/rebroadcast all wtx with a height of 0 (the current code only reaccepted wtx with a height of < 0 which is the indicator for conflicted wtx). IMO it shouldn't hurt if we try to AcceptToMemoryPool() an already existing wtx.
  • 88c1ed7f7a7e62032e629e701353031eeb977cab does prevent wtxs from being markt as conflicted if they already known in the utxo set

All tests are passing.

@instagibbs
Copy link
Member

utACK

@jonasschnelli
Copy link
Contributor Author

@gmaxwell: Thanks for testing!
Your absolutely right. The test order was wrong. Fixed, .. now lets see if travis can pass the walletbackup.py RPC test.

@gmaxwell
Copy link
Contributor

Reviewing, haven't tested. Will test when robo tests pass! :)

@jonasschnelli
Copy link
Contributor Author

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The conflicted check can move up here (no need to compute depth in that case).

@sipa
Copy link
Member

sipa commented Nov 28, 2015

See alternative (but more invasive change) in #7105.

@jonasschnelli
Copy link
Contributor Author

Closing in favor of #7105

@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants