]> Git Repo - VerusCoin.git/blame_incremental - qa/rpc-tests/bipdersig.py
Strict DER signatures are always enforced; remove the flag and code that used it.
[VerusCoin.git] / qa / rpc-tests / bipdersig.py
... / ...
CommitLineData
1#!/usr/bin/env python2
2# Copyright (c) 2014 The Bitcoin Core developers
3# Distributed under the MIT software license, see the accompanying
4# file COPYING or http://www.opensource.org/licenses/mit-license.php.
5
6#
7# Test the BIP66 changeover logic
8#
9
10from test_framework.test_framework import BitcoinTestFramework
11from test_framework.util import *
12import os
13import shutil
14
15class BIP66Test(BitcoinTestFramework):
16
17 def setup_network(self):
18 self.nodes = []
19 self.nodes.append(start_node(0, self.options.tmpdir, []))
20 self.nodes.append(start_node(1, self.options.tmpdir, ["-blockversion=2"]))
21 self.nodes.append(start_node(2, self.options.tmpdir, ["-blockversion=3"]))
22 connect_nodes(self.nodes[1], 0)
23 connect_nodes(self.nodes[2], 0)
24 self.is_network_split = False
25 self.sync_all()
26
27 def run_test(self):
28 cnt = self.nodes[0].getblockcount()
29
30 # Mine some old-version blocks
31 self.nodes[1].generate(100)
32 self.sync_all()
33 if (self.nodes[0].getblockcount() != cnt + 100):
34 raise AssertionError("Failed to mine 100 version=2 blocks")
35
36 # Mine 750 new-version blocks
37 for i in xrange(15):
38 self.nodes[2].generate(50)
39 self.sync_all()
40 if (self.nodes[0].getblockcount() != cnt + 850):
41 raise AssertionError("Failed to mine 750 version=3 blocks")
42
43 # TODO: check that new DERSIG rules are not enforced
44
45 # Mine 1 new-version block
46 self.nodes[2].generate(1)
47 self.sync_all()
48 if (self.nodes[0].getblockcount() != cnt + 851):
49 raise AssertionFailure("Failed to mine a version=3 blocks")
50
51 # TODO: check that new DERSIG rules are enforced
52
53 # Mine 198 new-version blocks
54 for i in xrange(2):
55 self.nodes[2].generate(99)
56 self.sync_all()
57 if (self.nodes[0].getblockcount() != cnt + 1049):
58 raise AssertionError("Failed to mine 198 version=3 blocks")
59
60 # Mine 1 old-version block
61 self.nodes[1].generate(1)
62 self.sync_all()
63 if (self.nodes[0].getblockcount() != cnt + 1050):
64 raise AssertionError("Failed to mine a version=2 block after 949 version=3 blocks")
65
66 # Mine 1 new-version blocks
67 self.nodes[2].generate(1)
68 self.sync_all()
69 if (self.nodes[0].getblockcount() != cnt + 1051):
70 raise AssertionError("Failed to mine a version=3 block")
71
72 # Mine 1 old-version blocks
73 try:
74 self.nodes[1].generate(1)
75 raise AssertionError("Succeeded to mine a version=2 block after 950 version=3 blocks")
76 except JSONRPCException:
77 pass
78 self.sync_all()
79 if (self.nodes[0].getblockcount() != cnt + 1051):
80 raise AssertionError("Accepted a version=2 block after 950 version=3 blocks")
81
82 # Mine 1 new-version blocks
83 self.nodes[2].generate(1)
84 self.sync_all()
85 if (self.nodes[0].getblockcount() != cnt + 1052):
86 raise AssertionError("Failed to mine a version=3 block")
87
88if __name__ == '__main__':
89 BIP66Test().main()
This page took 0.02097 seconds and 4 git commands to generate.