Skip to content

Conversation

maflcko
Copy link
Member

@maflcko maflcko commented Jul 9, 2019

This adds a test for BIP30 to check that duplicate txs can exist in the blockchain given the first one was completely spent when the second one is added. (Requested by ajtowns in #16333 (comment))

We can not add a test that a later duplicate tx overwrites a previous one, because BIP30 is always enforced on regtest. If someone feels strongly about such a test, some Bitcoin Core code would have to be modified, which can be done in a follow up pull request.

Also, add a commit to fix the BIP34 test failures reported in #14633 (comment)

@DrahtBot
Copy link
Contributor

DrahtBot commented Jul 9, 2019

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Coverage

Coverage Change (pull 16363, c1f0f85) Reference (master, 8046a3e)
Lines -0.0336 % 89.0827 %
Functions +0.0157 % 82.0163 %
Branches -0.0049 % 45.2266 %

Updated at: 2019-07-09T23:07:22.556814.

@laanwj
Copy link
Member

laanwj commented Jul 10, 2019

Concept ACK

@sdaftuar
Copy link
Member

We can not add a test that a later duplicate tx overwrites a previous one, because BIP30 is always enforced on regtest.

I think we cannot add such a test because it would violate consensus rules, except for the two hardcoded exceptions on mainnet!

Also I think it's worth pointing out that the optimizations we have in place for mainnet, where we don't actually enforce BIP30 explicitly if we're on the BIP34-activating chain we expect to be on, makes regtest-testing less meaningful here. However, we do rely on BIP 30 being explicitly enforced for alternate chains, which is critical to allowing a node to reorg to the main chain if being fed an alternate early history, so this is probably a good test to add overall.

@maflcko
Copy link
Member Author

maflcko commented Jul 10, 2019

I think we cannot add such a test because it would violate consensus rules, except for the two hardcoded exceptions on mainnet!

Yes, we'd have to add a regtest exception as well, and I'd prefer not to modify source code in a pull that only adds tests.

@ajtowns
Copy link
Contributor

ajtowns commented Jul 16, 2019

We check that the hardcoded exceptions work correctly everytime someone does an IBD and we check the non-exceptional case every other block, so doesn't seem like there's much value in adding regtest-only exceptions to me...

@laanwj
Copy link
Member

laanwj commented Aug 1, 2019

Code review ACK fa8489a

maflcko pushed a commit to maflcko/bitcoin-core that referenced this pull request Aug 5, 2019
fa8489a test: Add test for BIP30 duplicate tx (MarcoFalke)
77770d9 test: Properly serialize BIP34 coinbase height (MarcoFalke)

Pull request description:

  This adds a test for BIP30 to check that duplicate txs can exist in the blockchain given the first one was completely spent when the second one is added. (Requested by ajtowns in bitcoin#16333 (comment))

  We can not add a test that a later duplicate tx overwrites a previous one, because BIP30 is always enforced on regtest. If someone feels strongly about such a test, some Bitcoin Core code would have to be modified, which can be done in a follow up pull request.

  Also, add a commit to fix the BIP34 test failures reported in bitcoin#14633 (comment)

ACKs for top commit:
  laanwj:
    Code review ACK fa8489a

Tree-SHA512: c707d0bdc93937263876b603425b53322a2a9f9ec3f50716ae2fa9de8ddc644beb22b26c1bfde7f4aab102633e096b354ef380db919176bd2cb44a2828f884aa
@maflcko maflcko merged commit fa8489a into bitcoin:master Aug 5, 2019
@maflcko maflcko deleted the 1907-qaBIP30 branch August 5, 2019 12:18
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Aug 10, 2019
fa8489a test: Add test for BIP30 duplicate tx (MarcoFalke)
77770d9 test: Properly serialize BIP34 coinbase height (MarcoFalke)

Pull request description:

  This adds a test for BIP30 to check that duplicate txs can exist in the blockchain given the first one was completely spent when the second one is added. (Requested by ajtowns in bitcoin#16333 (comment))

  We can not add a test that a later duplicate tx overwrites a previous one, because BIP30 is always enforced on regtest. If someone feels strongly about such a test, some Bitcoin Core code would have to be modified, which can be done in a follow up pull request.

  Also, add a commit to fix the BIP34 test failures reported in bitcoin#14633 (comment)

ACKs for top commit:
  laanwj:
    Code review ACK fa8489a

Tree-SHA512: c707d0bdc93937263876b603425b53322a2a9f9ec3f50716ae2fa9de8ddc644beb22b26c1bfde7f4aab102633e096b354ef380db919176bd2cb44a2828f884aa
jasonbcox pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Oct 13, 2020
Summary:
In addition to the original commit, I had to add `from .script import OP_1`, which was skipped in our backport of PR11796 (D5750)

Partial backport of [[bitcoin/bitcoin#16363 | PR16363]]
Commit [[bitcoin/bitcoin@77770d9 | 77770d95e2838d7665fa8f621e9e83d79f9b3196]]

Test Plan: `ninja && ninja check-functional`

Reviewers: O1 Bitcoin ABC, #bitcoin_abc, deadalnix

Reviewed By: O1 Bitcoin ABC, #bitcoin_abc, deadalnix

Subscribers: deadalnix

Differential Revision: https://reviews.bitcoinabc.org/D7901
jasonbcox pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Oct 13, 2020
Summary:
This adds a test for BIP30 to check that duplicate txs can exist in the blockchain given the first one was completely spent when the second one is added.

Note that some lines modified in the Core PR were moved and deleted on our side (D5060, D6101)

This concludes backport of Core [[bitcoin/bitcoin#16363 | PR16363]]
Commit: [[bitcoin/bitcoin@fa8489a | fa8489a15511f61a372473927e73c34692bbec23]]
Depends on D7901

Test Plan: `ninja && ./test/functional/test_runner.py feature_block`

Reviewers: O1 Bitcoin ABC, #bitcoin_abc, deadalnix

Reviewed By: O1 Bitcoin ABC, #bitcoin_abc, deadalnix

Subscribers: deadalnix

Differential Revision: https://reviews.bitcoinabc.org/D7902
Munkybooty pushed a commit to Munkybooty/dash that referenced this pull request Nov 25, 2021
fa8489a test: Add test for BIP30 duplicate tx (MarcoFalke)
77770d9 test: Properly serialize BIP34 coinbase height (MarcoFalke)

Pull request description:

  This adds a test for BIP30 to check that duplicate txs can exist in the blockchain given the first one was completely spent when the second one is added. (Requested by ajtowns in bitcoin#16333 (comment))

  We can not add a test that a later duplicate tx overwrites a previous one, because BIP30 is always enforced on regtest. If someone feels strongly about such a test, some Bitcoin Core code would have to be modified, which can be done in a follow up pull request.

  Also, add a commit to fix the BIP34 test failures reported in bitcoin#14633 (comment)

ACKs for top commit:
  laanwj:
    Code review ACK fa8489a

Tree-SHA512: c707d0bdc93937263876b603425b53322a2a9f9ec3f50716ae2fa9de8ddc644beb22b26c1bfde7f4aab102633e096b354ef380db919176bd2cb44a2828f884aa
Munkybooty pushed a commit to Munkybooty/dash that referenced this pull request Nov 25, 2021
fa8489a test: Add test for BIP30 duplicate tx (MarcoFalke)
77770d9 test: Properly serialize BIP34 coinbase height (MarcoFalke)

Pull request description:

  This adds a test for BIP30 to check that duplicate txs can exist in the blockchain given the first one was completely spent when the second one is added. (Requested by ajtowns in bitcoin#16333 (comment))

  We can not add a test that a later duplicate tx overwrites a previous one, because BIP30 is always enforced on regtest. If someone feels strongly about such a test, some Bitcoin Core code would have to be modified, which can be done in a follow up pull request.

  Also, add a commit to fix the BIP34 test failures reported in bitcoin#14633 (comment)

ACKs for top commit:
  laanwj:
    Code review ACK fa8489a

Tree-SHA512: c707d0bdc93937263876b603425b53322a2a9f9ec3f50716ae2fa9de8ddc644beb22b26c1bfde7f4aab102633e096b354ef380db919176bd2cb44a2828f884aa
Munkybooty pushed a commit to Munkybooty/dash that referenced this pull request Nov 30, 2021
fa8489a test: Add test for BIP30 duplicate tx (MarcoFalke)
77770d9 test: Properly serialize BIP34 coinbase height (MarcoFalke)

Pull request description:

  This adds a test for BIP30 to check that duplicate txs can exist in the blockchain given the first one was completely spent when the second one is added. (Requested by ajtowns in bitcoin#16333 (comment))

  We can not add a test that a later duplicate tx overwrites a previous one, because BIP30 is always enforced on regtest. If someone feels strongly about such a test, some Bitcoin Core code would have to be modified, which can be done in a follow up pull request.

  Also, add a commit to fix the BIP34 test failures reported in bitcoin#14633 (comment)

ACKs for top commit:
  laanwj:
    Code review ACK fa8489a

Tree-SHA512: c707d0bdc93937263876b603425b53322a2a9f9ec3f50716ae2fa9de8ddc644beb22b26c1bfde7f4aab102633e096b354ef380db919176bd2cb44a2828f884aa
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Dec 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants