Changeset View
Changeset View
Standalone View
Standalone View
test/functional/feature_nulldummy.py
Show All 16 Lines | |||||
from test_framework.blocktools import create_block, create_coinbase | from test_framework.blocktools import create_block, create_coinbase | ||||
from test_framework.messages import CTransaction, FromHex, ToHex | from test_framework.messages import CTransaction, FromHex, ToHex | ||||
from test_framework.mininode import network_thread_start | from test_framework.mininode import network_thread_start | ||||
from test_framework.script import CScript | from test_framework.script import CScript | ||||
from test_framework.test_framework import BitcoinTestFramework | from test_framework.test_framework import BitcoinTestFramework | ||||
from test_framework.util import assert_equal, assert_raises_rpc_error | from test_framework.util import assert_equal, assert_raises_rpc_error | ||||
# This test checks for a reject reason that changes after the graviton | |||||
# upgrade. Since the nulldummy effect and this test are destined to be removed | |||||
# after the upgrade anyway, we run this test pre-upgrade only. | |||||
# More detailed dummy tests can be found in abc-schnorrmultisig-activation.py. | |||||
GRAVITON_START_TIME = 2000000000 | |||||
NULLDUMMY_ERROR = "non-mandatory-script-verify-flag (Dummy CHECKMULTISIG argument must be zero) (code 64)" | NULLDUMMY_ERROR = "non-mandatory-script-verify-flag (Dummy CHECKMULTISIG argument must be zero) (code 64)" | ||||
def trueDummy(tx): | def trueDummy(tx): | ||||
scriptSig = CScript(tx.vin[0].scriptSig) | scriptSig = CScript(tx.vin[0].scriptSig) | ||||
newscript = [] | newscript = [] | ||||
for i in scriptSig: | for i in scriptSig: | ||||
if (len(newscript) == 0): | if (len(newscript) == 0): | ||||
assert(len(i) == 0) | assert(len(i) == 0) | ||||
newscript.append(b'\x51') | newscript.append(b'\x51') | ||||
else: | else: | ||||
newscript.append(i) | newscript.append(i) | ||||
tx.vin[0].scriptSig = CScript(newscript) | tx.vin[0].scriptSig = CScript(newscript) | ||||
tx.rehash() | tx.rehash() | ||||
class NULLDUMMYTest(BitcoinTestFramework): | class NULLDUMMYTest(BitcoinTestFramework): | ||||
def set_test_params(self): | def set_test_params(self): | ||||
self.num_nodes = 1 | self.num_nodes = 1 | ||||
self.setup_clean_chain = True | self.setup_clean_chain = True | ||||
self.extra_args = [['-whitelist=127.0.0.1']] | self.extra_args = [['-whitelist=127.0.0.1', | ||||
"-gravitonactivationtime={}".format(GRAVITON_START_TIME)]] | |||||
def run_test(self): | def run_test(self): | ||||
self.address = self.nodes[0].getnewaddress() | self.address = self.nodes[0].getnewaddress() | ||||
self.ms_address = self.nodes[0].addmultisigaddress(1, [self.address])[ | self.ms_address = self.nodes[0].addmultisigaddress(1, [self.address])[ | ||||
'address'] | 'address'] | ||||
network_thread_start() | network_thread_start() | ||||
# Block 2 | # Block 2 | ||||
▲ Show 20 Lines • Show All 65 Lines • Show Last 20 Lines |