Litecoin: Fix more functional tests

pull/751/head
Adrian Gallagher 6 years ago
parent dcf565982a
commit 44d25fdf26
No known key found for this signature in database
GPG Key ID: FE3348877809386C

@ -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")

@ -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

@ -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

@ -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()

@ -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])

@ -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)

@ -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,

@ -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))

Loading…
Cancel
Save