aboutsummaryrefslogtreecommitdiff
path: root/qa
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2016-09-01 16:25:31 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2016-09-01 16:25:34 +0200
commitec0afbd52b787ac0c8d49ad1b6c9dfa98d725b03 (patch)
tree132d34784012f0be5fb32ae148f8367a124f028b /qa
parent15502d7b2543cb43688abde7e6019b7c2b9c3411 (diff)
parentdb4bacf59092ae4aa923a58f379c36757edad932 (diff)
downloadbitcoin-ec0afbd52b787ac0c8d49ad1b6c9dfa98d725b03.tar.xz
Merge #8176: [0.12.x]: Versionbits: GBT support
db4bacf getblocktemplate: Use version/force mutation to support pre-BIP9 clients (Luke Dashjr) 65ee332 getblocktemplate: Explicitly handle the distinction between GBT-affecting softforks vs not (Luke Dashjr) 40e81f5 qa/rpc-tests: bip9-softforks: Add tests for getblocktemplate versionbits updates (Luke Dashjr) ddd8c01 Implement BIP 9 GBT changes (Luke Dashjr)
Diffstat (limited to 'qa')
-rwxr-xr-xqa/rpc-tests/bip9-softforks.py32
1 files changed, 28 insertions, 4 deletions
diff --git a/qa/rpc-tests/bip9-softforks.py b/qa/rpc-tests/bip9-softforks.py
index 1cf0b136e1..951fff6216 100755
--- a/qa/rpc-tests/bip9-softforks.py
+++ b/qa/rpc-tests/bip9-softforks.py
@@ -82,7 +82,7 @@ class BIP9SoftForksTest(ComparisonTestFramework):
raise IndexError ('key:"%s" not found' % key)
- def test_BIP(self, bipName, activated_version, invalidate, invalidatePostSignature):
+ def test_BIP(self, bipName, activated_version, invalidate, invalidatePostSignature, bitno):
# generate some coins for later
self.coinbase_blocks = self.nodes[0].generate(2)
self.height = 3 # height of the next block to build
@@ -91,6 +91,11 @@ class BIP9SoftForksTest(ComparisonTestFramework):
self.last_block_time = int(time.time())
assert_equal(self.get_bip9_status(bipName)['status'], 'defined')
+ tmpl = self.nodes[0].getblocktemplate({})
+ assert(bipName not in tmpl['rules'])
+ assert(bipName not in tmpl['vbavailable'])
+ assert_equal(tmpl['vbrequired'], 0)
+ assert_equal(tmpl['version'], 0x20000000)
# Test 1
# Advance from DEFINED to STARTED
@@ -98,6 +103,11 @@ class BIP9SoftForksTest(ComparisonTestFramework):
yield TestInstance(test_blocks, sync_every_block=False)
assert_equal(self.get_bip9_status(bipName)['status'], 'started')
+ tmpl = self.nodes[0].getblocktemplate({})
+ assert(bipName not in tmpl['rules'])
+ assert_equal(tmpl['vbavailable'][bipName], bitno)
+ assert_equal(tmpl['vbrequired'], 0)
+ assert(tmpl['version'] & activated_version)
# Test 2
# Fail to achieve LOCKED_IN 100 out of 144 signal bit 1
@@ -109,6 +119,11 @@ class BIP9SoftForksTest(ComparisonTestFramework):
yield TestInstance(test_blocks, sync_every_block=False)
assert_equal(self.get_bip9_status(bipName)['status'], 'started')
+ tmpl = self.nodes[0].getblocktemplate({})
+ assert(bipName not in tmpl['rules'])
+ assert_equal(tmpl['vbavailable'][bipName], bitno)
+ assert_equal(tmpl['vbrequired'], 0)
+ assert(tmpl['version'] & activated_version)
# Test 3
# 108 out of 144 signal bit 1 to achieve LOCKED_IN
@@ -120,6 +135,8 @@ class BIP9SoftForksTest(ComparisonTestFramework):
yield TestInstance(test_blocks, sync_every_block=False)
assert_equal(self.get_bip9_status(bipName)['status'], 'locked_in')
+ tmpl = self.nodes[0].getblocktemplate({})
+ assert(bipName not in tmpl['rules'])
# Test 4
# 143 more version 536870913 blocks (waiting period-1)
@@ -127,6 +144,8 @@ class BIP9SoftForksTest(ComparisonTestFramework):
yield TestInstance(test_blocks, sync_every_block=False)
assert_equal(self.get_bip9_status(bipName)['status'], 'locked_in')
+ tmpl = self.nodes[0].getblocktemplate({})
+ assert(bipName not in tmpl['rules'])
# Test 5
# Check that the new rule is enforced
@@ -150,6 +169,11 @@ class BIP9SoftForksTest(ComparisonTestFramework):
yield TestInstance([[block, True]])
assert_equal(self.get_bip9_status(bipName)['status'], 'active')
+ tmpl = self.nodes[0].getblocktemplate({})
+ assert(bipName in tmpl['rules'])
+ assert(bipName not in tmpl['vbavailable'])
+ assert_equal(tmpl['vbrequired'], 0)
+ assert(not (tmpl['version'] & (1 << bitno)))
# Test 6
# Check that the new sequence lock rules are enforced
@@ -183,9 +207,9 @@ class BIP9SoftForksTest(ComparisonTestFramework):
def get_tests(self):
for test in itertools.chain(
- self.test_BIP('csv', 536870913, self.sequence_lock_invalidate, self.donothing),
- self.test_BIP('csv', 536870913, self.mtp_invalidate, self.donothing),
- self.test_BIP('csv', 536870913, self.donothing, self.csv_invalidate)
+ self.test_BIP('csv', 0x20000001, self.sequence_lock_invalidate, self.donothing, 0),
+ self.test_BIP('csv', 0x20000001, self.mtp_invalidate, self.donothing, 0),
+ self.test_BIP('csv', 0x20000001, self.donothing, self.csv_invalidate, 0)
):
yield test