-
Notifications
You must be signed in to change notification settings - Fork 36.4k
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
Segregated witness rebased #8149
Conversation
Here is a categorized list of the commits:
|
{ | ||
ScriptError error; | ||
CTransaction inputi(input); | ||
bool ret = VerifyScript(inputi.vin[0].scriptSig, output.vout[0].scriptPubKey, inputi.wit.vtxinwit.size() > 0 ? &inputi.wit.vtxinwit[0].scriptWitness : NULL, flags, TransactionSignatureChecker(&inputi, 0, output.vout[0].nValue), &error); |
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.
Please comment in #7910.
Updated with a rebased/squashed version of the changes in #7910. The resulting tree should still be identical. |
Updated again. |
5a5abad
to
74300b9
Compare
ACK 74300b9a5ed24e9f7d80ecc39d4e19690732ccbe |
Reviewed everything. Tested different scenarios. Mostly focused on the wallet. |
ACK 74300b9a5ed24e9f7d80ecc39d4e19690732ccbe (focused more on the scripting side, and tx signature v2, lightly reviewed the rest) |
Contains refactorings by Eric Lombrozo. Contains fixup by Nicolas Dorier. Contains cleanup of CInv::GetCommand by Alex Morcos
Includes a fix by Suhas Daftuar and LongShao007
Service bit logic by Nicolas Dorier. Only download blocks from witness peers after fork.
This is a preparation for BIP143 support.
Includes simplifications by Eric Lombrozo.
Includes RPC field name changes by Luke-jr.
Includes changes by Suhas Daftuar, Luke-jr, and mruddy.
script_tests: always test bitcoinconsensus_verify_script_with_amount if VERIFY_WITNESS isn't set Rename internal method + make it static trim bitcoinconsensus_ prefix Add SERIALIZE_TRANSACTION_WITNESS flag
Includes logic for dealing with pruning by Suhas Daftuar.
d1d15c8 Fix missing sigverion in main_test.cpp CreateDummyScriptSigWithKey. (furszy) a034daf Rename to PrecomputedTransactionData (furszy) b4b181b Unit test for sighash caching (furszy) 2ef3872 Report non-mandatory script failures correctly. (furszy) 446d340 Precompute sighashes (furszy) dfd24eb Update wallet_txn_close.py test: (furszy) a5170f0 BIP143: Signing logic. (furszy) d2dd547 BIP143: Verification logic. (furszy) dccc3c6 Refactor script validation to observe amounts (furszy) daf044a Reduce unnecessary hashing in signrawtransaction (furszy) Pull request description: Base work for the new transaction digest algorithm for signature verification on PIVX Sapling transactions. Essentially, an implementation of BIP143 + few more good commits that found down the rabbit hole. Back ports: * bitcoin#7276 * bitcoin#7976 * bitcoin#8118 * bitcoin#8149 (only amount validation and SignatureHash commits). * bitcoin#6088 (only the dummy signature one - will be removed once #1663 get merged -). * bitcoin#6379 * bitcoin#8524 Next step over this area (need 1553 merged to be able to push it) is the further specialization of BIP143 into our custom implementation of ZIP143 (with a different digest algorithm definition using our tx data and hash personalization). ACKs for top commit: Fuzzbawls: utACK d1d15c8 random-zebra: ACK d1d15c8 and merging... Tree-SHA512: 7665cccf095c5bce0b18ef7ab8fcf7bede9304993b48f1af9c352c568861dec728d1d68671aab857b73d46567678492c4b97c24644a15f3f29fc4d723b183522
…on, hashes, relay (sender side)"
…on, hashes, relay (sender side)"
…on, hashes, relay (sender side)"
…lization, hashes, relay (sender side)"
…t tests` commit
…s_program/witness_script/) 8a2b58d test: fix segwit terminology (s/witness_program/witness_script/) (Sebastian Falbesoner) Pull request description: This PR fixes wrong uses of the term "witness program", which according to [BIP141](https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki#Witness_program) is defined as follows: > A scriptPubKey (or redeemScript as defined in BIP16/P2SH) that consists of a 1-byte push opcode (for 0 to 16) followed by a data push between 2 and 40 bytes gets a new special meaning. The value of the first push is called the "version byte". **The following byte vector pushed is called the "witness program".** In most cases where "witness program" is used in tests (concerns comments, variable names and in one instance even a function name) what we really want to denote is the "witness script". Thanks to [MarcoFalke for pointing this out in a review comment](bitcoin#22363 (comment))! Some historical background: At the time when the P2P segwit tests were first introduced (commit 330b0f3, PR bitcoin#8149), the term "witness program" was not used consistently in BIP141: https://bitcoin.stackexchange.com/questions/46451/what-is-the-precise-definition-of-witness-program This was fixed in PR bitcoin/bips#416 later. So in some way, this PR can be seen as a very late follow-up to the BIP141 fix that also reflects these changes in the tests. ACKs for top commit: josibake: tACK bitcoin@8a2b58d Tree-SHA512: f36bb9e53d1b54b86bfa87ec12f33e3ebca64b5f59d97e9662fe35ba12c25e1c9a4f93a5425d0eaa3879dce9e50368d345555b927bfab76945511f873396892b
…s_program/witness_script/) 8a2b58d test: fix segwit terminology (s/witness_program/witness_script/) (Sebastian Falbesoner) Pull request description: This PR fixes wrong uses of the term "witness program", which according to [BIP141](https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki#Witness_program) is defined as follows: > A scriptPubKey (or redeemScript as defined in BIP16/P2SH) that consists of a 1-byte push opcode (for 0 to 16) followed by a data push between 2 and 40 bytes gets a new special meaning. The value of the first push is called the "version byte". **The following byte vector pushed is called the "witness program".** In most cases where "witness program" is used in tests (concerns comments, variable names and in one instance even a function name) what we really want to denote is the "witness script". Thanks to [MarcoFalke for pointing this out in a review comment](bitcoin#22363 (comment))! Some historical background: At the time when the P2P segwit tests were first introduced (commit 330b0f3, PR bitcoin#8149), the term "witness program" was not used consistently in BIP141: https://bitcoin.stackexchange.com/questions/46451/what-is-the-precise-definition-of-witness-program This was fixed in PR bitcoin/bips#416 later. So in some way, this PR can be seen as a very late follow-up to the BIP141 fix that also reflects these changes in the tests. ACKs for top commit: josibake: tACK bitcoin@8a2b58d Tree-SHA512: f36bb9e53d1b54b86bfa87ec12f33e3ebca64b5f59d97e9662fe35ba12c25e1c9a4f93a5425d0eaa3879dce9e50368d345555b927bfab76945511f873396892b
ZIP 239 preparations 3 Cherry-picked from the following upstream PRs: - bitcoin/bitcoin#8080 - bitcoin/bitcoin#8082 - bitcoin/bitcoin#8126 - bitcoin/bitcoin#7910 - This is the unsquashed version of bitcoin/bitcoin#8149 - We take three cleanup commits to the protocol / `CInv` code. - bitcoin/bitcoin#8822 - bitcoin/bitcoin#8880 - Excluding the first commit (we don't have the comment it fixes yet). - bitcoin/bitcoin#19322
… are valid Does not include commit (fae3617) that makes a change to code introduced here: 330b0f3 [qa] p2p segwit tests (Merge bitcoin#8149: Segregated witness rebased) which I don't think is in Dash aaaa8eb test: consensus: Check that final transactions are valid (MarcoFalke) fae3617 test: Correctly deserialize without witness (MarcoFalke) Pull request description: There is no check that checks that final transactions are valid, i.e. the consensus rules could be changed (accidentally) with none of the tests failing. Tree-SHA512: 48f4c24bfcc525ddbc1bfe8c37131953b464823428c1f7a278ba6d98b98827b6b84a8eb2b33396bfb5b8cc4012b7cc1cd771637f405ea20beddae001c22aa290
… are valid Does not include commit (fae3617) that makes a change to code introduced here: 330b0f3 [qa] p2p segwit tests (Merge bitcoin#8149: Segregated witness rebased) which I don't think is in Dash aaaa8eb test: consensus: Check that final transactions are valid (MarcoFalke) fae3617 test: Correctly deserialize without witness (MarcoFalke) Pull request description: There is no check that checks that final transactions are valid, i.e. the consensus rules could be changed (accidentally) with none of the tests failing. Tree-SHA512: 48f4c24bfcc525ddbc1bfe8c37131953b464823428c1f7a278ba6d98b98827b6b84a8eb2b33396bfb5b8cc4012b7cc1cd771637f405ea20beddae001c22aa290
… are valid Does not include commit (fae3617) that makes a change to code introduced here: 330b0f3 [qa] p2p segwit tests (Merge bitcoin#8149: Segregated witness rebased) which I don't think is in Dash aaaa8eb test: consensus: Check that final transactions are valid (MarcoFalke) fae3617 test: Correctly deserialize without witness (MarcoFalke) Pull request description: There is no check that checks that final transactions are valid, i.e. the consensus rules could be changed (accidentally) with none of the tests failing. Tree-SHA512: 48f4c24bfcc525ddbc1bfe8c37131953b464823428c1f7a278ba6d98b98827b6b84a8eb2b33396bfb5b8cc4012b7cc1cd771637f405ea20beddae001c22aa290
… are valid Does not include commit (fae3617) that makes a change to code introduced here: 330b0f3 [qa] p2p segwit tests (Merge bitcoin#8149: Segregated witness rebased) which I don't think is in Dash aaaa8eb test: consensus: Check that final transactions are valid (MarcoFalke) fae3617 test: Correctly deserialize without witness (MarcoFalke) Pull request description: There is no check that checks that final transactions are valid, i.e. the consensus rules could be changed (accidentally) with none of the tests failing. Tree-SHA512: 48f4c24bfcc525ddbc1bfe8c37131953b464823428c1f7a278ba6d98b98827b6b84a8eb2b33396bfb5b8cc4012b7cc1cd771637f405ea20beddae001c22aa290
… are valid Does not include commit (fae3617) that makes a change to code introduced here: 330b0f3 [qa] p2p segwit tests (Merge bitcoin#8149: Segregated witness rebased) which I don't think is in Dash aaaa8eb test: consensus: Check that final transactions are valid (MarcoFalke) fae3617 test: Correctly deserialize without witness (MarcoFalke) Pull request description: There is no check that checks that final transactions are valid, i.e. the consensus rules could be changed (accidentally) with none of the tests failing. Tree-SHA512: 48f4c24bfcc525ddbc1bfe8c37131953b464823428c1f7a278ba6d98b98827b6b84a8eb2b33396bfb5b8cc4012b7cc1cd771637f405ea20beddae001c22aa290
… are valid Does not include commit (fae3617) that makes a change to code introduced here: 330b0f3 [qa] p2p segwit tests (Merge bitcoin#8149: Segregated witness rebased) which I don't think is in Dash aaaa8eb test: consensus: Check that final transactions are valid (MarcoFalke) fae3617 test: Correctly deserialize without witness (MarcoFalke) Pull request description: There is no check that checks that final transactions are valid, i.e. the consensus rules could be changed (accidentally) with none of the tests failing. Tree-SHA512: 48f4c24bfcc525ddbc1bfe8c37131953b464823428c1f7a278ba6d98b98827b6b84a8eb2b33396bfb5b8cc4012b7cc1cd771637f405ea20beddae001c22aa290
… are valid Does not include commit (fae3617) that makes a change to code introduced here: 330b0f3 [qa] p2p segwit tests (Merge bitcoin#8149: Segregated witness rebased) which I don't think is in Dash aaaa8eb test: consensus: Check that final transactions are valid (MarcoFalke) fae3617 test: Correctly deserialize without witness (MarcoFalke) Pull request description: There is no check that checks that final transactions are valid, i.e. the consensus rules could be changed (accidentally) with none of the tests failing. Tree-SHA512: 48f4c24bfcc525ddbc1bfe8c37131953b464823428c1f7a278ba6d98b98827b6b84a8eb2b33396bfb5b8cc4012b7cc1cd771637f405ea20beddae001c22aa290
This PR is a rebased and squashed version of #7910. As this is the form (in pieces or in whole) that we expect it to be merged in, I'm opening a separate pull request for it. I will leave the old one open for discussion and history.
The tree here is identical to the resulting tree there:
Where 3cb46c1 is #7910's tip commit, and 17389dc is this PR's tip commit.
Please make comments on #7910, so the history can be tracked, and everything stays in one place.