-
Notifications
You must be signed in to change notification settings - Fork 38.7k
Change semantics of HaveCoinInCache to match HaveCoin #10559
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Previously it was possible for HaveCoinInCache to return true for a spent coin. It is more clear to keep the semantics the same. HaveCoinInCache is used for two reasons: - tracking coins we may want to uncache, in which case it is unlikely there would be spent coins we could uncache (not dirty) - optimistically checking whether we have already included a tx in the blockchain, in which case a spent coin is not a reliable indicator that we have.
|
Don't we want to skip fetching a spent coin, e.g. in net_processing.cpp:AlreadyHave ? |
|
@gmaxwell I think the logic is we don't know if it has been spent or disconnected |
|
Even if its been disconnected do we really want to fetch it again? |
|
I don't think it really matters much either way, we're talking about real edge cases:
My opinion is that there are pros and cons either way, but the simplicity of having the semantics be the same is the deciding factor. |
|
I think the semantics change should happen. My doubt is only if AlreadyHave should be using this call; or perhaps one that will also potentially return spent entries. |
|
Do you feel like changing |
|
@sipa I agree it is not currently used. I'm on the fence about changing it, but happy to if that's what everyone else wants. I feel like the definition is a bit different anyway if it's in the mempool, since you could for instance still create a new transaction that spends that coin which would be accepted (as a replacement). |
|
@morcos Ok, let's discuss that independently perhaps - it has much less real effect anyway. utACK |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
utACK 5257698 |
|
utACK 5257698 |
5257698 Change semantics of HaveCoinInCache to match HaveCoin (Alex Morcos) Tree-SHA512: 397e9ba28646b81fffa53e55064735d4d242aaffdf8484506825f785b0e414f334e4c5cd1e4e1dd9a4b6d1f6954c7ecad15429934a1c4e8d39f596cbd9f5dd80
…eCoin 5257698 Change semantics of HaveCoinInCache to match HaveCoin (Alex Morcos) Tree-SHA512: 397e9ba28646b81fffa53e55064735d4d242aaffdf8484506825f785b0e414f334e4c5cd1e4e1dd9a4b6d1f6954c7ecad15429934a1c4e8d39f596cbd9f5dd80
…eCoin 5257698 Change semantics of HaveCoinInCache to match HaveCoin (Alex Morcos) Tree-SHA512: 397e9ba28646b81fffa53e55064735d4d242aaffdf8484506825f785b0e414f334e4c5cd1e4e1dd9a4b6d1f6954c7ecad15429934a1c4e8d39f596cbd9f5dd80
Summary: 5257698 Change semantics of HaveCoinInCache to match HaveCoin (Alex Morcos) Tree-SHA512: 397e9ba28646b81fffa53e55064735d4d242aaffdf8484506825f785b0e414f334e4c5cd1e4e1dd9a4b6d1f6954c7ecad15429934a1c4e8d39f596cbd9f5dd80 Backport of Core PR10559 bitcoin/bitcoin#10559 Test Plan: make check test_runner.py Reviewers: deadalnix, Fabien, jasonbcox, markblundeberg, O1 Bitcoin ABC, #bitcoin_abc Reviewed By: deadalnix, O1 Bitcoin ABC, #bitcoin_abc Differential Revision: https://reviews.bitcoinabc.org/D3602
Summary:
5257698 Change semantics of HaveCoinInCache to match HaveCoin (Alex Morcos)
Tree-SHA512: 397e9ba28646b81fffa53e55064735d4d242aaffdf8484506825f785b0e414f334e4c5cd1e4e1dd9a4b6d1f6954c7ecad15429934a1c4e8d39f596cbd9f5dd80
Backport of Core PR10559
bitcoin/bitcoin#10559
Summary:
5257698 Change semantics of HaveCoinInCache to match HaveCoin (Alex Morcos)
Tree-SHA512: 397e9ba28646b81fffa53e55064735d4d242aaffdf8484506825f785b0e414f334e4c5cd1e4e1dd9a4b6d1f6954c7ecad15429934a1c4e8d39f596cbd9f5dd80
Backport of Core PR10559
bitcoin/bitcoin#10559
Previously it was possible for HaveCoinInCache to return true for a spent
coin. It is more clear to keep the semantics the same. HaveCoinInCache is
used for two reasons:
would be spent coins we could uncache (not dirty)
blockchain, in which case a spent coin is not a reliable indicator that we have.
This makes the logic in #10557 more obviously correct, although it is ok without this PR