mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 20:12:57 +01:00
07dcddb4ca
* Merge #9815: Trivial: use EXIT_ codes instead of magic numbersa87d02a
use EXIT_ codes instead of magic numbers (Marko Bencun) * Merge #9801: Removed redundant parameter from mempool.PrioritiseTransactioneaea2bb
Removed redundant parameter from mempool.PrioritiseTransaction (gubatron) * remove extra parameter (see 3a3745bb) in dash specific code * Merge #9819: Remove harmless read of unusued priority estimatesbc8fd12
Remove harmless read of unusued priority estimates (Alex Morcos) * Merge #9766: Add --exclude option to rpc-tests.pyc578408
Add exclude option to rpc-tests.py (John Newbery) * Merge #9577: Fix docstrings in qa tests3f95a80
Fix docstrings in qa tests (John Newbery) * Merge #9823: qa: Set correct path for binaries in rpc tests3333ad0
qa: Set correct path for binaries in rpc tests (MarcoFalke) * Merge #9833: Trivial: fix comments referencing AppInit2ef9f495
Trivial: fix comments referencing AppInit2 (Marko Bencun) * Merge #9612: [trivial] Rephrase the definition of difficulty.dc222f8
Trivial: Rephrase the definition of difficulty in the code. (Karl-Johan Alm) * Merge #9847: Extra test vector for BIP3230aedcb
BIP32 extra test vector (Pieter Wuille) * Merge #9839: [qa] Make import-rescan.py watchonly check reliable864890a
[qa] Make import-rescan.py watchonly check reliable (Russell Yanofsky) Tree-SHA512: ea0e2b1d4fc8f35174c3d575fb751b428daf6ad3aa944fad4e3ddcc9195e4f17051473acabc54203b1d27cca64cf911b737ab92e986c40ef384410652e2dbea1 * Change back file params
90 lines
3.2 KiB
Python
Executable File
90 lines
3.2 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
# Copyright (c) 2015-2016 The Bitcoin Core developers
|
|
# Distributed under the MIT software license, see the accompanying
|
|
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
"""Test the CHECKLOCKTIMEVERIFY (BIP65) soft-fork logic."""
|
|
|
|
from test_framework.test_framework import BitcoinTestFramework
|
|
from test_framework.util import *
|
|
|
|
class BIP65Test(BitcoinTestFramework):
|
|
def __init__(self):
|
|
super().__init__()
|
|
self.num_nodes = 3
|
|
self.setup_clean_chain = False
|
|
|
|
def setup_network(self):
|
|
self.nodes = []
|
|
self.nodes.append(start_node(0, self.options.tmpdir, []))
|
|
self.nodes.append(start_node(1, self.options.tmpdir, ["-blockversion=3"]))
|
|
self.nodes.append(start_node(2, self.options.tmpdir, ["-blockversion=4"]))
|
|
connect_nodes(self.nodes[1], 0)
|
|
connect_nodes(self.nodes[2], 0)
|
|
self.is_network_split = False
|
|
self.sync_all()
|
|
|
|
def run_test(self):
|
|
cnt = self.nodes[0].getblockcount()
|
|
|
|
# Mine some old-version blocks
|
|
self.nodes[1].generate(200)
|
|
cnt += 100
|
|
self.sync_all()
|
|
if (self.nodes[0].getblockcount() != cnt + 100):
|
|
raise AssertionError("Failed to mine 100 version=3 blocks")
|
|
|
|
# Mine 750 new-version blocks
|
|
for i in range(15):
|
|
self.nodes[2].generate(50)
|
|
self.sync_all()
|
|
if (self.nodes[0].getblockcount() != cnt + 850):
|
|
raise AssertionError("Failed to mine 750 version=4 blocks")
|
|
|
|
# TODO: check that new CHECKLOCKTIMEVERIFY rules are not enforced
|
|
|
|
# Mine 1 new-version block
|
|
self.nodes[2].generate(1)
|
|
self.sync_all()
|
|
if (self.nodes[0].getblockcount() != cnt + 851):
|
|
raise AssertionError("Failed to mine a version=4 blocks")
|
|
|
|
# TODO: check that new CHECKLOCKTIMEVERIFY rules are enforced
|
|
|
|
# Mine 198 new-version blocks
|
|
for i in range(2):
|
|
self.nodes[2].generate(99)
|
|
self.sync_all()
|
|
if (self.nodes[0].getblockcount() != cnt + 1049):
|
|
raise AssertionError("Failed to mine 198 version=4 blocks")
|
|
|
|
# Mine 1 old-version block
|
|
self.nodes[1].generate(1)
|
|
self.sync_all()
|
|
if (self.nodes[0].getblockcount() != cnt + 1050):
|
|
raise AssertionError("Failed to mine a version=3 block after 949 version=4 blocks")
|
|
|
|
# Mine 1 new-version blocks
|
|
self.nodes[2].generate(1)
|
|
self.sync_all()
|
|
if (self.nodes[0].getblockcount() != cnt + 1051):
|
|
raise AssertionError("Failed to mine a version=4 block")
|
|
|
|
# Mine 1 old-version blocks
|
|
try:
|
|
self.nodes[1].generate(1)
|
|
raise AssertionError("Succeeded to mine a version=3 block after 950 version=4 blocks")
|
|
except JSONRPCException:
|
|
pass
|
|
self.sync_all()
|
|
if (self.nodes[0].getblockcount() != cnt + 1051):
|
|
raise AssertionError("Accepted a version=3 block after 950 version=4 blocks")
|
|
|
|
# Mine 1 new-version blocks
|
|
self.nodes[2].generate(1)
|
|
self.sync_all()
|
|
if (self.nodes[0].getblockcount() != cnt + 1052):
|
|
raise AssertionError("Failed to mine a version=4 block")
|
|
|
|
if __name__ == '__main__':
|
|
BIP65Test().main()
|