mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-30 02:31:05 +02:00
scripted-diff: test: Remove brackets after assert
-BEGIN VERIFY SCRIPT- sed -i --regexp-extended -e 's/assert ?\((.+)\)(( )*)?(#.*)?$/assert \1\3\3\4/g' $(git grep -l --extended-regexp 'assert ?\(' test) -END VERIFY SCRIPT-
This commit is contained in:
@ -93,17 +93,17 @@ class SegWitTest(BitcoinTestFramework):
|
||||
self.log.info("Verify sigops are counted in GBT with pre-BIP141 rules before the fork")
|
||||
txid = self.nodes[0].sendtoaddress(self.nodes[0].getnewaddress(), 1)
|
||||
tmpl = self.nodes[0].getblocktemplate({'rules': ['segwit']})
|
||||
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 tmpl['sizelimit'] == 1000000
|
||||
assert 'weightlimit' not in tmpl
|
||||
assert tmpl['sigoplimit'] == 20000
|
||||
assert tmpl['transactions'][0]['hash'] == txid
|
||||
assert tmpl['transactions'][0]['sigops'] == 2
|
||||
tmpl = self.nodes[0].getblocktemplate({'rules': ['segwit']})
|
||||
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 tmpl['sizelimit'] == 1000000
|
||||
assert 'weightlimit' not in tmpl
|
||||
assert tmpl['sigoplimit'] == 20000
|
||||
assert tmpl['transactions'][0]['hash'] == txid
|
||||
assert tmpl['transactions'][0]['sigops'] == 2
|
||||
self.nodes[0].generate(1) # block 162
|
||||
|
||||
balance_presetup = self.nodes[0].getbalance()
|
||||
@ -172,16 +172,16 @@ class SegWitTest(BitcoinTestFramework):
|
||||
self.fail_accept(self.nodes[0], "mandatory-script-verify-flag", p2sh_ids[NODE_0][WIT_V1][0], False, witness_script(True, self.pubkey[0]))
|
||||
|
||||
self.log.info("Verify block and transaction serialization rpcs return differing serializations depending on rpc serialization flag")
|
||||
assert(self.nodes[2].getblock(blockhash, False) != self.nodes[0].getblock(blockhash, False))
|
||||
assert(self.nodes[1].getblock(blockhash, False) == self.nodes[2].getblock(blockhash, False))
|
||||
assert self.nodes[2].getblock(blockhash, False) != self.nodes[0].getblock(blockhash, False)
|
||||
assert self.nodes[1].getblock(blockhash, False) == self.nodes[2].getblock(blockhash, False)
|
||||
|
||||
for tx_id in segwit_tx_list:
|
||||
tx = FromHex(CTransaction(), self.nodes[2].gettransaction(tx_id)["hex"])
|
||||
assert(self.nodes[2].getrawtransaction(tx_id, False, blockhash) != self.nodes[0].getrawtransaction(tx_id, False, blockhash))
|
||||
assert(self.nodes[1].getrawtransaction(tx_id, False, blockhash) == self.nodes[2].getrawtransaction(tx_id, False, blockhash))
|
||||
assert(self.nodes[0].getrawtransaction(tx_id, False, blockhash) != self.nodes[2].gettransaction(tx_id)["hex"])
|
||||
assert(self.nodes[1].getrawtransaction(tx_id, False, blockhash) == self.nodes[2].gettransaction(tx_id)["hex"])
|
||||
assert(self.nodes[0].getrawtransaction(tx_id, False, blockhash) == tx.serialize_without_witness().hex())
|
||||
assert self.nodes[2].getrawtransaction(tx_id, False, blockhash) != self.nodes[0].getrawtransaction(tx_id, False, blockhash)
|
||||
assert self.nodes[1].getrawtransaction(tx_id, False, blockhash) == self.nodes[2].getrawtransaction(tx_id, False, blockhash)
|
||||
assert self.nodes[0].getrawtransaction(tx_id, False, blockhash) != self.nodes[2].gettransaction(tx_id)["hex"]
|
||||
assert self.nodes[1].getrawtransaction(tx_id, False, blockhash) == self.nodes[2].gettransaction(tx_id)["hex"]
|
||||
assert self.nodes[0].getrawtransaction(tx_id, False, blockhash) == tx.serialize_without_witness().hex()
|
||||
|
||||
self.log.info("Verify witness txs without witness data are invalid after the fork")
|
||||
self.fail_accept(self.nodes[2], 'non-mandatory-script-verify-flag (Witness program hash mismatch) (code 64)', wit_ids[NODE_2][WIT_V0][2], sign=False)
|
||||
@ -198,11 +198,11 @@ class SegWitTest(BitcoinTestFramework):
|
||||
self.log.info("Verify sigops are counted in GBT with BIP141 rules after the fork")
|
||||
txid = self.nodes[0].sendtoaddress(self.nodes[0].getnewaddress(), 1)
|
||||
tmpl = self.nodes[0].getblocktemplate({'rules': ['segwit']})
|
||||
assert(tmpl['sizelimit'] >= 3999577) # actual maximum size is lower due to minimum mandatory non-witness data
|
||||
assert(tmpl['weightlimit'] == 4000000)
|
||||
assert(tmpl['sigoplimit'] == 80000)
|
||||
assert(tmpl['transactions'][0]['txid'] == txid)
|
||||
assert(tmpl['transactions'][0]['sigops'] == 8)
|
||||
assert tmpl['sizelimit'] >= 3999577 # actual maximum size is lower due to minimum mandatory non-witness data
|
||||
assert tmpl['weightlimit'] == 4000000
|
||||
assert tmpl['sigoplimit'] == 80000
|
||||
assert tmpl['transactions'][0]['txid'] == txid
|
||||
assert tmpl['transactions'][0]['sigops'] == 8
|
||||
|
||||
self.nodes[0].generate(1) # Mine a block to clear the gbt cache
|
||||
|
||||
@ -214,8 +214,8 @@ class SegWitTest(BitcoinTestFramework):
|
||||
txid1 = send_to_witness(1, self.nodes[0], find_spendable_utxo(self.nodes[0], 50), self.pubkey[0], False, Decimal("49.996"))
|
||||
hex_tx = self.nodes[0].gettransaction(txid)['hex']
|
||||
tx = FromHex(CTransaction(), hex_tx)
|
||||
assert(tx.wit.is_null()) # This should not be a segwit input
|
||||
assert(txid1 in self.nodes[0].getrawmempool())
|
||||
assert tx.wit.is_null() # This should not be a segwit input
|
||||
assert txid1 in self.nodes[0].getrawmempool()
|
||||
|
||||
# Now create tx2, which will spend from txid1.
|
||||
tx = CTransaction()
|
||||
@ -224,7 +224,7 @@ class SegWitTest(BitcoinTestFramework):
|
||||
tx2_hex = self.nodes[0].signrawtransactionwithwallet(ToHex(tx))['hex']
|
||||
txid2 = self.nodes[0].sendrawtransaction(tx2_hex)
|
||||
tx = FromHex(CTransaction(), tx2_hex)
|
||||
assert(not tx.wit.is_null())
|
||||
assert not tx.wit.is_null()
|
||||
|
||||
# Now create tx3, which will spend from txid2
|
||||
tx = CTransaction()
|
||||
@ -232,15 +232,15 @@ class SegWitTest(BitcoinTestFramework):
|
||||
tx.vout.append(CTxOut(int(49.95 * COIN), CScript([OP_TRUE, OP_DROP] * 15 + [OP_TRUE]))) # Huge fee
|
||||
tx.calc_sha256()
|
||||
txid3 = self.nodes[0].sendrawtransaction(ToHex(tx))
|
||||
assert(tx.wit.is_null())
|
||||
assert(txid3 in self.nodes[0].getrawmempool())
|
||||
assert tx.wit.is_null()
|
||||
assert txid3 in self.nodes[0].getrawmempool()
|
||||
|
||||
# Check that getblocktemplate includes all transactions.
|
||||
template = self.nodes[0].getblocktemplate({"rules": ["segwit"]})
|
||||
template_txids = [t['txid'] for t in template['transactions']]
|
||||
assert(txid1 in template_txids)
|
||||
assert(txid2 in template_txids)
|
||||
assert(txid3 in template_txids)
|
||||
assert txid1 in template_txids
|
||||
assert txid2 in template_txids
|
||||
assert txid3 in template_txids
|
||||
|
||||
# Check that wtxid is properly reported in mempool entry
|
||||
assert_equal(int(self.nodes[0].getmempoolentry(txid3)["wtxid"], 16), tx.calc_sha256(True))
|
||||
|
Reference in New Issue
Block a user