aboutsummaryrefslogtreecommitdiff
path: root/qa
diff options
context:
space:
mode:
authorSuhas Daftuar <sdaftuar@gmail.com>2017-03-08 15:56:59 -0500
committerSuhas Daftuar <sdaftuar@gmail.com>2017-03-16 10:43:54 -0400
commit569596cc5148ef868350a9720013d38faf3e34ce (patch)
tree907377b3adb5cb56ae99a44c0ac425167a970bc4 /qa
parent43a987c1cbcd04b9c59052606c3c31c56abc826e (diff)
downloadbitcoin-569596cc5148ef868350a9720013d38faf3e34ce.tar.xz
Don't require segwit in getblocktemplate for segwit signalling or mining
Segwit's version bit will be signalled for all invocations of CreateNewBlock, and not specifying segwit only will cause CreateNewBlock to skip transactions with witness from being selected. Github-Pull: #9955 Rebased-From: abe7b3d3abe10e3554b770f40824174b3b217490
Diffstat (limited to 'qa')
-rwxr-xr-xqa/rpc-tests/p2p-segwit.py8
-rwxr-xr-xqa/rpc-tests/segwit.py19
2 files changed, 10 insertions, 17 deletions
diff --git a/qa/rpc-tests/p2p-segwit.py b/qa/rpc-tests/p2p-segwit.py
index 2f339bb54f..479f1c6796 100755
--- a/qa/rpc-tests/p2p-segwit.py
+++ b/qa/rpc-tests/p2p-segwit.py
@@ -1701,9 +1701,11 @@ class SegWitTest(BitcoinTestFramework):
for node in [self.nodes[0], self.nodes[2]]:
gbt_results = node.getblocktemplate()
block_version = gbt_results['version']
- # If we're not indicating segwit support, we should not be signalling
- # for segwit activation, nor should we get a witness commitment.
- assert_equal(block_version & (1 << VB_WITNESS_BIT), 0)
+ # If we're not indicating segwit support, we will still be
+ # signalling for segwit activation.
+ assert_equal((block_version & (1 << VB_WITNESS_BIT) != 0), node == self.nodes[0])
+ # If we don't specify the segwit rule, then we won't get a default
+ # commitment.
assert('default_witness_commitment' not in gbt_results)
# Workaround:
diff --git a/qa/rpc-tests/segwit.py b/qa/rpc-tests/segwit.py
index d6831e00e3..5dfc7a2f06 100755
--- a/qa/rpc-tests/segwit.py
+++ b/qa/rpc-tests/segwit.py
@@ -251,20 +251,11 @@ class SegWitTest(BitcoinTestFramework):
assert(tmpl['transactions'][0]['txid'] == txid)
assert(tmpl['transactions'][0]['sigops'] == 8)
- print("Verify non-segwit miners get a valid GBT response after the fork")
- send_to_witness(1, self.nodes[0], find_unspent(self.nodes[0], 50), self.pubkey[0], False, Decimal("49.998"))
- try:
- tmpl = self.nodes[0].getblocktemplate({})
- assert(len(tmpl['transactions']) == 1) # Doesn't include witness tx
- assert(tmpl['sizelimit'] == 1000000)
- assert('weightlimit' not in tmpl)
- assert(tmpl['sigoplimit'] == 20000)
- assert(tmpl['transactions'][0]['hash'] == txid)
- assert(tmpl['transactions'][0]['sigops'] == 2)
- assert(('!segwit' in tmpl['rules']) or ('segwit' not in tmpl['rules']))
- except JSONRPCException:
- # This is an acceptable outcome
- pass
+ print("Non-segwit miners are able to use GBT response after activation.")
+ txid = send_to_witness(1, self.nodes[0], find_unspent(self.nodes[0], 50), self.pubkey[0], False, Decimal("49.998"))
+ tmpl = self.nodes[0].getblocktemplate()
+ # TODO: add a transaction with witness to mempool, and verify it's not
+ # selected for mining.
print("Verify behaviour of importaddress, addwitnessaddress and listunspent")