-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Bitcoin 0.12 performance improvements #3262
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
|
@zkbot try |
|
⌛ Trying commit 2d921e12098fa33542cda090e8d485d0441ddf1a with merge 9217c8e09347bf3d17fb8443c5fd07dc45a20d1e... |
|
💔 Test failed - pr-try |
|
Missed an indirect merge conflict. @zkbot try |
Bitcoin 0.12 performance improvements Cherry-picked from the following upstream PRs: - bitcoin/bitcoin#6918 - bitcoin/bitcoin#6932 Part of #2074.
|
💔 Test failed - pr-try |
|
Above failure was a transient failure in one of the RPC tests; all other builders passed. |
daira
left a comment
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.
Zcash has no duplicate coinbase transactions; simplify the code and test accordingly.
src/coins.h
Outdated
| * Return a modifiable reference to a CCoins. Assumes that no entry with the given | ||
| * txid exists and creates a new one. This saves a database access in the case where | ||
| * the coins were to be wiped out by FromTx anyway. This should not be called with | ||
| * the 2 historical coinbase duplicate pairs because the new coins are marked fresh, and |
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.
There are no "2 historical coinbase duplicate pairs" in Zcash-derived chains, since we have enforced both BIP 30 and BIP 34 ("height in coinbase") since launch. This was accidentally omitted for the genesis block, but that omission can have no effect on the BIP 30/34 goal of avoiding duplicate transactions. Delete this sentence from the comment, and replace it with:
We rely on Zcash-derived block chains having no duplicate transactions, since BIP 30 and (except for the genesis block) BIP 34 have been enforced since launch. See the Zcash protocol specification, section "Bitcoin Improvement Proposals".
src/main.cpp
Outdated
| // lookup to be sure the coins do not already exist otherwise we do not | ||
| // know whether to mark them fresh or not. We want the duplicate coinbases | ||
| // before BIP30 to still be properly overwritten. | ||
| inputs.ModifyCoins(tx.GetHash())->FromTx(tx, nHeight); |
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.
This complication is unnecessary for Zcash-derived chains as explained above. Just call inputs.ModifyNewCoins unconditionally (instead of inputs.ModifyCoins) outside the if (!tx.IsCoinBase()) block.
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.
Also delete the last sentence of the commit message.
src/test/coins_tests.cpp
Outdated
| // except the emphasis is on testing the functionality of UpdateCoins | ||
| // random txs are created and UpdateCoins is used to update the cache stack | ||
| // In particular it is tested that spending a duplicate coinbase tx | ||
| // has the expected effect (the other duplicate is overwitten at all cache levels) |
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.
Simplify the test by removing the testing of duplicate coinbase transactions:
- delete the last sentence of the above comment
- delete the
spent_a_duplicate_coinbaseandduplicateidsdeclarations - delete " unless intended to duplicate" in the comment on line 910
- delete the "1/100 times create a duplicate coinbase"
ifbody - delete the comment that mentions BIP 34 (but not the code it refers to! just the comment is inapplicable)
- delete the comment starting "The test is designed" and the two code lines after it.
|
Addressed @daira's comments. |
|
@zkbot try |
Bitcoin 0.12 performance improvements Cherry-picked from the following upstream PRs: - bitcoin/bitcoin#6918 - bitcoin/bitcoin#6932 Part of #2074.
|
☀️ Test successful - pr-try |
|
Rebased on master to fix merge conflict. |
When processing a new transaction, in addition to spending the Coins of its txin's it creates a new Coins for its outputs. The existing ModifyCoins function will first make sure this Coins does not already exist. It can not exist due to BIP 30, but because of that the lookup can't be cached and always has to go to the database. Since we are creating the coins to match the new tx anyway, there is no point in checking if they exist first anyway. Zcash: Modified to account for the fact that BIP 30 and BIP 34 have applied from the beginning.
Zcash: Modified to also address Zcash changes. Co-authored-by: Jack Grigg <[email protected]>
Inapplicable to Zcash because BIP 30 and BIP 34 have been applied from the beginning.
|
Rebased on master and address @Eirik0's comments. |
daira
left a comment
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.
ut(ACK+cov) 40e4981
Eirik0
left a comment
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
|
@zkbot r+ |
|
📌 Commit 40e4981 has been approved by |
Bitcoin 0.12 performance improvements Cherry-picked from the following upstream PRs: - bitcoin/bitcoin#6918 - bitcoin/bitcoin#6932 Part of #2074.
Cherry-picked from the following upstream PRs:
Part of #2074.