From 44d25fdf26d7266afd13a04b95b2390cc9b83a50 Mon Sep 17 00:00:00 2001 From: Adrian Gallagher Date: Wed, 8 May 2019 23:47:12 -0700 Subject: [PATCH] Litecoin: Fix more functional tests --- test/functional/combine_logs.py | 2 +- test/functional/example_test.py | 2 +- test/functional/feature_assumevalid.py | 8 ++++---- test/functional/feature_bip68_sequence.py | 2 ++ test/functional/feature_block.py | 5 +++-- test/functional/p2p_segwit.py | 2 +- test/functional/test_framework/test_node.py | 2 +- test/functional/wallet_resendwallettransactions.py | 1 + 8 files changed, 14 insertions(+), 10 deletions(-) diff --git a/test/functional/combine_logs.py b/test/functional/combine_logs.py index 00f2833f55..a7bc9c63c1 100755 --- a/test/functional/combine_logs.py +++ b/test/functional/combine_logs.py @@ -23,7 +23,7 @@ import tempfile # without the parent module installed. # Should match same symbol in `test_framework.test_framework`. -TMPDIR_PREFIX = "bitcoin_func_test_" +TMPDIR_PREFIX = "litecoin_func_test_" # Matches on the date format at the start of the log event TIMESTAMP_PATTERN = re.compile(r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{6})?Z") diff --git a/test/functional/example_test.py b/test/functional/example_test.py index c28bb7115f..9d2bb8907a 100755 --- a/test/functional/example_test.py +++ b/test/functional/example_test.py @@ -168,7 +168,7 @@ class ExampleTest(BitcoinTestFramework): # Use the blocktools functionality to manually build a block. # Calling the generate() rpc is easier, but this allows us to exactly # control the blocks and transactions. - block = create_block(self.tip, create_coinbase(height+1), self.block_time) + block = create_block(self.tip, create_coinbase(height+1), self.block_time, version=0x20000000) block.solve() block_message = msg_block(block) # Send message is used to send a P2P message to the node over our P2PInterface diff --git a/test/functional/feature_assumevalid.py b/test/functional/feature_assumevalid.py index 603d7f5d3b..f4e43daac9 100755 --- a/test/functional/feature_assumevalid.py +++ b/test/functional/feature_assumevalid.py @@ -113,7 +113,7 @@ class AssumeValidTest(BitcoinTestFramework): # Create the first block with a coinbase output to our key height = 1 - block = create_block(self.tip, create_coinbase(height, coinbase_pubkey), self.block_time) + block = create_block(self.tip, create_coinbase(height, coinbase_pubkey), self.block_time, version=0x20000000) self.blocks.append(block) self.block_time += 1 block.solve() @@ -124,7 +124,7 @@ class AssumeValidTest(BitcoinTestFramework): # Bury the block 100 deep so the coinbase output is spendable for _ in range(100): - block = create_block(self.tip, create_coinbase(height), self.block_time) + block = create_block(self.tip, create_coinbase(height), self.block_time, version=0x20000000) block.solve() self.blocks.append(block) self.tip = block.sha256 @@ -137,7 +137,7 @@ class AssumeValidTest(BitcoinTestFramework): tx.vout.append(CTxOut(49 * 100000000, CScript([OP_TRUE]))) tx.calc_sha256() - block102 = create_block(self.tip, create_coinbase(height), self.block_time) + block102 = create_block(self.tip, create_coinbase(height), self.block_time, version=0x20000000) self.block_time += 1 block102.vtx.extend([tx]) block102.hashMerkleRoot = block102.calc_merkle_root() @@ -151,7 +151,7 @@ class AssumeValidTest(BitcoinTestFramework): # Bury the assumed valid block 2100 deep for _ in range(2100): block = create_block(self.tip, create_coinbase(height), self.block_time) - block.nVersion = 4 + block.nVersion = 0x20000002 block.solve() self.blocks.append(block) self.tip = block.sha256 diff --git a/test/functional/feature_bip68_sequence.py b/test/functional/feature_bip68_sequence.py index 60492350ee..601aa05808 100755 --- a/test/functional/feature_bip68_sequence.py +++ b/test/functional/feature_bip68_sequence.py @@ -322,6 +322,7 @@ class BIP68Test(BitcoinTestFramework): # tx3 to be removed. for i in range(2): block = create_block(tmpl=tmpl, ntime=cur_time) + block.nVersion = 0x20000000 block.rehash() block.solve() tip = block.sha256 @@ -377,6 +378,7 @@ class BIP68Test(BitcoinTestFramework): # make a block that violates bip68; ensure that the tip updates block = create_block(tmpl=self.nodes[0].getblocktemplate(NORMAL_GBT_REQUEST_PARAMS)) + block.nVersion = 0x20000000 block.vtx.extend([tx1, tx2, tx3]) block.hashMerkleRoot = block.calc_merkle_root() block.rehash() diff --git a/test/functional/feature_block.py b/test/functional/feature_block.py index ed4066b224..4835c83a6d 100755 --- a/test/functional/feature_block.py +++ b/test/functional/feature_block.py @@ -1335,12 +1335,13 @@ class FullBlockTest(BitcoinTestFramework): coinbase = create_coinbase(height, self.coinbase_pubkey) coinbase.vout[0].nValue += additional_coinbase_value coinbase.rehash() + blockversion = 0x20000000 if spend is None: - block = create_block(base_block_hash, coinbase, block_time, version=version) + block = create_block(base_block_hash, coinbase, block_time, version=blockversion) else: coinbase.vout[0].nValue += spend.vout[0].nValue - 1 # all but one satoshi to fees coinbase.rehash() - block = create_block(base_block_hash, coinbase, block_time, version=version) + block = create_block(base_block_hash, coinbase, block_time, version=blockversion) tx = self.create_tx(spend, 0, 1, script) # spend 1 satoshi self.sign_tx(tx, spend) self.add_transactions_to_block(block, [tx]) diff --git a/test/functional/p2p_segwit.py b/test/functional/p2p_segwit.py index 11f191287b..4825c0f285 100755 --- a/test/functional/p2p_segwit.py +++ b/test/functional/p2p_segwit.py @@ -2098,7 +2098,7 @@ class SegWitTest(BitcoinTestFramework): self.nodes[0].sendtoaddress(self.nodes[0].getnewaddress(address_type='bech32'), 5) self.nodes[0].generate(1) - unspent = next(u for u in self.nodes[0].listunspent() if u['spendable'] and u['address'].startswith('bcrt')) + unspent = next(u for u in self.nodes[0].listunspent() if u['spendable'] and u['address'].startswith('rltc')) raw = self.nodes[0].createrawtransaction([{"txid": unspent['txid'], "vout": unspent['vout']}], {self.nodes[0].getnewaddress(): 1}) tx = FromHex(CTransaction(), raw) diff --git a/test/functional/test_framework/test_node.py b/test/functional/test_framework/test_node.py index 9372689174..381d8aaabe 100755 --- a/test/functional/test_framework/test_node.py +++ b/test/functional/test_framework/test_node.py @@ -432,7 +432,7 @@ class TestNode(): if not test_success('readelf -S {} | grep .debug_str'.format(shlex.quote(self.binary))): self.log.warning( - "perf output won't be very useful without debug symbols compiled into bitcoind") + "perf output won't be very useful without debug symbols compiled into litecoind") output_path = tempfile.NamedTemporaryFile( dir=self.datadir, diff --git a/test/functional/wallet_resendwallettransactions.py b/test/functional/wallet_resendwallettransactions.py index 353deefcc1..2eb99ed08e 100755 --- a/test/functional/wallet_resendwallettransactions.py +++ b/test/functional/wallet_resendwallettransactions.py @@ -46,6 +46,7 @@ class ResendWalletTransactionsTest(BitcoinTestFramework): block_time = int(time.time()) + 6 * 60 node.setmocktime(block_time) block = create_block(int(node.getbestblockhash(), 16), create_coinbase(node.getblockcount() + 1), block_time) + block.nVersion = 0x20000000 block.rehash() block.solve() node.submitblock(ToHex(block))