diff --git a/src/chainparams.cpp b/src/chainparams.cpp index 60a1aac87..bb45ce6a6 100755 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -352,8 +352,8 @@ public: consensus.fPowAllowMinDifficultyBlocks = true; consensus.fPowNoRetargeting = true; - consensus.nRuleChangeActivationThreshold = 432; // 75% for testchains - consensus.nMinerConfirmationWindow = 576; // Faster than normal for regtest (144 instead of 2016) + consensus.nRuleChangeActivationThreshold = 108; // 75% for testchains + consensus.nMinerConfirmationWindow = 144; // Faster than normal for regtest (144 instead of 2016) consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].bit = 28; consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nStartTime = 0; consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = 999999999999ULL; diff --git a/test/functional/bip68-112-113-p2p.py b/test/functional/bip68-112-113-p2p.py index 5a322e8c0..44904bbfd 100755 --- a/test/functional/bip68-112-113-p2p.py +++ b/test/functional/bip68-112-113-p2p.py @@ -104,7 +104,7 @@ class BIP68_112_113Test(ComparisonTestFramework): test.run() def send_generic_input_tx(self, node, coinbases): - amount = Decimal("49.99") + amount = Decimal("99.99") return node.sendrawtransaction(ToHex(self.sign_transaction(node, self.create_transaction(node, node.getblock(coinbases.pop())['tx'][0], self.nodeaddress, amount)))) def create_transaction(self, node, txid, to_address, amount): diff --git a/test/functional/blockchain.py b/test/functional/blockchain.py index a7034e6bc..b72150575 100755 --- a/test/functional/blockchain.py +++ b/test/functional/blockchain.py @@ -59,8 +59,7 @@ class BlockchainTest(BitcoinTestFramework): def _test_gettxoutsetinfo(self): node = self.nodes[0] res = node.gettxoutsetinfo() - - assert_equal(res['total_amount'], Decimal('8725.00000000')) + assert_equal(res['total_amount'], Decimal('17450.00000000')) assert_equal(res['transactions'], 200) assert_equal(res['height'], 200) assert_equal(res['txouts'], 200) diff --git a/test/functional/fundrawtransaction.py b/test/functional/fundrawtransaction.py index 1f5427ca4..86e401b04 100755 --- a/test/functional/fundrawtransaction.py +++ b/test/functional/fundrawtransaction.py @@ -51,7 +51,7 @@ class RawTransactionsTest(BitcoinTestFramework): self.sync_all() # ensure that setting changePosition in fundraw with an exact match is handled properly - rawmatch = self.nodes[2].createrawtransaction([], {self.nodes[2].getnewaddress():50}) + rawmatch = self.nodes[2].createrawtransaction([], {self.nodes[2].getnewaddress():100}) rawmatch = self.nodes[2].fundrawtransaction(rawmatch, {"changePosition":1, "subtractFeeFromOutputs":[0]}) assert_equal(rawmatch["changepos"], -1) @@ -498,7 +498,7 @@ class RawTransactionsTest(BitcoinTestFramework): self.sync_all() # make sure funds are received at node1 - assert_equal(oldBalance+Decimal('51.10000000'), self.nodes[0].getbalance()) + assert_equal(oldBalance+Decimal('101.10000000'), self.nodes[0].getbalance()) ############################################### @@ -558,7 +558,7 @@ class RawTransactionsTest(BitcoinTestFramework): self.sync_all() self.nodes[0].generate(1) self.sync_all() - assert_equal(oldBalance+Decimal('50.19000000'), self.nodes[0].getbalance()) #0.19+block reward + assert_equal(oldBalance+Decimal('100.19000000'), self.nodes[0].getbalance()) #0.19+block reward ##################################################### # test fundrawtransaction with OP_RETURN and no vin # diff --git a/test/functional/invalidblockrequest.py b/test/functional/invalidblockrequest.py index eabc0db8d..a414761ff 100755 --- a/test/functional/invalidblockrequest.py +++ b/test/functional/invalidblockrequest.py @@ -102,7 +102,7 @@ class InvalidBlockRequestTest(ComparisonTestFramework): ''' block3 = create_block(self.tip, create_coinbase(height), self.block_time) self.block_time += 1 - block3.vtx[0].vout[0].nValue = 100 * COIN # Too high! + block3.vtx[0].vout[0].nValue = 200 * COIN # Too high! block3.vtx[0].sha256=None block3.vtx[0].calc_sha256() block3.hashMerkleRoot = block3.calc_merkle_root() diff --git a/test/functional/mempool_reorg.py b/test/functional/mempool_reorg.py index 937bf4bab..15fc64400 100755 --- a/test/functional/mempool_reorg.py +++ b/test/functional/mempool_reorg.py @@ -41,15 +41,15 @@ class MempoolCoinbaseTest(BitcoinTestFramework): # and make sure the mempool code behaves correctly. b = [ self.nodes[0].getblockhash(n) for n in range(101, 105) ] coinbase_txids = [ self.nodes[0].getblock(h)['tx'][0] for h in b ] - spend_101_raw = create_tx(self.nodes[0], coinbase_txids[1], node1_address, 49.99) - spend_102_raw = create_tx(self.nodes[0], coinbase_txids[2], node0_address, 49.99) - spend_103_raw = create_tx(self.nodes[0], coinbase_txids[3], node0_address, 49.99) + spend_101_raw = create_tx(self.nodes[0], coinbase_txids[1], node1_address, 99.99) + spend_102_raw = create_tx(self.nodes[0], coinbase_txids[2], node0_address, 99.99) + spend_103_raw = create_tx(self.nodes[0], coinbase_txids[3], node0_address, 99.99) # Create a transaction which is time-locked to two blocks in the future - timelock_tx = self.nodes[0].createrawtransaction([{"txid": coinbase_txids[0], "vout": 0}], {node0_address: 49.99}) + timelock_tx = self.nodes[0].createrawtransaction([{"txid": coinbase_txids[0], "vout": 0}], {node0_address: 99.99}) # Set the time lock timelock_tx = timelock_tx.replace("ffffffff", "11111191", 1) - timelock_tx = timelock_tx[:-8] + hex(self.nodes[0].getblockcount() + 2)[2:] + "000000" + timelock_tx = timelock_tx[:-10] + hex(self.nodes[0].getblockcount() + 2)[2:] + "00000000" timelock_tx = self.nodes[0].signrawtransaction(timelock_tx)["hex"] # This will raise an exception because the timelock transaction is too immature to spend assert_raises_jsonrpc(-26, "non-final", self.nodes[0].sendrawtransaction, timelock_tx) @@ -62,8 +62,8 @@ class MempoolCoinbaseTest(BitcoinTestFramework): assert_raises_jsonrpc(-26,'non-final', self.nodes[0].sendrawtransaction, timelock_tx) # Create 102_1 and 103_1: - spend_102_1_raw = create_tx(self.nodes[0], spend_102_id, node1_address, 49.98) - spend_103_1_raw = create_tx(self.nodes[0], spend_103_id, node1_address, 49.98) + spend_102_1_raw = create_tx(self.nodes[0], spend_102_id, node1_address, 99.98) + spend_103_1_raw = create_tx(self.nodes[0], spend_103_id, node1_address, 99.98) # Broadcast and mine 103_1: spend_103_1_id = self.nodes[0].sendrawtransaction(spend_103_1_raw) diff --git a/test/functional/mempool_resurrect_test.py b/test/functional/mempool_resurrect_test.py index a2f6228df..843d80ea5 100755 --- a/test/functional/mempool_resurrect_test.py +++ b/test/functional/mempool_resurrect_test.py @@ -31,13 +31,13 @@ class MempoolCoinbaseTest(BitcoinTestFramework): b = [ self.nodes[0].getblockhash(n) for n in range(1, 4) ] coinbase_txids = [ self.nodes[0].getblock(h)['tx'][0] for h in b ] - spends1_raw = [ create_tx(self.nodes[0], txid, node0_address, 49.99) for txid in coinbase_txids ] + spends1_raw = [ create_tx(self.nodes[0], txid, node0_address, 99.99) for txid in coinbase_txids ] spends1_id = [ self.nodes[0].sendrawtransaction(tx) for tx in spends1_raw ] blocks = [] blocks.extend(self.nodes[0].generate(1)) - spends2_raw = [ create_tx(self.nodes[0], txid, node0_address, 49.98) for txid in spends1_id ] + spends2_raw = [ create_tx(self.nodes[0], txid, node0_address, 99.98) for txid in spends1_id ] spends2_id = [ self.nodes[0].sendrawtransaction(tx) for tx in spends2_raw ] blocks.extend(self.nodes[0].generate(1)) diff --git a/test/functional/mempool_spendcoinbase.py b/test/functional/mempool_spendcoinbase.py index 277ea45ad..3edf17768 100755 --- a/test/functional/mempool_spendcoinbase.py +++ b/test/functional/mempool_spendcoinbase.py @@ -34,7 +34,7 @@ class MempoolSpendCoinbaseTest(BitcoinTestFramework): # is too immature to spend. b = [ self.nodes[0].getblockhash(n) for n in range(101, 103) ] coinbase_txids = [ self.nodes[0].getblock(h)['tx'][0] for h in b ] - spends_raw = [ create_tx(self.nodes[0], txid, node0_address, 49.99) for txid in coinbase_txids ] + spends_raw = [ create_tx(self.nodes[0], txid, node0_address, 99.99) for txid in coinbase_txids ] spend_101_id = self.nodes[0].sendrawtransaction(spends_raw[0]) diff --git a/test/functional/merkle_blocks.py b/test/functional/merkle_blocks.py index bcc65c840..6fef80aed 100755 --- a/test/functional/merkle_blocks.py +++ b/test/functional/merkle_blocks.py @@ -35,9 +35,9 @@ class MerkleBlockTest(BitcoinTestFramework): assert_equal(self.nodes[2].getbalance(), 0) node0utxos = self.nodes[0].listunspent(1) - tx1 = self.nodes[0].createrawtransaction([node0utxos.pop()], {self.nodes[1].getnewaddress(): 49.99}) + tx1 = self.nodes[0].createrawtransaction([node0utxos.pop()], {self.nodes[1].getnewaddress(): 99.99}) txid1 = self.nodes[0].sendrawtransaction(self.nodes[0].signrawtransaction(tx1)["hex"]) - tx2 = self.nodes[0].createrawtransaction([node0utxos.pop()], {self.nodes[1].getnewaddress(): 49.99}) + tx2 = self.nodes[0].createrawtransaction([node0utxos.pop()], {self.nodes[1].getnewaddress(): 99.99}) txid2 = self.nodes[0].sendrawtransaction(self.nodes[0].signrawtransaction(tx2)["hex"]) # This will raise an exception because the transaction is not yet in a block assert_raises_jsonrpc(-5, "Transaction not yet in block", self.nodes[0].gettxoutproof, [txid1]) @@ -56,7 +56,7 @@ class MerkleBlockTest(BitcoinTestFramework): assert_equal(self.nodes[2].verifytxoutproof(self.nodes[2].gettxoutproof([txid1, txid2], blockhash)), txlist) txin_spent = self.nodes[1].listunspent(1).pop() - tx3 = self.nodes[1].createrawtransaction([txin_spent], {self.nodes[0].getnewaddress(): 49.98}) + tx3 = self.nodes[1].createrawtransaction([txin_spent], {self.nodes[0].getnewaddress(): 99.98}) txid3 = self.nodes[0].sendrawtransaction(self.nodes[1].signrawtransaction(tx3)["hex"]) self.nodes[0].generate(1) self.sync_all() diff --git a/test/functional/multiwallet.py b/test/functional/multiwallet.py index 5679f4050..8c1bafe07 100755 --- a/test/functional/multiwallet.py +++ b/test/functional/multiwallet.py @@ -46,7 +46,7 @@ class MultiWalletTest(BitcoinTestFramework): # check w1 wallet balance w1_info = w1.getwalletinfo() - assert_equal(w1_info['immature_balance'], 50) + assert_equal(w1_info['immature_balance'], 100) w1_name = w1_info['walletname'] assert_equal(w1_name, "w1") @@ -64,7 +64,7 @@ class MultiWalletTest(BitcoinTestFramework): assert_equal({"w1", "w2", "w3"}, {w1_name, w2_name, w3_name}) w1.generate(101) - assert_equal(w1.getbalance(), 100) + assert_equal(w1.getbalance(), 200) assert_equal(w2.getbalance(), 0) assert_equal(w3.getbalance(), 0) diff --git a/test/functional/p2p-fullblocktest.py b/test/functional/p2p-fullblocktest.py index 4d8ff65e2..6bed01a38 100755 --- a/test/functional/p2p-fullblocktest.py +++ b/test/functional/p2p-fullblocktest.py @@ -359,7 +359,7 @@ class FullBlockTest(ComparisonTestFramework): tip(15) b23 = block(23, spend=out[6]) tx = CTransaction() - script_length = MAX_BLOCK_BASE_SIZE - len(b23.serialize()) - 69 + script_length = MAX_BLOCK_BASE_SIZE - len(b23.serialize()) - 69 - 1 #subtract 1 for txComment byte script_output = CScript([b'\x00' * script_length]) tx.vout.append(CTxOut(0, script_output)) tx.vin.append(CTxIn(COutPoint(b23.vtx[1].sha256, 0))) @@ -372,7 +372,7 @@ class FullBlockTest(ComparisonTestFramework): # Make the next block one byte bigger and check that it fails tip(15) b24 = block(24, spend=out[6]) - script_length = MAX_BLOCK_BASE_SIZE - len(b24.serialize()) - 69 + script_length = MAX_BLOCK_BASE_SIZE - len(b24.serialize()) - 69 - 1 #subtract 1 for txComment byte script_output = CScript([b'\x00' * (script_length+1)]) tx.vout = [CTxOut(0, script_output)] b24 = update_block(24, [tx]) @@ -788,7 +788,7 @@ class FullBlockTest(ComparisonTestFramework): assert_equal(len(b56p2.vtx),6) b56p2 = update_block("b56p2", [tx3, tx4]) yield rejected(RejectResult(16, b'bad-txns-duplicate')) - + tip("57p2") yield accepted() @@ -813,10 +813,10 @@ class FullBlockTest(ComparisonTestFramework): b58 = update_block(58, [tx]) yield rejected(RejectResult(16, b'bad-txns-inputs-missingorspent')) - # tx with output value > input value out of range + # tx with output value > input value out of range tip(57) b59 = block(59) - tx = create_and_sign_tx(out[17].tx, out[17].n, 51*COIN) + tx = create_and_sign_tx(out[17].tx, out[17].n, 101*COIN) b59 = update_block(59, [tx]) yield rejected(RejectResult(16, b'bad-txns-in-belowout')) @@ -901,7 +901,7 @@ class FullBlockTest(ComparisonTestFramework): tx = CTransaction() # use canonical serialization to calculate size - script_length = MAX_BLOCK_BASE_SIZE - len(b64a.normal_serialize()) - 69 + script_length = MAX_BLOCK_BASE_SIZE - len(b64a.normal_serialize()) - 69 - 1 #subtract 1 for txComment byte script_output = CScript([b'\x00' * script_length]) tx.vout.append(CTxOut(0, script_output)) tx.vin.append(CTxIn(COutPoint(b64a.vtx[1].sha256, 0))) @@ -1250,7 +1250,7 @@ class FullBlockTest(ComparisonTestFramework): for i in range(89, LARGE_REORG_SIZE + 89): b = block(i, spend) tx = CTransaction() - script_length = MAX_BLOCK_BASE_SIZE - len(b.serialize()) - 69 + script_length = MAX_BLOCK_BASE_SIZE - len(b.serialize()) - 69 - 1 #subtract 1 for txComment byte script_output = CScript([b'\x00' * script_length]) tx.vout.append(CTxOut(0, script_output)) tx.vin.append(CTxIn(COutPoint(b.vtx[1].sha256, 0))) diff --git a/test/functional/p2p-segwit.py b/test/functional/p2p-segwit.py index 435b6accb..0d2266bb7 100755 --- a/test/functional/p2p-segwit.py +++ b/test/functional/p2p-segwit.py @@ -758,6 +758,10 @@ class SegWitTest(BitcoinTestFramework): if flags & 1: r += self.wit.serialize() r += struct.pack("= 2: + r += ser_compact_size(len(self.txComment)) + if len(self.txComment) > 0: + r += struct.pack(">= halvings if (pubkey != None): diff --git a/test/functional/test_framework/mininode.py b/test/functional/test_framework/mininode.py index 9b2cb7fca..2bb7ab6f1 100755 --- a/test/functional/test_framework/mininode.py +++ b/test/functional/test_framework/mininode.py @@ -427,13 +427,14 @@ class CTxWitness(object): class CTransaction(object): def __init__(self, tx=None): if tx is None: - self.nVersion = 1 + self.nVersion = 2 self.vin = [] self.vout = [] self.wit = CTxWitness() self.nLockTime = 0 self.sha256 = None self.hash = None + self.txComment = "" else: self.nVersion = tx.nVersion self.vin = copy.deepcopy(tx.vin) @@ -442,6 +443,7 @@ class CTransaction(object): self.sha256 = tx.sha256 self.hash = tx.hash self.wit = copy.deepcopy(tx.wit) + self.txComment = '%s' % tx.txComment def deserialize(self, f): self.nVersion = struct.unpack("= 2: + tx_comment_len = deser_compact_size(f) + if tx_comment_len > 0: + self.txComment = struct.unpack("= 2: + r += ser_compact_size(len(self.txComment)) + if len(self.txComment) > 0: + r += struct.pack("= 2: + r += ser_compact_size(len(self.txComment)) + if len(self.txComment) > 0: + r += struct.pack("