diff --git a/qa/rpc-tests/abandonconflict.py b/qa/rpc-tests/abandonconflict.py --- a/qa/rpc-tests/abandonconflict.py +++ b/qa/rpc-tests/abandonconflict.py @@ -8,8 +8,8 @@ from test_framework.util import * import urllib.parse -# far in the future -UAHF_START_TIME = 2000000000 +# far in the past +UAHF_START_TIME = 30000000 class AbandonConflictTest(BitcoinTestFramework): @@ -47,8 +47,8 @@ sync_blocks(self.nodes) newbalance = self.nodes[0].getbalance() + # no more than fees lost assert(balance - newbalance < Decimal("0.001")) - # no more than fees lost balance = newbalance url = urllib.parse.urlparse(self.nodes[1].url) @@ -71,7 +71,7 @@ outputs[self.nodes[0].getnewaddress()] = Decimal("14.99998") outputs[self.nodes[1].getnewaddress()] = Decimal("5") signed = self.nodes[0].signrawtransaction( - self.nodes[0].createrawtransaction(inputs, outputs), None, None, "ALL") + self.nodes[0].createrawtransaction(inputs, outputs), None, None, "ALL|FORKID") txAB1 = self.nodes[0].sendrawtransaction(signed["hex"]) # Identify the 14.99998btc output @@ -85,7 +85,7 @@ outputs = {} outputs[self.nodes[0].getnewaddress()] = Decimal("24.9996") signed2 = self.nodes[0].signrawtransaction( - self.nodes[0].createrawtransaction(inputs, outputs), None, None, "ALL") + self.nodes[0].createrawtransaction(inputs, outputs), None, None, "ALL|FORKID") txABC2 = self.nodes[0].sendrawtransaction(signed2["hex"]) # In mempool txs from self should increase balance from change @@ -169,7 +169,7 @@ outputs = {} outputs[self.nodes[1].getnewaddress()] = Decimal("9.9999") tx = self.nodes[0].createrawtransaction(inputs, outputs) - signed = self.nodes[0].signrawtransaction(tx, None, None, "ALL") + signed = self.nodes[0].signrawtransaction(tx, None, None, "ALL|FORKID") self.nodes[1].sendrawtransaction(signed["hex"]) self.nodes[1].generate(1) diff --git a/qa/rpc-tests/abc-p2p-fullblocktest.py b/qa/rpc-tests/abc-p2p-fullblocktest.py --- a/qa/rpc-tests/abc-p2p-fullblocktest.py +++ b/qa/rpc-tests/abc-p2p-fullblocktest.py @@ -21,8 +21,8 @@ from test_framework.cdefs import (ONE_MEGABYTE, LEGACY_MAX_BLOCK_SIZE, MAX_BLOCK_SIGOPS_PER_MB, MAX_TX_SIGOPS_COUNT) -# far into the future -UAHF_START_TIME = 2000000000 +# far into the past +UAHF_START_TIME = 30000000 class PreviousSpendableOutput(object): @@ -108,7 +108,6 @@ NetworkThread().start() # Set the blocksize to 2MB as initial condition self.nodes[0].setexcessiveblock(self.excessive_block_size) - self.nodes[0].setmocktime(UAHF_START_TIME) self.test.run() def add_transactions_to_block(self, block, tx_list): @@ -163,8 +162,9 @@ spendable_output = None if (spend != None): tx = CTransaction() + # no signature yet tx.vin.append( - CTxIn(COutPoint(spend.tx.sha256, spend.n), b"", 0xffffffff)) # no signature yet + CTxIn(COutPoint(spend.tx.sha256, spend.n), b"", 0xffffffff)) # We put some random data into the first transaction of the chain # to randomize ids tx.vout.append( @@ -282,27 +282,6 @@ save_spendable_output() yield test - # In order to trigger the HF, we need one block past activation time - bfork = block(5555) - bfork.nTime = UAHF_START_TIME - update_block(5555, []) - save_spendable_output() - yield accepted() - - # Then we pile 5 blocks to move MTP forward and trigger the HF - for i in range(5): - block(5100 + i) - test.blocks_and_transactions.append([self.tip, True]) - save_spendable_output() - yield test - - # Create a new block and activate the fork, the block needs - # to be > 1MB . For more specific tests about the fork activation, - # check abc-p2p-activation.py - block(5556, spend=get_spendable_output(), - block_size=LEGACY_MAX_BLOCK_SIZE + 1) - yield accepted() - # collect spendable outputs now to avoid cluttering the code later on out = [] for i in range(100): diff --git a/qa/rpc-tests/fundrawtransaction.py b/qa/rpc-tests/fundrawtransaction.py --- a/qa/rpc-tests/fundrawtransaction.py +++ b/qa/rpc-tests/fundrawtransaction.py @@ -6,8 +6,8 @@ from test_framework.test_framework import BitcoinTestFramework from test_framework.util import * -# far into the future -UAHF_START_TIME = 2000000000 +# far into the past +UAHF_START_TIME = 30000000 def get_unspent(listunspent, amount): @@ -473,7 +473,7 @@ fundedTx = self.nodes[2].fundrawtransaction(rawTx) signedTx = self.nodes[2].signrawtransaction( - fundedTx['hex'], None, None, "ALL") + fundedTx['hex'], None, None, "ALL|FORKID") txId = self.nodes[2].sendrawtransaction(signedTx['hex']) self.sync_all() self.nodes[1].generate(1) @@ -539,7 +539,7 @@ # now we need to unlock self.nodes[1].walletpassphrase("test", 600) signedTx = self.nodes[1].signrawtransaction( - fundedTx['hex'], None, None, "ALL") + fundedTx['hex'], None, None, "ALL|FORKID") txId = self.nodes[1].sendrawtransaction(signedTx['hex']) self.nodes[1].generate(1) self.sync_all() @@ -604,7 +604,7 @@ rawTx = self.nodes[1].createrawtransaction(inputs, outputs) fundedTx = self.nodes[1].fundrawtransaction(rawTx) fundedAndSignedTx = self.nodes[1].signrawtransaction( - fundedTx['hex'], None, None, "ALL") + fundedTx['hex'], None, None, "ALL|FORKID") txId = self.nodes[1].sendrawtransaction(fundedAndSignedTx['hex']) self.sync_all() self.nodes[0].generate(1) @@ -666,10 +666,10 @@ result["changepos"]]["value"], watchonly_amount / 10) signedtx = self.nodes[3].signrawtransaction( - result["hex"], None, None, "ALL") + result["hex"], None, None, "ALL|FORKID") assert(not signedtx["complete"]) signedtx = self.nodes[0].signrawtransaction( - signedtx["hex"], None, None, "ALL") + signedtx["hex"], None, None, "ALL|FORKID") assert(signedtx["complete"]) self.nodes[0].sendrawtransaction(signedtx["hex"]) self.nodes[0].generate(1) diff --git a/qa/rpc-tests/mempool_limit.py b/qa/rpc-tests/mempool_limit.py --- a/qa/rpc-tests/mempool_limit.py +++ b/qa/rpc-tests/mempool_limit.py @@ -55,7 +55,7 @@ for i in range(3): txids.append([]) txids[i] = create_lots_of_big_transactions( - self.nodes[0], self.txouts, utxos[30 * i:30 * i + 30], 30, (i + 1) * base_fee, "NONE|FORKID") + self.nodes[0], self.txouts, utxos[30 * i:30 * i + 30], 30, (i + 1) * base_fee) # by now, the tx should be evicted, check confirmation state assert(txid not in self.nodes[0].getrawmempool()) diff --git a/qa/rpc-tests/mempool_packages.py b/qa/rpc-tests/mempool_packages.py --- a/qa/rpc-tests/mempool_packages.py +++ b/qa/rpc-tests/mempool_packages.py @@ -9,8 +9,8 @@ from test_framework.util import * from test_framework.mininode import COIN -# far in the future -UAHF_START_TIME = 2000000000 +# far in the past +UAHF_START_TIME = 30000000 MAX_ANCESTORS = 25 MAX_DESCENDANTS = 25 @@ -46,11 +46,11 @@ for i in range(num_outputs): outputs[node.getnewaddress()] = send_value rawtx = node.createrawtransaction(inputs, outputs) - signedtx = node.signrawtransaction(rawtx, None, None, "ALL") + signedtx = node.signrawtransaction(rawtx, None, None, "ALL|FORKID") txid = node.sendrawtransaction(signedtx['hex']) fulltx = node.getrawtransaction(txid, 1) + # make sure we didn't generate a change output assert(len(fulltx['vout']) == num_outputs) - # make sure we didn't generate a change output return (txid, send_value) def run_test(self): @@ -245,7 +245,8 @@ for i in range(2): outputs[self.nodes[0].getnewaddress()] = send_value rawtx = self.nodes[0].createrawtransaction(inputs, outputs) - signedtx = self.nodes[0].signrawtransaction(rawtx, None, None, "ALL") + signedtx = self.nodes[0].signrawtransaction( + rawtx, None, None, "ALL|FORKID") txid = self.nodes[0].sendrawtransaction(signedtx['hex']) tx0_id = txid value = send_value @@ -271,7 +272,8 @@ inputs = [{'txid': tx1_id, 'vout': 0}, {'txid': txid, 'vout': 0}] outputs = {self.nodes[0].getnewaddress(): send_value + value - 4 * fee} rawtx = self.nodes[0].createrawtransaction(inputs, outputs) - signedtx = self.nodes[0].signrawtransaction(rawtx, None, None, "ALL") + signedtx = self.nodes[0].signrawtransaction( + rawtx, None, None, "ALL|FORKID") txid = self.nodes[0].sendrawtransaction(signedtx['hex']) sync_mempools(self.nodes) diff --git a/qa/rpc-tests/nulldummy.py b/qa/rpc-tests/nulldummy.py --- a/qa/rpc-tests/nulldummy.py +++ b/qa/rpc-tests/nulldummy.py @@ -11,8 +11,8 @@ from io import BytesIO import time -# far into the future -UAHF_START_TIME = 2000000000 +# far into the past +UAHF_START_TIME = 30000000 NULLDUMMY_ERROR = "64: non-mandatory-script-verify-flag (Dummy CHECKMULTISIG argument must be zero)" @@ -95,7 +95,7 @@ inputs = [{"txid": txid, "vout": 0}] outputs = {to_address: amount} rawtx = node.createrawtransaction(inputs, outputs) - signresult = node.signrawtransaction(rawtx, None, None, "ALL") + signresult = node.signrawtransaction(rawtx, None, None, "ALL|FORKID") tx = CTransaction() f = BytesIO(hex_str_to_bytes(signresult['hex'])) tx.deserialize(f) diff --git a/qa/rpc-tests/prioritise_transaction.py b/qa/rpc-tests/prioritise_transaction.py --- a/qa/rpc-tests/prioritise_transaction.py +++ b/qa/rpc-tests/prioritise_transaction.py @@ -51,7 +51,7 @@ start_range = i * range_size end_range = start_range + range_size txids[i] = create_lots_of_big_transactions(self.nodes[0], self.txouts, utxos[ - start_range:end_range], end_range - start_range, (i + 1) * base_fee, "NONE|FORKID") + start_range:end_range], end_range - start_range, (i + 1) * base_fee) # Make sure that the size of each group of transactions exceeds # LEGACY_MAX_BLOCK_SIZE -- otherwise the test needs to be revised to create diff --git a/qa/rpc-tests/pruning.py b/qa/rpc-tests/pruning.py --- a/qa/rpc-tests/pruning.py +++ b/qa/rpc-tests/pruning.py @@ -17,8 +17,8 @@ import time import os -# far in the future -UAHF_START_TIME = 2000000000 +# far in the past +UAHF_START_TIME = 30000000 MIN_BLOCKS_TO_KEEP = 288 diff --git a/qa/rpc-tests/rawtransactions.py b/qa/rpc-tests/rawtransactions.py --- a/qa/rpc-tests/rawtransactions.py +++ b/qa/rpc-tests/rawtransactions.py @@ -15,8 +15,8 @@ from test_framework.test_framework import BitcoinTestFramework from test_framework.util import * -# far in the future -UAHF_START_TIME = 2000000000 +# far in the past +UAHF_START_TIME = 30000000 # Create one-input, one-output, no-fee transaction: @@ -30,7 +30,8 @@ def setup_network(self, split=False): self.nodes = start_nodes(self.num_nodes, self.options.tmpdir, - [["-uahfstarttime=%d" % UAHF_START_TIME]for i in range(self.num_nodes)]) + [["-uahfstarttime=%d" % UAHF_START_TIME] + for i in range(self.num_nodes)]) # connect to a local machine for debugging # url = "http://bitcoinrpc:DP6DvqZtqXarpeNWyN3LZTFchCCyCUuHwNF7E8pX99x1@%s:%d" % ('127.0.0.1', 18332) @@ -67,7 +68,8 @@ # won't exists outputs = {self.nodes[0].getnewaddress(): 4.998} rawtx = self.nodes[2].createrawtransaction(inputs, outputs) - rawtx = self.nodes[2].signrawtransaction(rawtx, None, None, "ALL") + rawtx = self.nodes[2].signrawtransaction( + rawtx, None, None, "ALL|FORKID") try: rawtx = self.nodes[2].sendrawtransaction(rawtx['hex']) @@ -127,9 +129,9 @@ # THIS IS A INCOMPLETE FEATURE # NODE2 HAS TWO OF THREE KEY AND THE FUNDS SHOULD BE SPENDABLE AND # COUNT AT BALANCE CALCULATION + # for now, assume the funds of a 2of3 multisig tx are not marked as + # spendable assert_equal(self.nodes[2].getbalance(), bal) - # for now, assume the funds of a 2of3 multisig tx are not - # marked as spendable txDetails = self.nodes[0].gettransaction(txId, True) rawTx = self.nodes[0].decoderawtransaction(txDetails['hex']) @@ -140,17 +142,21 @@ break bal = self.nodes[0].getbalance() - inputs = [ - {"txid": txId, "vout": vout['n'], "scriptPubKey": vout['scriptPubKey']['hex']}] + inputs = [{ + "txid": txId, + "vout": vout['n'], + "scriptPubKey": vout['scriptPubKey']['hex'], + "amount": vout['value'], + }] outputs = {self.nodes[0].getnewaddress(): 2.19} rawTx = self.nodes[2].createrawtransaction(inputs, outputs) rawTxPartialSigned = self.nodes[ - 1].signrawtransaction(rawTx, inputs, None, "ALL") + 1].signrawtransaction(rawTx, inputs, None, "ALL|FORKID") # node1 only has one key, can't comp. sign the tx assert_equal(rawTxPartialSigned['complete'], False) rawTxSigned = self.nodes[2].signrawtransaction( - rawTx, inputs, None, "ALL") + rawTx, inputs, None, "ALL|FORKID") # node2 can sign the tx compl., own two of three keys assert_equal(rawTxSigned['complete'], True) self.nodes[2].sendrawtransaction(rawTxSigned['hex']) diff --git a/qa/rpc-tests/test_framework/util.py b/qa/rpc-tests/test_framework/util.py --- a/qa/rpc-tests/test_framework/util.py +++ b/qa/rpc-tests/test_framework/util.py @@ -797,7 +797,7 @@ # transaction to make it large. See gen_return_txouts() above. -def create_lots_of_big_transactions(node, txouts, utxos, num, fee, nHashType="NONE"): +def create_lots_of_big_transactions(node, txouts, utxos, num, fee): addr = node.getnewaddress() txids = [] for _ in range(num): @@ -810,7 +810,7 @@ newtx = rawtx[0:92] newtx = newtx + txouts newtx = newtx + rawtx[94:] - signresult = node.signrawtransaction(newtx, None, None, nHashType) + signresult = node.signrawtransaction(newtx, None, None, "NONE|FORKID") txid = node.sendrawtransaction(signresult["hex"], True) txids.append(txid) return txids