-
Notifications
You must be signed in to change notification settings - Fork 37.7k
Enforce SCRIPT_VERIFY_P2SH and SCRIPT_VERIFY_WITNESS from genesis #11739
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
Enforce SCRIPT_VERIFY_P2SH and SCRIPT_VERIFY_WITNESS from genesis #11739
Conversation
Forgot to flag this: there is one mainnet block that violated P2SH, and one testnet block as well. For now I carved out both, but perhaps we could consider migration to a new testnet (4?) instead and drop the testnet exception? Seems like it might be cleaner to have a new testnet that always has P2SH and segwit from genesis.... Does anyone think this would be worth proposing? |
src/validation.cpp
Outdated
fStrictPayToScriptHash = false; | ||
} | ||
|
||
unsigned int flags = fStrictPayToScriptHash ? SCRIPT_VERIFY_P2SH : SCRIPT_VERIFY_NONE; | ||
|
||
// Start enforcing P2SH (BIP16) | ||
if (pindex->nHeight >= consensusparams.BIP16Height) { |
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.
fixup nit: in commit 3a76e3c962516cdf7d577aa3dcbe0251b94e5355: You probably meant to use if (fStrictPayToScriptHash) { flags |= SCRIPT_VERIFY_P2SH; }
, as BIP16Height was removed and thus fails to compile.
Concept ACK. At a code level not so interesting, I suppose (except for maybe the P2SH backdating), but it's generally a nice property for us to, over time, enforce soft forks like SegWit universally.
…On November 20, 2017 12:32:05 PM PST, Suhas Daftuar ***@***.***> wrote:
As discussed at the IRC meeting back in October
(https://botbot.me/freenode/bitcoin-core-dev/2017-10-12/?msg=92231929&page=2),
I had looked into the feasibility of enforcing P2SH and
SCRIPT_VERIFY_WITNESS back to the genesis block.
The P2SH change is pretty straightforward -- there was only one
historical block on mainnet that violated the rule, so I carved out an
exception to it, similar to the way we have exceptions for the BIP30
violators.
The segwit change is not entirely as clear. The code changes
themselves are relatively straightforward: we can just always turn on
SCRIPT_VERIFY_WITNESS whenever P2SH is active. However conceptually,
this amounts to splitting up BIP141 into two parts, the part that
implements new script rules, and the part that handles witness
commitments in blocks.
Arguably though the script rules are really defined in BIP 143 anyway,
and so this really amounts to backdating BIP 143 -- script rules for v0
segwit outputs -- back to genesis. So maybe conceptually this isn't so
bad...
I don't feel strongly about this change in either direction; I started
working on it because I was searching for a way to simplify the way we
understand and implement the consensus rules around segwit, but I'm not
yet sure whether I think this achieves anything toward that goal.
ping @TheBlueMatt
You can view, comment on, or merge this pull request online at:
#11739
-- Commit Summary --
* Use P2SH consensus rules for all blocks
* Separate NULLDUMMY enforcement from SEGWIT enforcement
* Always enforce SCRIPT_VERIFY_WITNESS with P2SH
* [qa] Remove some pre-activation segwit tests
* scripted-diff: rename IsWitnessEnabled -> IsWitnessCommitmentEnabled
-- File Changes --
M src/chainparams.cpp (3)
M src/consensus/params.h (2)
M src/miner.cpp (2)
M src/net_processing.cpp (8)
M src/validation.cpp (49)
M src/validation.h (5)
M src/wallet/rpcwallet.cpp (2)
M test/functional/p2p-segwit.py (2)
M test/functional/segwit.py (8)
-- Patch Links --
https://github.com/bitcoin/bitcoin/pull/11739.patch
https://github.com/bitcoin/bitcoin/pull/11739.diff
--
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub:
#11739
|
The code changes here don't look as bad as I would have expected. I'd prefer to encapsulate the exception block hashes in chainparams, though. |
Concept ACK! as far as testnet, restarting with a new testnet would be fine, but there are a bunch of very interesting test cases in testnet we should consider extracting. One possibility would be to instrument the codebase to call the gprof things to record branch coverage data at each block; an then make a list of testnet blocks that increased cover. Seems like a real pain though. |
199573e
to
ad3e97a
Compare
Nits addressed. |
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 ad3e97a
src/validation.cpp
Outdated
// BIP16 didn't become active until Apr 1 2012 | ||
// However, only one historical block violated the P2SH rules, so for simplicity, always leave P2SH | ||
// on except for the one violating block. | ||
if (!(pindex->phashBlock != nullptr && (*(pindex->phashBlock) == consensusparams.BIP16Exception))) { |
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.
Why not assert pindex->phashBlock? No properly-constructed CBlockIndex should have that unset, no?
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.
It's unset when invoked via TestBlockValidity() (eg for mining).
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.
Ah, that sounds like a bug in TBV, but that's for a separate PR, I suppose.
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.
Yes, please, I always found checks to pindex->phashBlock == nullptr ugly and expensive to maintain documented (perhaps we can repeat the "pindex->phashBlock can be null if called by CreateNewBlock/TestBlockValidity" comment from the beginning and unify it with the comment for fEnforceBIP30, to more easily delete them all later when they're not needed). There's the assert you want below, just needs to be moved to the top once the special cases are dealt with more explicitly.
But, yeah, that's for a separate PR.
Concept ACK |
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 ad3e97a
src/validation.cpp
Outdated
// BIP16 didn't become active until Apr 1 2012 | ||
// However, only one historical block violated the P2SH rules, so for simplicity, always leave P2SH | ||
// on except for the one violating block. | ||
if (!(pindex->phashBlock != nullptr && (*(pindex->phashBlock) == consensusparams.BIP16Exception))) { |
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.
In commit "Use P2SH consensus rules for all blocks"
Maybe check BIP16Exception.IsNull() to be a little more strict. Could also remove unnecessary nesting and negatives:
if (consensusparams.BIP16Exception.IsNull() ||
pindex->phashBlock == nullptr ||
*pindex->phashBlock != consensusparams.BIP16Exception)
test/functional/p2p-segwit.py
Outdated
@@ -1905,7 +1905,7 @@ def run_test(self): | |||
self.test_unnecessary_witness_before_segwit_activation() | |||
self.test_witness_tx_relay_before_segwit_activation() | |||
self.test_block_relay(segwit_activated=False) | |||
self.test_p2sh_witness(segwit_activated=False) | |||
#self.test_p2sh_witness(segwit_activated=False) |
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.
In commit "[qa] Remove some pre-activation segwit tests"
Should actually remove
test/functional/segwit.py
Outdated
self.log.info("Verify unsigned bare witness txs in versionbits-setting blocks are valid before the fork") | ||
self.success_mine(self.nodes[2], wit_ids[NODE_2][WIT_V0][1], False) #block 428 | ||
self.success_mine(self.nodes[2], wit_ids[NODE_2][WIT_V1][1], False) #block 429 | ||
# TODO: verify spending a segwit v0 output is invalid before the fork |
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.
In commit "[qa] Remove some pre-activation segwit tests"
Note: TODO
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.
I don't understand this comment. What does 'before the fork' mean if segwit is active since genesis?
Tested ACK |
Addressed @ryanofsky's comments. However I think I will need to rebase in order to for the new test I wrote to work... |
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 needs a BIP IMO.
Concept ACK. if the segwit case is not clear yet, perhaps it should be left for later (in fact, I would prefer the 2 things in 2 different PRs either way, preferrably one on top of the other [perhaps open one with only p2sh and rebase this one of top of the new one], but all between the parenthesis is just PR bikeshedding).
src/validation.cpp
Outdated
// BIP16 didn't become active until Apr 1 2012 | ||
// However, only one historical block violated the P2SH rules, so for simplicity, always leave P2SH | ||
// on except for the one violating block. | ||
if (!(pindex->phashBlock != nullptr && (*(pindex->phashBlock) == consensusparams.BIP16Exception))) { |
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.
Yes, please, I always found checks to pindex->phashBlock == nullptr ugly and expensive to maintain documented (perhaps we can repeat the "pindex->phashBlock can be null if called by CreateNewBlock/TestBlockValidity" comment from the beginning and unify it with the comment for fEnforceBIP30, to more easily delete them all later when they're not needed). There's the assert you want below, just needs to be moved to the top once the special cases are dealt with more explicitly.
But, yeah, that's for a separate PR.
a76ce4c
to
b782474
Compare
Rebased and fixed the last commit to work with latest master. Previous version of these commits is at https://github.com/sdaftuar/bitcoin/commits/11739.1 |
@jtimon Agreed -- I sent an email to the bitcoin-dev list recently with a link to the draft BIP text. |
test/functional/segwit.py
Outdated
self.log.info("Verify unsigned bare witness txs in versionbits-setting blocks are valid before the fork") | ||
self.success_mine(self.nodes[2], wit_ids[NODE_2][WIT_V0][1], False) #block 428 | ||
self.success_mine(self.nodes[2], wit_ids[NODE_2][WIT_V1][1], False) #block 429 | ||
# TODO: verify spending a segwit v0 output is invalid before the fork |
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.
I don't understand this comment. What does 'before the fork' mean if segwit is active since genesis?
src/net_processing.cpp
Outdated
@@ -857,7 +857,7 @@ void PeerLogicValidation::NewPoWValidBlock(const CBlockIndex *pindex, const std: | |||
return; | |||
nHighestFastAnnounce = pindex->nHeight; | |||
|
|||
bool fWitnessEnabled = IsWitnessEnabled(pindex->pprev, Params().GetConsensus()); | |||
bool fWitnessEnabled = IsWitnessCommitmentEnabled(pindex->pprev, Params().GetConsensus()); |
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.
Could also change the name of the local variable here:
fWitnessEnabled
-> witness_commitment_enabled
src/chainparams.cpp
Outdated
consensus.BIP34Height = 227931; | ||
consensus.BIP34Hash = uint256S("0x000000000000024b89b42a942fe0d9fea3bb44ab7bd1b19115dd6a759c0808b8"); | ||
consensus.BIP16Exception = uint256S("0x00000000000002dc756eebf4f49723ed8d30cc28a5f108eb94b1ba88ac4f9c22"); |
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.
nit: prefer the BIP constants in numeric order (ie BIP 16 above BIP 34). Same for params.h below.
test/functional/p2p-segwit.py
Outdated
|
||
assert(len(self.utxo)) | ||
|
||
# Create two outputs, a p2wsh and p2sh-p2wsh |
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.
comment says p2sh-p2wsh, but the second output below is just a p2sh as far as I can tell.
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.
strange. The P2SH output can't be spent either. If I change the test_witness_block()
call to a test_transaction_acceptance()
call below, I see the following log:
(mandatory-script-verify-flag-failed (Operation not valid with the current stack size) (code 16))
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.
Fixed -- I forgot to stick the p2sh redeem script in the scriptsig (and also inadvertently made this a p2sh, rather than p2sh-p2wsh).
utACK up to 4e2b90d. I don't think the final commit adds any value and can be removed from this PR. |
42caf4d
to
33203e1
Compare
Github thought this needed to be rebased, so I did, though there were no conflicts to be resolved. |
test/functional/feature_segwit.py
Outdated
self.log.info("Verify unsigned bare witness txs in versionbits-setting blocks are valid before the fork") | ||
self.success_mine(self.nodes[2], wit_ids[NODE_2][WIT_V0][1], False) #block 428 | ||
self.success_mine(self.nodes[2], wit_ids[NODE_2][WIT_V1][1], False) #block 429 | ||
# TODO: verify spending a segwit v0 output is invalid before the fork |
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.
I wouldn't bother adding this comment, which you're just going to remove in a later commit. I think you can also remove the comment above.
33203e1
to
98e4af6
Compare
I decided to remove the scripted-diff commit, because in retrospect I think the existing function name, Addressed nits from @jnewbery and @ryanofsky and squashed. Old version is: https://github.com/sdaftuar/bitcoin/commits/11739.3 |
98e4af6
to
831b8bd
Compare
This commit moves P2SH activation back to the genesis block, with a hardcoded exception for the one historical block in the chain that violated this rule.
This is in preparation for enforcing SCRIPT_VERIFY_WITNESS from the genesis block.
This is in preparation for always enforcing SCRIPT_VERIFY_WITNESS.
Also updates the comments for an existing test, that now should be rewritten. Includes changes suggested by John Newbery.
dee104d
to
8b56fc0
Compare
Needed rebase. |
Tests are passing now. |
non-test-changes-re-utACK 8b56fc0 (though I miss the s/IsWitnessEnabled/IsWitnessCommitmentEnabled/ scripted-diff change). |
utACK 8b56fc0 |
…om genesis 8b56fc0 [qa] Test that v0 segwit outputs can't be spent pre-activation (Suhas Daftuar) ccb8ca4 Always enforce SCRIPT_VERIFY_WITNESS with P2SH (Suhas Daftuar) 5c31b20 [qa] Remove some pre-activation segwit tests (Suhas Daftuar) 95749a5 Separate NULLDUMMY enforcement from SEGWIT enforcement (Suhas Daftuar) ce65018 Use P2SH consensus rules for all blocks (Suhas Daftuar) Pull request description: As discussed at the IRC meeting back in October (https://botbot.me/freenode/bitcoin-core-dev/2017-10-12/?msg=92231929&page=2), I had looked into the feasibility of enforcing P2SH and SCRIPT_VERIFY_WITNESS back to the genesis block. The P2SH change is pretty straightforward -- there was only one historical block on mainnet that violated the rule, so I carved out an exception to it, similar to the way we have exceptions for the BIP30 violators. The segwit change is not entirely as clear. The code changes themselves are relatively straightforward: we can just always turn on SCRIPT_VERIFY_WITNESS whenever P2SH is active. However conceptually, this amounts to splitting up BIP141 into two parts, the part that implements new script rules, and the part that handles witness commitments in blocks. Arguably though the script rules are really defined in BIP 143 anyway, and so this really amounts to backdating BIP 143 -- script rules for v0 segwit outputs -- back to genesis. So maybe conceptually this isn't so bad... I don't feel strongly about this change in either direction; I started working on it because I was searching for a way to simplify the way we understand and implement the consensus rules around segwit, but I'm not yet sure whether I think this achieves anything toward that goal. ping @TheBlueMatt Tree-SHA512: 73551d4a983eb9792c7ac67f56005822528ac4d1fd52c27cee6d305ebee953f69687ef4ddee8bdc0fec77f77e6b5a9d669750793efee54c076533a095e233042
…or TBV Summary: 9c5a4a6 Stop special-casing phashBlock handling in validation for TBV (Matt Corallo) Pull request description: There is no reason to do this, really, we already have "ignore PoW" flags. Motivated by bitcoin/bitcoin#11739 (comment) Tree-SHA512: 37cb1ae5b11c9e8ed7a679bb07ad3b119a2a014744b26d197d67ba21beb19fe6815271df935e40f7c7bd5f2e4d7ae4dad7bd4d00fa230a8d789f37e9de31a769 Backport of Core PR 11880 https://github.com/bitcoin/bitcoin/pull/11880/files Test Plan: ninja check make check test_runner.py Reviewers: deadalnix, Fabien, #bitcoin_abc Reviewed By: Fabien, #bitcoin_abc Differential Revision: https://reviews.bitcoinabc.org/D2898
…or TBV Summary: 9c5a4a6ed Stop special-casing phashBlock handling in validation for TBV (Matt Corallo) Pull request description: There is no reason to do this, really, we already have "ignore PoW" flags. Motivated by bitcoin/bitcoin#11739 (comment) Tree-SHA512: 37cb1ae5b11c9e8ed7a679bb07ad3b119a2a014744b26d197d67ba21beb19fe6815271df935e40f7c7bd5f2e4d7ae4dad7bd4d00fa230a8d789f37e9de31a769 Backport of Core PR 11880 https://github.com/bitcoin/bitcoin/pull/11880/files Test Plan: ninja check make check test_runner.py Reviewers: deadalnix, Fabien, #bitcoin_abc Reviewed By: Fabien, #bitcoin_abc Differential Revision: https://reviews.bitcoinabc.org/D2898
db1cbcc [RPC] Remove deprecated addmultisigaddress return format (John Newbery) cb28a0b [RPC] Remove deprecated createmultisig object (John Newbery) ed45c82 [tests] Remove test for deprecated createmultsig option (John Newbery) d066a1c [rpc] Remove deprecated getmininginfo RPC option (John Newbery) c6f09c2 [rpc] remove deprecated estimatefee RPC (John Newbery) a8e437a [tests] Remove estimatefee from rpc_deprecated.py test (John Newbery) a5623b1 [tests] Remove tests for deprecated estimatefee RPC (John Newbery) d119f2e [tests] Fix style warnings in feature_fee_estimation.py (John Newbery) Pull request description: There were some RPC/RPC options deprecated in v0.16. Those can now be removed from master since v0.16 has been branched. - `estimatefee` RPC has been removed. The `feature_fee_estimation.py` test has been updated to remove the RPC, but doesn't yet have good coverage of the replacement RPC `estimatesmartfee`. Improving the test coverage should be done in a new PR. (bitcoin#11031) - the `errors` field returned by `getmininginfo` has been deprecated and replaced by a `warning` field. (bitcoin#10858) - providing addresses as inputs to `createmultisig` has been deprecated. Users should use `addmultisigaddress` instead (bitcoin#11415) - The return format from `addmultisigaddress` has changed (bitcoin#11415) `getwitnessaddress` was also deprecated in v0.16 and can be removed, but many tests are using that RPC, so it's a larger job to remove. It should be removed in a separate PR (possibly after bitcoin#11739 and bitcoin#11398 have been merged and the segwit test code tidied up) Tree-SHA512: 8ffaa5f6094131339b9e9e468e8b141de4b144697d2271efa2992b80b12eb97849ade3da8df5c1c9400ed4c04e6a029926550a3e5846d2029b644f9e84ac7124
db1cbcc [RPC] Remove deprecated addmultisigaddress return format (John Newbery) cb28a0b [RPC] Remove deprecated createmultisig object (John Newbery) ed45c82 [tests] Remove test for deprecated createmultsig option (John Newbery) d066a1c [rpc] Remove deprecated getmininginfo RPC option (John Newbery) c6f09c2 [rpc] remove deprecated estimatefee RPC (John Newbery) a8e437a [tests] Remove estimatefee from rpc_deprecated.py test (John Newbery) a5623b1 [tests] Remove tests for deprecated estimatefee RPC (John Newbery) d119f2e [tests] Fix style warnings in feature_fee_estimation.py (John Newbery) Pull request description: There were some RPC/RPC options deprecated in v0.16. Those can now be removed from master since v0.16 has been branched. - `estimatefee` RPC has been removed. The `feature_fee_estimation.py` test has been updated to remove the RPC, but doesn't yet have good coverage of the replacement RPC `estimatesmartfee`. Improving the test coverage should be done in a new PR. (bitcoin#11031) - the `errors` field returned by `getmininginfo` has been deprecated and replaced by a `warning` field. (bitcoin#10858) - providing addresses as inputs to `createmultisig` has been deprecated. Users should use `addmultisigaddress` instead (bitcoin#11415) - The return format from `addmultisigaddress` has changed (bitcoin#11415) `getwitnessaddress` was also deprecated in v0.16 and can be removed, but many tests are using that RPC, so it's a larger job to remove. It should be removed in a separate PR (possibly after bitcoin#11739 and bitcoin#11398 have been merged and the segwit test code tidied up) Tree-SHA512: 8ffaa5f6094131339b9e9e468e8b141de4b144697d2271efa2992b80b12eb97849ade3da8df5c1c9400ed4c04e6a029926550a3e5846d2029b644f9e84ac7124
db1cbcc [RPC] Remove deprecated addmultisigaddress return format (John Newbery) cb28a0b [RPC] Remove deprecated createmultisig object (John Newbery) ed45c82 [tests] Remove test for deprecated createmultsig option (John Newbery) d066a1c [rpc] Remove deprecated getmininginfo RPC option (John Newbery) c6f09c2 [rpc] remove deprecated estimatefee RPC (John Newbery) a8e437a [tests] Remove estimatefee from rpc_deprecated.py test (John Newbery) a5623b1 [tests] Remove tests for deprecated estimatefee RPC (John Newbery) d119f2e [tests] Fix style warnings in feature_fee_estimation.py (John Newbery) Pull request description: There were some RPC/RPC options deprecated in v0.16. Those can now be removed from master since v0.16 has been branched. - `estimatefee` RPC has been removed. The `feature_fee_estimation.py` test has been updated to remove the RPC, but doesn't yet have good coverage of the replacement RPC `estimatesmartfee`. Improving the test coverage should be done in a new PR. (bitcoin#11031) - the `errors` field returned by `getmininginfo` has been deprecated and replaced by a `warning` field. (bitcoin#10858) - providing addresses as inputs to `createmultisig` has been deprecated. Users should use `addmultisigaddress` instead (bitcoin#11415) - The return format from `addmultisigaddress` has changed (bitcoin#11415) `getwitnessaddress` was also deprecated in v0.16 and can be removed, but many tests are using that RPC, so it's a larger job to remove. It should be removed in a separate PR (possibly after bitcoin#11739 and bitcoin#11398 have been merged and the segwit test code tidied up) Tree-SHA512: 8ffaa5f6094131339b9e9e468e8b141de4b144697d2271efa2992b80b12eb97849ade3da8df5c1c9400ed4c04e6a029926550a3e5846d2029b644f9e84ac7124
db1cbcc [RPC] Remove deprecated addmultisigaddress return format (John Newbery) cb28a0b [RPC] Remove deprecated createmultisig object (John Newbery) ed45c82 [tests] Remove test for deprecated createmultsig option (John Newbery) d066a1c [rpc] Remove deprecated getmininginfo RPC option (John Newbery) c6f09c2 [rpc] remove deprecated estimatefee RPC (John Newbery) a8e437a [tests] Remove estimatefee from rpc_deprecated.py test (John Newbery) a5623b1 [tests] Remove tests for deprecated estimatefee RPC (John Newbery) d119f2e [tests] Fix style warnings in feature_fee_estimation.py (John Newbery) Pull request description: There were some RPC/RPC options deprecated in v0.16. Those can now be removed from master since v0.16 has been branched. - `estimatefee` RPC has been removed. The `feature_fee_estimation.py` test has been updated to remove the RPC, but doesn't yet have good coverage of the replacement RPC `estimatesmartfee`. Improving the test coverage should be done in a new PR. (bitcoin#11031) - the `errors` field returned by `getmininginfo` has been deprecated and replaced by a `warning` field. (bitcoin#10858) - providing addresses as inputs to `createmultisig` has been deprecated. Users should use `addmultisigaddress` instead (bitcoin#11415) - The return format from `addmultisigaddress` has changed (bitcoin#11415) `getwitnessaddress` was also deprecated in v0.16 and can be removed, but many tests are using that RPC, so it's a larger job to remove. It should be removed in a separate PR (possibly after bitcoin#11739 and bitcoin#11398 have been merged and the segwit test code tidied up) Tree-SHA512: 8ffaa5f6094131339b9e9e468e8b141de4b144697d2271efa2992b80b12eb97849ade3da8df5c1c9400ed4c04e6a029926550a3e5846d2029b644f9e84ac7124
…ation for TBV 9c5a4a6 Stop special-casing phashBlock handling in validation for TBV (Matt Corallo) Pull request description: There is no reason to do this, really, we already have "ignore PoW" flags. Motivated by bitcoin#11739 (comment) Tree-SHA512: 37cb1ae5b11c9e8ed7a679bb07ad3b119a2a014744b26d197d67ba21beb19fe6815271df935e40f7c7bd5f2e4d7ae4dad7bd4d00fa230a8d789f37e9de31a769
db1cbcc [RPC] Remove deprecated addmultisigaddress return format (John Newbery) cb28a0b [RPC] Remove deprecated createmultisig object (John Newbery) ed45c82 [tests] Remove test for deprecated createmultsig option (John Newbery) d066a1c [rpc] Remove deprecated getmininginfo RPC option (John Newbery) c6f09c2 [rpc] remove deprecated estimatefee RPC (John Newbery) a8e437a [tests] Remove estimatefee from rpc_deprecated.py test (John Newbery) a5623b1 [tests] Remove tests for deprecated estimatefee RPC (John Newbery) d119f2e [tests] Fix style warnings in feature_fee_estimation.py (John Newbery) Pull request description: There were some RPC/RPC options deprecated in v0.16. Those can now be removed from master since v0.16 has been branched. - `estimatefee` RPC has been removed. The `feature_fee_estimation.py` test has been updated to remove the RPC, but doesn't yet have good coverage of the replacement RPC `estimatesmartfee`. Improving the test coverage should be done in a new PR. (bitcoin#11031) - the `errors` field returned by `getmininginfo` has been deprecated and replaced by a `warning` field. (bitcoin#10858) - providing addresses as inputs to `createmultisig` has been deprecated. Users should use `addmultisigaddress` instead (bitcoin#11415) - The return format from `addmultisigaddress` has changed (bitcoin#11415) `getwitnessaddress` was also deprecated in v0.16 and can be removed, but many tests are using that RPC, so it's a larger job to remove. It should be removed in a separate PR (possibly after bitcoin#11739 and bitcoin#11398 have been merged and the segwit test code tidied up) Tree-SHA512: 8ffaa5f6094131339b9e9e468e8b141de4b144697d2271efa2992b80b12eb97849ade3da8df5c1c9400ed4c04e6a029926550a3e5846d2029b644f9e84ac7124
db1cbcc [RPC] Remove deprecated addmultisigaddress return format (John Newbery) cb28a0b [RPC] Remove deprecated createmultisig object (John Newbery) ed45c82 [tests] Remove test for deprecated createmultsig option (John Newbery) d066a1c [rpc] Remove deprecated getmininginfo RPC option (John Newbery) c6f09c2 [rpc] remove deprecated estimatefee RPC (John Newbery) a8e437a [tests] Remove estimatefee from rpc_deprecated.py test (John Newbery) a5623b1 [tests] Remove tests for deprecated estimatefee RPC (John Newbery) d119f2e [tests] Fix style warnings in feature_fee_estimation.py (John Newbery) Pull request description: There were some RPC/RPC options deprecated in v0.16. Those can now be removed from master since v0.16 has been branched. - `estimatefee` RPC has been removed. The `feature_fee_estimation.py` test has been updated to remove the RPC, but doesn't yet have good coverage of the replacement RPC `estimatesmartfee`. Improving the test coverage should be done in a new PR. (bitcoin#11031) - the `errors` field returned by `getmininginfo` has been deprecated and replaced by a `warning` field. (bitcoin#10858) - providing addresses as inputs to `createmultisig` has been deprecated. Users should use `addmultisigaddress` instead (bitcoin#11415) - The return format from `addmultisigaddress` has changed (bitcoin#11415) `getwitnessaddress` was also deprecated in v0.16 and can be removed, but many tests are using that RPC, so it's a larger job to remove. It should be removed in a separate PR (possibly after bitcoin#11739 and bitcoin#11398 have been merged and the segwit test code tidied up) Tree-SHA512: 8ffaa5f6094131339b9e9e468e8b141de4b144697d2271efa2992b80b12eb97849ade3da8df5c1c9400ed4c04e6a029926550a3e5846d2029b644f9e84ac7124
…ation for TBV 9c5a4a6 Stop special-casing phashBlock handling in validation for TBV (Matt Corallo) Pull request description: There is no reason to do this, really, we already have "ignore PoW" flags. Motivated by bitcoin#11739 (comment) Tree-SHA512: 37cb1ae5b11c9e8ed7a679bb07ad3b119a2a014744b26d197d67ba21beb19fe6815271df935e40f7c7bd5f2e4d7ae4dad7bd4d00fa230a8d789f37e9de31a769
…ation for TBV 9c5a4a6 Stop special-casing phashBlock handling in validation for TBV (Matt Corallo) Pull request description: There is no reason to do this, really, we already have "ignore PoW" flags. Motivated by bitcoin#11739 (comment) Tree-SHA512: 37cb1ae5b11c9e8ed7a679bb07ad3b119a2a014744b26d197d67ba21beb19fe6815271df935e40f7c7bd5f2e4d7ae4dad7bd4d00fa230a8d789f37e9de31a769
…ation for TBV 9c5a4a6 Stop special-casing phashBlock handling in validation for TBV (Matt Corallo) Pull request description: There is no reason to do this, really, we already have "ignore PoW" flags. Motivated by bitcoin#11739 (comment) Tree-SHA512: 37cb1ae5b11c9e8ed7a679bb07ad3b119a2a014744b26d197d67ba21beb19fe6815271df935e40f7c7bd5f2e4d7ae4dad7bd4d00fa230a8d789f37e9de31a769
…ation for TBV 9c5a4a6 Stop special-casing phashBlock handling in validation for TBV (Matt Corallo) Pull request description: There is no reason to do this, really, we already have "ignore PoW" flags. Motivated by bitcoin#11739 (comment) Tree-SHA512: 37cb1ae5b11c9e8ed7a679bb07ad3b119a2a014744b26d197d67ba21beb19fe6815271df935e40f7c7bd5f2e4d7ae4dad7bd4d00fa230a8d789f37e9de31a769
As discussed at the IRC meeting back in October (https://botbot.me/freenode/bitcoin-core-dev/2017-10-12/?msg=92231929&page=2), I had looked into the feasibility of enforcing P2SH and SCRIPT_VERIFY_WITNESS back to the genesis block.
The P2SH change is pretty straightforward -- there was only one historical block on mainnet that violated the rule, so I carved out an exception to it, similar to the way we have exceptions for the BIP30 violators.
The segwit change is not entirely as clear. The code changes themselves are relatively straightforward: we can just always turn on SCRIPT_VERIFY_WITNESS whenever P2SH is active. However conceptually, this amounts to splitting up BIP141 into two parts, the part that implements new script rules, and the part that handles witness commitments in blocks.
Arguably though the script rules are really defined in BIP 143 anyway, and so this really amounts to backdating BIP 143 -- script rules for v0 segwit outputs -- back to genesis. So maybe conceptually this isn't so bad...
I don't feel strongly about this change in either direction; I started working on it because I was searching for a way to simplify the way we understand and implement the consensus rules around segwit, but I'm not yet sure whether I think this achieves anything toward that goal.
ping @TheBlueMatt