diff --git a/test/functional/abc-magnetic-anomaly-mining.py b/test/functional/abc-magnetic-anomaly-mining.py --- a/test/functional/abc-magnetic-anomaly-mining.py +++ b/test/functional/abc-magnetic-anomaly-mining.py @@ -67,7 +67,7 @@ outputs = {} # Calculate a unique fee for this transaction fee = decimal.Decimal(random.randint( - 1000, 2000)) / decimal.Decimal(1e8) + 1000, 2000)) / decimal.Decimal(1e2) # Spend to the same number of outputs as inputs, so we can leave # the amounts unchanged and avoid rounding errors. This also ensures # the number of sigops == number of sigchecks. @@ -81,7 +81,7 @@ addr = mining_node.getnewaddress() output = { # 50 BCH per coinbase - addr: decimal.Decimal(50) + addr: decimal.Decimal(50000000) } outputs.update(output) @@ -104,7 +104,7 @@ for txn in tmpl['transactions'][1:]: txid = txn['txid'] txnMetadata = transactions[txid] - expectedFeeSats = int(txnMetadata['fee'] * 10**8) + expectedFeeSats = int(txnMetadata['fee'] * 10**2) expectedSigOps = txnMetadata['sigops'] txid_decoded = int(txid, 16) diff --git a/test/functional/abc_mining_basic.py b/test/functional/abc_mining_basic.py --- a/test/functional/abc_mining_basic.py +++ b/test/functional/abc_mining_basic.py @@ -11,7 +11,7 @@ DEFAULT_MAX_BLOCK_SIZE, ) from test_framework.messages import ( - COIN, + XEC, ) from test_framework.test_framework import BitcoinTestFramework from test_framework.util import ( @@ -100,14 +100,14 @@ # next block will start enforcing them. 'minerfund': { 'addresses': [expectedMinerFundAddress], - 'minimumvalue': block_reward * 8 // 100 * COIN, + 'minimumvalue': block_reward * 8 // 100 * XEC, }, }, # Although the coinbase value need not necessarily be the same as # the last block due to halvings and fees, we know this to be true # since we are not crossing a halving boundary and there are no # transactions in the mempool. - 'coinbasevalue': block_reward * COIN, + 'coinbasevalue': block_reward * XEC, 'mintime': AXION_ACTIVATION_TIME + 1, }) @@ -126,11 +126,11 @@ 'coinbasetxn': { 'minerfund': { 'addresses': [expectedMinerFundAddress], - 'minimumvalue': block_reward * 8 // 100 * COIN, + 'minimumvalue': block_reward * 8 // 100 * XEC, }, }, # Again, we assume the coinbase value is the same as prior blocks. - 'coinbasevalue': block_reward * COIN, + 'coinbasevalue': block_reward * XEC, 'mintime': AXION_ACTIVATION_TIME + 1, }) @@ -141,10 +141,10 @@ 'coinbasetxn': { 'minerfund': { 'addresses': [expectedMinerFundAddress], - 'minimumvalue': block_reward * 8 // 100 * COIN, + 'minimumvalue': block_reward * 8 // 100 * XEC, }, }, - 'coinbasevalue': block_reward * COIN, + 'coinbasevalue': block_reward * XEC, 'mintime': AXION_ACTIVATION_TIME + 2, }) diff --git a/test/functional/abc_rpc_avalancheproof.py b/test/functional/abc_rpc_avalancheproof.py --- a/test/functional/abc_rpc_avalancheproof.py +++ b/test/functional/abc_rpc_avalancheproof.py @@ -31,7 +31,7 @@ AVALANCHE_MAX_PROOF_STAKES = 1000 -PROOF_DUST_THRESHOLD = 1.0 +PROOF_DUST_THRESHOLD = 1000000.0 """Minimum amount per UTXO in a proof (in coins, not in satoshis)""" @@ -230,7 +230,7 @@ proof_sequence, proof_expiration, proof_master, [{ 'txid': '0' * 64, 'vout': 0, - 'amount': 10, + 'amount': 10000000, 'height': 42, 'iscoinbase': False, 'privatekey': addrkey0.key, @@ -298,7 +298,7 @@ raw_tx = node.createrawtransaction( [{"txid": stakes[-1]["txid"], "vout": 0}], {ADDRESS_BCHREG_UNSPENDABLE: stakes[-1] - ["amount"] - Decimal('0.01')} + ["amount"] - Decimal('10000')} ) signed_tx = node.signrawtransactionwithkey(raw_tx, [addrkey0.key]) node.sendrawtransaction(signed_tx["hex"]) diff --git a/test/functional/abc_wallet_dumpcoins.py b/test/functional/abc_wallet_dumpcoins.py --- a/test/functional/abc_wallet_dumpcoins.py +++ b/test/functional/abc_wallet_dumpcoins.py @@ -47,7 +47,7 @@ "txid": coinbases[0], "vout": 0, "depth": 101, - "value": Decimal('50.00000000'), + "value": Decimal('50000000.00'), }], }) @@ -57,13 +57,13 @@ "txid": coinbases[0], "vout": 0, "depth": 102, - "value": Decimal('50.00000000'), + "value": Decimal('50000000.00'), }], address1: [{ "txid": coinbases[1], "vout": 0, "depth": 101, - "value": Decimal('50.00000000'), + "value": Decimal('50000000.00'), }], }) diff --git a/test/functional/abc_wallet_standardness.py b/test/functional/abc_wallet_standardness.py --- a/test/functional/abc_wallet_standardness.py +++ b/test/functional/abc_wallet_standardness.py @@ -30,7 +30,7 @@ assert_equal, ) -SATOSHI = Decimal('0.00000001') +SATOSHI = Decimal('0.01') class WalletStandardnessTest(BitcoinTestFramework): diff --git a/test/functional/data/rpc_getblockstats.json b/test/functional/data/rpc_getblockstats.json --- a/test/functional/data/rpc_getblockstats.json +++ b/test/functional/data/rpc_getblockstats.json @@ -102,8 +102,8 @@ "000000205bd302491bc690cea24422e800747fa3fd1b6fb137fb5018c47b11ad90c52755e2124f3b902a4f368a89d03058d0fbd69ce494ba6055bf299f5ed9d75a755fb62b4ae75affff7f20010000000102000000010000000000000000000000000000000000000000000000000000000000000000ffffffff0f01630101082f454233322e302f0100ffffffff0100f2052a010000001976a9142b4569203694fc997e13f2c0a1383b9e16c77a0d88ac00000000", "00000020a7dcc55b04a546cddd1c764e69337ed230834ca66fd51bd23adcb673734d7c5c053a47d82618fa4df6a0db6f0d9e677c44945bba6f413fec44b29b25a770057f2b4ae75affff7f20030000000102000000010000000000000000000000000000000000000000000000000000000000000000ffffffff0f01640101082f454233322e302f0100ffffffff0100f2052a010000001976a9142b4569203694fc997e13f2c0a1383b9e16c77a0d88ac00000000", "00000020818587bde832de22be348e70c58e5cecb25c0395bff51405a8fd3b9fad1042688109df13eb0a5c0cf872f0b9105c13345cb577fcb5c67654556ae163d51083ce2b4ae75affff7f20000000000102000000010000000000000000000000000000000000000000000000000000000000000000ffffffff0f01650101082f454233322e302f0100ffffffff0100f2052a010000001976a9142b4569203694fc997e13f2c0a1383b9e16c77a0d88ac00000000", - "000000201e2815a75750af357dcb654f9f428dda7a504365c6fab2c1ef877de60ae1c241647fc8d4d1a48d1374a4bfb7ecad1493058dea42e5ee87edfc12abc50e2616a02b4ae75affff7f20020000000202000000010000000000000000000000000000000000000000000000000000000000000000ffffffff0f01660101082f454233322e302f0100ffffffff01e1f2052a010000001976a9142b4569203694fc997e13f2c0a1383b9e16c77a0d88ac00000000020000000105c5f72f5d6da3085583e75ee79340eb4eff208c89988e7ed0efb30b87298fa3000000006a4730440220581f48d1a5c9c4a869cec92dbe94df5c3c28a8c27d638b23e24919c4e6aee71c022024e0357d5a5976e6d201bb2f53a6251b89daeda785dfb9c6fcb610da0d1e3ed541210227d85ba011276cf25b51df6a188b75e604b38770a462b2d0e9fb2fc839ef5d3ffeffffff0200286bee000000001976a91449f2f195be42ed62b12a8f9da073abcbecb9c10288ac1fc99a3b000000001976a9142b4569203694fc997e13f2c0a1383b9e16c77a0d88ac65000000", - "00000020421d192d36ce9f0e4f2082ed947acc18b7eedc7c1f30cd79e26484ce36f3ae04fb9002c4cfb89aa6d302c2eabe7c38ccb9ac56c0c182b81357f154fde7f7655b2b4ae75affff7f20000000000402000000010000000000000000000000000000000000000000000000000000000000000000ffffffff0f01670101082f454233322e302f0100ffffffff016efb062a010000001976a9142b4569203694fc997e13f2c0a1383b9e16c77a0d88ac000000000200000001c4d80cdcd39a6f766d637a6ac63a35255e022bda33e02d6d68202bdff1ecea6c010000006a47304402202a8e13786869874071d527f36102241df28f779a3272ea6d5f5aa89c544af47e0220262c806e828530d8a90f8677ceff72720e53e082e4228a2240dcfa6a0cc000d041210227d85ba011276cf25b51df6a188b75e604b38770a462b2d0e9fb2fc839ef5d3ffeffffff0254d9f405000000001976a9142b4569203694fc997e13f2c0a1383b9e16c77a0d88ac1fe8a435000000001976a91401df140f86cf2f6e91584e0a0d9b13579687881d88ac660000000200000001290a5e3decf29ecef819d5bb6325c9a31c8c0776198e53d2ec063549e8dba714000000006a4730440220496af6043dae18fc4b655a33bbc35680e208a37d1f6b8c2633835c1d6ff9d45602205cff70466b2d8b76f83be9a7cf711e0197cf3a60965b62525816bc67cc2f856741210227d85ba011276cf25b51df6a188b75e604b38770a462b2d0e9fb2fc839ef5d3ffeffffff021f276bee000000001976a914a138a9c7be324a2027b6c19c3ecdb7a83fccf76188ac00ca9a3b000000001976a9142b4569203694fc997e13f2c0a1383b9e16c77a0d88ac660000000200000001c4d80cdcd39a6f766d637a6ac63a35255e022bda33e02d6d68202bdff1ecea6c000000006a47304402203a8437f161265e6ea527ae7ba2c766eb4843b9d9240a1cec27f7ae98bcbb4200022037d5b5ff17c61b7218c02fba92e9cd8226f8cb0ebc24695f499339590ac49597412102c9785a4f32000e6dcde0b1d2d4e98540bece3aba965c3735fbbb0fe90fa063c3feffffff021fc99a3b000000001976a9142b4569203694fc997e13f2c0a1383b9e16c77a0d88ac005ed0b2000000001976a9146fd0eb1d6092e852b49342e13edb1a757137e38d88ac66000000" + "000000201e2815a75750af357dcb654f9f428dda7a504365c6fab2c1ef877de60ae1c2411e48c28d6c95c9fed016d75954188c8fee5a07d173964ed96f56c1aefb2b219e2b4ae75affff7f20000000000202000000010000000000000000000000000000000000000000000000000000000000000000ffffffff0f01660101082f454233322e302f0100ffffffff01e1f2052a010000001976a9142b4569203694fc997e13f2c0a1383b9e16c77a0d88ac00000000020000000105c5f72f5d6da3085583e75ee79340eb4eff208c89988e7ed0efb30b87298fa3000000006a47304402203f8af1c577648e5c8f26e037db1b6ebce4c9747a9a68881a2801a4083a8e743c02206f284521ecdba3d65ad24d7916777230bba81cfc3236e04bb522bcac9717f75641210227d85ba011276cf25b51df6a188b75e604b38770a462b2d0e9fb2fc839ef5d3ffeffffff021fc99a3b000000001976a9142b4569203694fc997e13f2c0a1383b9e16c77a0d88ac00286bee000000001976a914f8a0fc0922ddc8bb2fd529b32a00a3711487db7c88ac65000000", + "00000020d53e17503adc625c3b7fef097cc086137cf430c615cc3075a94e4960d83df21b1d000d94e94e21c389855e185d2294f16af4f607545670d2354f85147beff0222b4ae75affff7f20000000000402000000010000000000000000000000000000000000000000000000000000000000000000ffffffff0f01670101082f454233322e302f0100ffffffff016efb062a010000001976a9142b4569203694fc997e13f2c0a1383b9e16c77a0d88ac00000000020000000159f324cda7613a99d56240a1830a717bda217337d91b1fba1f8ce461980be007010000006a4730440220700b3707fbcb8733c3b3e2e82f071d6719638e012f5a008f79146d8df052dfe8022032de384fbca13465cf84320930aff44d00a6880eeb754a331d939704e9377db1412103cdb81a4d773249089d06bb7e7dd32e9f21fb97f878409f23b3e51b8fa2171d2bfeffffff021fc99a3b000000001976a9142b4569203694fc997e13f2c0a1383b9e16c77a0d88ac005ed0b2000000001976a9141980cde97ad6c3da1a0e7476b04c523a3f573d3f88ac66000000020000000160321f7f890ffac8ba8816865f4930db6c178f00accdebd9d7c3c9138329cdf7000000006a47304402203af1ff083070dd08a0ccf76ae208e2d9920d0a094bb812f2bb51cfff4cd506490220219680ad8cdd167d239daa016a2ed7be4af7a05b2364a10eac74d5278f3c6da8412102329a087e27fd98adee69cc8d0b7dbff77a4b88a35d18347a354834ce09b01c03feffffff0254d9f405000000001976a9142b4569203694fc997e13f2c0a1383b9e16c77a0d88ac1fb23f71000000001976a91427c43422a1f7beef12221fde2b8362861de36eb888ac3f0000000200000001fb9ac39919c7460ddfabafde0e58efd886d50183de022491fdfa91c6b46cc84c010000006a4730440220798ef637c97bdb0fc8b33d7d73b1b75a82e244a40d2bdaa01071b3748e89bc48022063c4fe316a7b16ff15d000d6ec565f68ea34e7d82ed87dfae9bb242a11ce9d94412102e7cc6f15570139869198f81ba773fbcb1373c918091f8ba25d2e3dd54db30725feffffff021f933577000000001976a9143274ce9d8bda566fb88956c1f437b1d20d47abf688ac00ca9a3b000000001976a9142b4569203694fc997e13f2c0a1383b9e16c77a0d88ac66000000" ], "mocktime": 1525107225, "stats": [ @@ -125,7 +125,7 @@ "minfeerate": 0.0, "mintxsize": 0, "outs": 1, - "subsidy": 50.0, + "subsidy": 50000000.0, "time": 1525107243, "total_out": 0.0, "total_size": 0, @@ -135,58 +135,58 @@ "utxo_size_inc": 75 }, { - "avgfee": 2.25e-06, - "avgfeerate": 1e-08, + "avgfee": 2.25, + "avgfeerate": 0.01, "avgtxsize": 225, - "blockhash": "04aef336ce8464e279cd301f7cdceeb718cc7a94ed82204f0e9fce362d191d42", + "blockhash": "1bf23dd860494ea97530cc15c630f47c1386c07c09ef7f3b5c62dc3a50173ed5", "height": 102, "ins": 1, - "maxfee": 2.25e-06, - "maxfeerate": 1e-08, + "maxfee": 2.25, + "maxfeerate": 0.01, "maxtxsize": 225, - "medianfee": 2.25e-06, - "medianfeerate": 1e-08, + "medianfee": 2.25, + "medianfeerate": 0.01, "mediantime": 1525107242, "mediantxsize": 225, - "minfee": 2.25e-06, - "minfeerate": 1e-08, + "minfee": 2.25, + "minfeerate": 0.01, "mintxsize": 225, "outs": 3, - "subsidy": 50.0, + "subsidy": 50000000.0, "time": 1525107243, - "total_out": 49.99999775, + "total_out": 49999997.75, "total_size": 225, - "totalfee": 2.25e-06, + "totalfee": 2.25, "txs": 2, "utxo_increase": 2, "utxo_size_inc": 150 }, { - "avgfee": 0.0002265, - "avgfeerate": 1e-06, + "avgfee": 226.5, + "avgfeerate": 1.0, "avgtxsize": 225, - "blockhash": "69f1ebab8b9a8363efdde320066c31c261bc16b791d8777d3034dad8e5313116", + "blockhash": "568ebedbf80e79cd59deb4e6bf44deda18df2cb0bb64175a3df8ea1f5c913cd8", "height": 103, "ins": 3, - "maxfee": 0.000675, - "maxfeerate": 3e-06, + "maxfee": 675.0, + "maxfeerate": 3.0, "maxtxsize": 225, - "medianfee": 2.25e-06, - "medianfeerate": 1e-08, + "medianfee": 2.25, + "medianfeerate": 0.01, "mediantime": 1525107243, "mediantxsize": 225, - "minfee": 2.25e-06, - "minfeerate": 1e-08, + "minfee": 2.25, + "minfeerate": 0.01, "mintxsize": 225, "outs": 7, - "subsidy": 50.0, + "subsidy": 50000000.0, "time": 1525107243, - "total_out": 99.99931825, + "total_out": 89999318.25, "total_size": 675, - "totalfee": 0.0006795, + "totalfee": 679.5, "txs": 4, "utxo_increase": 4, "utxo_size_inc": 300 } ] } \ No newline at end of file diff --git a/test/functional/data/rpc_psbt.json b/test/functional/data/rpc_psbt.json --- a/test/functional/data/rpc_psbt.json +++ b/test/functional/data/rpc_psbt.json @@ -46,10 +46,10 @@ ], "outputs" : [ { - "ecregtest:qrv9c2m36qrqkzwf3p4whq272zv3mksjf5sdqg0py5": 1.49990000 + "ecregtest:qrv9c2m36qrqkzwf3p4whq272zv3mksjf5sdqg0py5": 1499900.00 }, { - "ecregtest:qqq2a2dzuhc0sa493r0423hgwsk3mpcq3uwrz3g0nr": 1 + "ecregtest:qqq2a2dzuhc0sa493r0423hgwsk3mpcq3uwrz3g0nr": 1000000 } ], "result" : "cHNidP8BAKACAAAAAljoeiG1ba8MI76OcHBFbDNvfLqlyHV5JPVFiHuyq911AAAAAAD/////g40EJ9DsZQpoqka7CwmK6kQiwHGyyng1Kgd5WdB86h0BAAAAAP////8CcKrwCAAAAAAZdqkU2FwrcdAGCwnJiGrrgV5QmR3aEk2IrADh9QUAAAAAGXapFACuqaLl8Ph2pYjfVUbodC0dhwCPiKwAAAAAAAAAAAA=" diff --git a/test/functional/feature_bip68_sequence.py b/test/functional/feature_bip68_sequence.py --- a/test/functional/feature_bip68_sequence.py +++ b/test/functional/feature_bip68_sequence.py @@ -11,7 +11,7 @@ create_coinbase, ) from test_framework.messages import ( - COIN, + XEC, COutPoint, CTransaction, CTxIn, @@ -96,7 +96,7 @@ # Create some unconfirmed inputs new_addr = self.nodes[0].getnewaddress() # send 2 BCH - self.nodes[0].sendtoaddress(new_addr, 2) + self.nodes[0].sendtoaddress(new_addr, 2000000) utxos = self.nodes[0].listunspent(0, 0) assert len(utxos) > 0 @@ -104,7 +104,7 @@ utxo = utxos[0] tx1 = CTransaction() - value = int(satoshi_round(utxo["amount"] - self.relayfee) * COIN) + value = int(satoshi_round(utxo["amount"] - self.relayfee) * XEC) # Check that the disable flag disables relative locktime. # If sequence locks were used, this would require 1 block for the @@ -126,7 +126,7 @@ tx2.nVersion = 2 sequence_value = sequence_value & 0x7fffffff tx2.vin = [CTxIn(COutPoint(tx1_id, 0), nSequence=sequence_value)] - tx2.vout = [CTxOut(int(value - self.relayfee * COIN), CScript([b'a']))] + tx2.vout = [CTxOut(int(value - self.relayfee * XEC), CScript([b'a']))] pad_tx(tx2) tx2.rehash() @@ -161,7 +161,7 @@ num_outputs = random.randint(1, max_outputs) outputs = {} for i in range(num_outputs): - outputs[addresses[i]] = random.randint(1, 20) * 0.01 + outputs[addresses[i]] = random.randint(1, 20) * 10000 self.nodes[0].sendmany("", outputs) self.nodes[0].generate(1) @@ -233,12 +233,12 @@ sequence_value |= SEQUENCE_LOCKTIME_TYPE_FLAG tx.vin.append( CTxIn(COutPoint(int(utxos[j]["txid"], 16), utxos[j]["vout"]), nSequence=sequence_value)) - value += utxos[j]["amount"] * COIN + value += utxos[j]["amount"] * XEC # Overestimate the size of the tx - signatures should be less than # 120 bytes, and leave 50 for the output tx_size = len(ToHex(tx)) // 2 + 120 * num_inputs + 50 tx.vout.append( - CTxOut(int(value - self.relayfee * tx_size * COIN / 1000), CScript([b'a']))) + CTxOut(int(value - self.relayfee * tx_size * XEC / 1000), CScript([b'a']))) rawtx = self.nodes[0].signrawtransactionwithwallet(ToHex(tx))[ "hex"] @@ -260,7 +260,8 @@ cur_height = self.nodes[0].getblockcount() # Create a mempool tx. - txid = self.nodes[0].sendtoaddress(self.nodes[0].getnewaddress(), 2) + txid = self.nodes[0].sendtoaddress( + self.nodes[0].getnewaddress(), 2000000) tx1 = FromHex(CTransaction(), self.nodes[0].getrawtransaction(txid)) tx1.rehash() @@ -366,7 +367,7 @@ utxos = self.nodes[0].listunspent() tx5.vin.append( CTxIn(COutPoint(int(utxos[0]["txid"], 16), utxos[0]["vout"]), nSequence=1)) - tx5.vout[0].nValue += int(utxos[0]["amount"] * COIN) + tx5.vout[0].nValue += int(utxos[0]["amount"] * XEC) raw_tx5 = self.nodes[0].signrawtransactionwithwallet(ToHex(tx5))["hex"] assert_raises_rpc_error(-26, NOT_FINAL_ERROR, @@ -425,7 +426,8 @@ # this test should be moved to run earlier, or deleted. def test_bip68_not_consensus(self): assert_equal(self.get_csv_status(), False) - txid = self.nodes[0].sendtoaddress(self.nodes[0].getnewaddress(), 2) + txid = self.nodes[0].sendtoaddress( + self.nodes[0].getnewaddress(), 2000000) tx1 = FromHex(CTransaction(), self.nodes[0].getrawtransaction(txid)) tx1.rehash() @@ -435,7 +437,7 @@ tx2.nVersion = 1 tx2.vin = [CTxIn(COutPoint(tx1.sha256, 0), nSequence=0)] tx2.vout = [ - CTxOut(int(tx1.vout[0].nValue - self.relayfee * COIN), CScript([b'a']))] + CTxOut(int(tx1.vout[0].nValue - self.relayfee * XEC), CScript([b'a']))] # sign tx2 tx2_raw = self.nodes[0].signrawtransactionwithwallet(ToHex(tx2))["hex"] @@ -453,7 +455,7 @@ tx3.nVersion = 2 tx3.vin = [CTxIn(COutPoint(tx2.sha256, 0), nSequence=sequence_value)] tx3.vout = [ - CTxOut(int(tx2.vout[0].nValue - self.relayfee * COIN), CScript([b'a']))] + CTxOut(int(tx2.vout[0].nValue - self.relayfee * XEC), CScript([b'a']))] pad_tx(tx3) tx3.rehash() @@ -493,7 +495,7 @@ # Use self.nodes[1] to test that version 2 transactions are standard. def test_version2_relay(self): inputs = [] - outputs = {self.nodes[1].getnewaddress(): 1.0} + outputs = {self.nodes[1].getnewaddress(): 1000000.0} rawtx = self.nodes[1].createrawtransaction(inputs, outputs) rawtxfund = self.nodes[1].fundrawtransaction(rawtx)['hex'] tx = FromHex(CTransaction(), rawtxfund) diff --git a/test/functional/feature_cltv.py b/test/functional/feature_cltv.py --- a/test/functional/feature_cltv.py +++ b/test/functional/feature_cltv.py @@ -102,9 +102,9 @@ "Test that an invalid-according-to-CLTV transaction can still appear in a block") fundtx = create_transaction(self.nodes[0], self.coinbase_txids[0], - self.nodeaddress, amount=49.99) + self.nodeaddress, amount=49990000) fundtx, spendtx = cltv_lock_to_height( - self.nodes[0], fundtx, self.nodeaddress, 49.98) + self.nodes[0], fundtx, self.nodeaddress, 49980000) tip = self.nodes[0].getbestblockhash() block_time = self.nodes[0].getblockheader(tip)['mediantime'] + 1 @@ -139,9 +139,9 @@ block.nVersion = 4 fundtx = create_transaction(self.nodes[0], self.coinbase_txids[1], - self.nodeaddress, amount=49.99) + self.nodeaddress, amount=49990000) fundtx, spendtx = cltv_lock_to_height( - self.nodes[0], fundtx, self.nodeaddress, 49.98) + self.nodes[0], fundtx, self.nodeaddress, 49980000) # The funding tx only has unexecuted bad CLTV, in scriptpubkey; this is # valid. @@ -189,9 +189,9 @@ self.log.info( "Test that a version 4 block with a valid-according-to-CLTV transaction is accepted") fundtx = create_transaction(self.nodes[0], self.coinbase_txids[2], - self.nodeaddress, amount=49.99) + self.nodeaddress, amount=49990000) fundtx, spendtx = cltv_lock_to_height( - self.nodes[0], fundtx, self.nodeaddress, 49.98, CLTV_HEIGHT) + self.nodes[0], fundtx, self.nodeaddress, 49980000, CLTV_HEIGHT) # make sure sequence is nonfinal and locktime is good spendtx.vin[0].nSequence = 0xfffffffe diff --git a/test/functional/feature_csv_activation.py b/test/functional/feature_csv_activation.py --- a/test/functional/feature_csv_activation.py +++ b/test/functional/feature_csv_activation.py @@ -49,7 +49,7 @@ create_coinbase, make_conform_to_ctor, ) -from test_framework.messages import COIN, CTransaction, FromHex, ToHex +from test_framework.messages import XEC, CTransaction, FromHex, ToHex from test_framework.p2p import P2PDataStore from test_framework.script import ( CScript, @@ -109,7 +109,7 @@ def spend_tx(node, prev_tx, address): spendtx = create_transaction( - node, prev_tx.hash, address, amount=(prev_tx.vout[0].nValue - 1000) / COIN) + node, prev_tx.hash, address, amount=(prev_tx.vout[0].nValue - 1000) / XEC) spendtx.nVersion = prev_tx.nVersion pad_tx(spendtx) spendtx.rehash() @@ -118,7 +118,7 @@ def create_bip112special(node, input, txversion, address): tx = create_transaction( - node, input, address, amount=Decimal("49.98")) + node, input, address, amount=Decimal("49980000")) tx.nVersion = txversion tx.vout[0].scriptPubKey = CScript( [-1, OP_CHECKSEQUENCEVERIFY, OP_DROP, OP_TRUE]) @@ -131,7 +131,7 @@ def send_generic_input_tx(node, coinbases, address): return node.sendrawtransaction(ToHex(sign_transaction(node, create_transaction( - node, node.getblock(coinbases.pop())['tx'][0], address, amount=Decimal("49.99"))))) + node, node.getblock(coinbases.pop())['tx'][0], address, amount=Decimal("49990000"))))) def create_bip68txs(node, bip68inputs, txversion, address, locktime_delta=0): @@ -141,7 +141,7 @@ for i, (sdf, srhb, stf, srlb) in enumerate(product(*[[True, False]] * 4)): locktime = relative_locktime(sdf, srhb, stf, srlb) tx = create_transaction( - node, bip68inputs[i], address, amount=Decimal("49.98")) + node, bip68inputs[i], address, amount=Decimal("49980000")) tx.nVersion = txversion tx.vin[0].nSequence = locktime + locktime_delta tx = sign_transaction(node, tx) @@ -159,7 +159,7 @@ for i, (sdf, srhb, stf, srlb) in enumerate(product(*[[True, False]] * 4)): locktime = relative_locktime(sdf, srhb, stf, srlb) tx = create_transaction( - node, bip112inputs[i], address, amount=Decimal("49.98")) + node, bip112inputs[i], address, amount=Decimal("49980000")) if (varyOP_CSV): # if varying OP_CSV, nSequence is fixed tx.vin[0].nSequence = BASE_RELATIVE_LOCKTIME + locktime_delta else: # vary nSequence instead, OP_CSV is fixed @@ -322,11 +322,11 @@ # BIP113 test transaction will be modified before each use to # put in appropriate block time bip113tx_v1 = create_transaction( - self.nodes[0], bip113input, self.nodeaddress, amount=Decimal("49.98")) + self.nodes[0], bip113input, self.nodeaddress, amount=Decimal("49980000")) bip113tx_v1.vin[0].nSequence = 0xFFFFFFFE bip113tx_v1.nVersion = 1 bip113tx_v2 = create_transaction( - self.nodes[0], bip113input, self.nodeaddress, amount=Decimal("49.98")) + self.nodes[0], bip113input, self.nodeaddress, amount=Decimal("49980000")) bip113tx_v2.vin[0].nSequence = 0xFFFFFFFE bip113tx_v2.nVersion = 2 diff --git a/test/functional/feature_dbcrash.py b/test/functional/feature_dbcrash.py --- a/test/functional/feature_dbcrash.py +++ b/test/functional/feature_dbcrash.py @@ -33,7 +33,7 @@ from test_framework.blocktools import create_confirmed_utxos from test_framework.cdefs import DEFAULT_MAX_BLOCK_SIZE from test_framework.messages import ( - COIN, + XEC, COutPoint, CTransaction, CTxIn, @@ -213,7 +213,7 @@ utxo = utxo_list.pop() tx.vin.append( CTxIn(COutPoint(int(utxo['txid'], 16), utxo['vout']))) - input_amount += int(utxo['amount'] * COIN) + input_amount += int(utxo['amount'] * XEC) output_amount = (input_amount - FEE) // 3 if output_amount <= 0: diff --git a/test/functional/feature_dersig.py b/test/functional/feature_dersig.py --- a/test/functional/feature_dersig.py +++ b/test/functional/feature_dersig.py @@ -72,7 +72,7 @@ block.nVersion = 3 spendtx = create_transaction(self.nodes[0], self.coinbase_txids[1], - self.nodeaddress, amount=1.0) + self.nodeaddress, amount=1000000) unDERify(spendtx) spendtx.rehash() diff --git a/test/functional/interface_bitcoin_cli.py b/test/functional/interface_bitcoin_cli.py --- a/test/functional/interface_bitcoin_cli.py +++ b/test/functional/interface_bitcoin_cli.py @@ -15,7 +15,7 @@ # COINBASE_MATURITY (100) blocks. Therefore, after mining 101 blocks we expect # node 0 to have a balance of (BLOCKS - COINBASE_MATURITY) * 50 BTC/block. BLOCKS = 101 -BALANCE = (BLOCKS - 100) * 50 +BALANCE = (BLOCKS - 100) * 50000000 class TestBitcoinCli(BitcoinTestFramework): @@ -98,9 +98,9 @@ # Setup to test -getinfo and -rpcwallet= with multiple wallets. wallets = ['', 'Encrypted', 'secret'] amounts = [ - BALANCE + Decimal('9.99999550'), - Decimal(9), - Decimal(31)] + BALANCE + Decimal('9999995.50'), + Decimal(9000000), + Decimal(31000000)] self.nodes[0].createwallet(wallet_name=wallets[1]) self.nodes[0].createwallet(wallet_name=wallets[2]) w1 = self.nodes[0].get_wallet_rpc(wallets[0]) diff --git a/test/functional/interface_rest.py b/test/functional/interface_rest.py --- a/test/functional/interface_rest.py +++ b/test/functional/interface_rest.py @@ -91,9 +91,10 @@ self.nodes[1].generatetoaddress(100, not_related_address) self.sync_all() - assert_equal(self.nodes[0].getbalance(), 50) + assert_equal(self.nodes[0].getbalance(), 50000000) - txid = self.nodes[0].sendtoaddress(self.nodes[1].getnewaddress(), 0.1) + txid = self.nodes[0].sendtoaddress( + self.nodes[1].getnewaddress(), 100000) self.sync_all() self.log.info("Test the /tx URI") @@ -110,7 +111,8 @@ # Get the vin to later check for utxo (should be spent by then) spent = (json_obj['vin'][0]['txid'], json_obj['vin'][0]['vout']) # Get n of 0.1 outpoint - n, = filter_output_indices_by_value(json_obj['vout'], Decimal('0.1')) + n, = filter_output_indices_by_value( + json_obj['vout'], Decimal('100000')) spending = (txid, n) self.log.info("Query an unspent TXO using the /getutxos URI") @@ -119,7 +121,7 @@ self.sync_all() bb_hash = self.nodes[0].getbestblockhash() - assert_equal(self.nodes[1].getbalance(), Decimal("0.1")) + assert_equal(self.nodes[1].getbalance(), Decimal("100000")) # Check chainTip response json_obj = self.test_rest_request("/getutxos/{}-{}".format(*spending)) @@ -127,7 +129,7 @@ # Make sure there is one utxo assert_equal(len(json_obj['utxos']), 1) - assert_equal(json_obj['utxos'][0]['value'], Decimal('0.1')) + assert_equal(json_obj['utxos'][0]['value'], Decimal('100000')) self.log.info("Query a spent TXO using the /getutxos URI") @@ -176,13 +178,15 @@ # found with or without /checkmempool. # Do a tx and don't sync - txid = self.nodes[0].sendtoaddress(self.nodes[1].getnewaddress(), 0.1) + txid = self.nodes[0].sendtoaddress( + self.nodes[1].getnewaddress(), 100000) json_obj = self.test_rest_request("/tx/{}".format(txid)) # Get the spent output to later check for utxo (should be spent by # then) spent = (json_obj['vin'][0]['txid'], json_obj['vin'][0]['vout']) # Get n of 0.1 outpoint - n, = filter_output_indices_by_value(json_obj['vout'], Decimal('0.1')) + n, = filter_output_indices_by_value( + json_obj['vout'], Decimal('100000')) spending = (txid, n) json_obj = self.test_rest_request("/getutxos/{}-{}".format(*spending)) diff --git a/test/functional/interface_zmq.py b/test/functional/interface_zmq.py --- a/test/functional/interface_zmq.py +++ b/test/functional/interface_zmq.py @@ -119,7 +119,7 @@ if self.is_wallet_compiled(): self.log.info("Wait for tx from second node") payment_txid = self.nodes[1].sendtoaddress( - self.nodes[0].getnewaddress(), 1.0) + self.nodes[0].getnewaddress(), 1000000) self.sync_all() # Should receive the broadcasted txid. @@ -179,7 +179,7 @@ # Generate 1 block in nodes[0] with 1 mempool tx and receive all # notifications payment_txid = self.nodes[0].sendtoaddress( - self.nodes[0].getnewaddress(), 1.0) + self.nodes[0].getnewaddress(), 1000000) disconnect_block = self.nodes[0].generatetoaddress( 1, ADDRESS_BCHREG_UNSPENDABLE)[0] disconnect_cb = self.nodes[0].getblock(disconnect_block)["tx"][0] diff --git a/test/functional/mempool_accept.py b/test/functional/mempool_accept.py --- a/test/functional/mempool_accept.py +++ b/test/functional/mempool_accept.py @@ -7,7 +7,7 @@ from test_framework.test_framework import BitcoinTestFramework from test_framework.key import ECKey from test_framework.messages import ( - COIN, + XEC, COutPoint, CTransaction, CTxOut, @@ -75,7 +75,8 @@ coin = coins.pop() raw_tx_in_block = node.signrawtransactionwithwallet(node.createrawtransaction( inputs=[{'txid': coin['txid'], 'vout': coin['vout']}], - outputs=[{node.getnewaddress(): 0.3}, {node.getnewaddress(): 49}], + outputs=[{node.getnewaddress(): 300000}, + {node.getnewaddress(): 49000000}], ))['hex'] txid_in_block = node.sendrawtransaction( hexstring=raw_tx_in_block, maxfeerate=0) @@ -88,11 +89,11 @@ ) self.log.info('A transaction not in the mempool') - fee = 0.00000700 + fee = 7.00 raw_tx_0 = node.signrawtransactionwithwallet(node.createrawtransaction( inputs=[{"txid": txid_in_block, "vout": 0, "sequence": 0xfffffffd}], - outputs=[{node.getnewaddress(): 0.3 - fee}], + outputs=[{node.getnewaddress(): 300000 - fee}], ))['hex'] tx = FromHex(CTransaction(), raw_tx_0) txid_0 = tx.rehash() @@ -107,7 +108,7 @@ raw_tx_final = node.signrawtransactionwithwallet(node.createrawtransaction( inputs=[{'txid': coin['txid'], 'vout': coin['vout'], "sequence": 0xffffffff}], # SEQUENCE_FINAL - outputs=[{node.getnewaddress(): 0.025}], + outputs=[{node.getnewaddress(): 25000}], locktime=node.getblockcount() + 2000, # Can be anything ))['hex'] tx = FromHex(CTransaction(), raw_tx_final) @@ -137,7 +138,7 @@ node.sendrawtransaction(hexstring=tx.serialize().hex(), maxfeerate=0) # take original raw_tx_0 tx = FromHex(CTransaction(), raw_tx_0) - tx.vout[0].nValue -= int(4 * fee * COIN) # Set more fee + tx.vout[0].nValue -= int(4 * fee * XEC) # Set more fee # skip re-signing the tx self.check_mempool_result( result_expected=[{'txid': tx.rehash(), @@ -173,7 +174,7 @@ {'txid': txid_0, 'vout': 0}, {'txid': txid_1, 'vout': 0}, ], - outputs=[{node.getnewaddress(): 0.1}] + outputs=[{node.getnewaddress(): 100000}] ))['hex'] txid_spend_both = node.sendrawtransaction( hexstring=raw_tx_spend_both, maxfeerate=0) @@ -195,7 +196,7 @@ self.log.info('Create a signed "reference" tx for later use') raw_tx_reference = node.signrawtransactionwithwallet(node.createrawtransaction( inputs=[{'txid': txid_spend_both, 'vout': 0}], - outputs=[{node.getnewaddress(): 0.05}], + outputs=[{node.getnewaddress(): 50000}], ))['hex'] tx = FromHex(CTransaction(), raw_tx_reference) # Reference tx should be valid on itself diff --git a/test/functional/mempool_expiry.py b/test/functional/mempool_expiry.py --- a/test/functional/mempool_expiry.py +++ b/test/functional/mempool_expiry.py @@ -37,7 +37,7 @@ # Send a parent transaction that will expire. parent_address = node.getnewaddress() - parent_txid = node.sendtoaddress(parent_address, 1.0) + parent_txid = node.sendtoaddress(parent_address, 1000000) # Set the mocktime to the arrival time of the parent transaction. entry_time = node.getmempoolentry(parent_txid)['time'] @@ -46,7 +46,7 @@ # Create child transaction spending the parent transaction vout = find_vout_for_address(node, parent_txid, parent_address) inputs = [{'txid': parent_txid, 'vout': vout}] - outputs = {node.getnewaddress(): 0.99} + outputs = {node.getnewaddress(): 990000} child_raw = node.createrawtransaction(inputs, outputs) child_signed = node.signrawtransactionwithwallet(child_raw)['hex'] @@ -63,7 +63,7 @@ node.setmocktime(nearly_expiry_time) # Expiry of mempool transactions is only checked when a new transaction # is added to the to the mempool. - node.sendtoaddress(node.getnewaddress(), 1.0) + node.sendtoaddress(node.getnewaddress(), 1000000) self.log.info('Test parent tx not expired after {} hours.'.format( timedelta(seconds=(nearly_expiry_time - entry_time)))) assert_equal(entry_time, node.getmempoolentry(parent_txid)['time']) @@ -74,7 +74,7 @@ node.setmocktime(expiry_time) # Expiry of mempool transactions is only checked when a new transaction # is added to the to the mempool. - node.sendtoaddress(node.getnewaddress(), 1.0) + node.sendtoaddress(node.getnewaddress(), 1000000) self.log.info('Test parent tx expiry after {} hours.'.format( timedelta(seconds=(expiry_time - entry_time)))) assert_raises_rpc_error(-5, 'Transaction not in mempool', diff --git a/test/functional/mempool_limit.py b/test/functional/mempool_limit.py --- a/test/functional/mempool_limit.py +++ b/test/functional/mempool_limit.py @@ -37,9 +37,9 @@ self.log.info('Check that mempoolminfee is minrelytxfee') assert_equal(self.nodes[0].getmempoolinfo()[ - 'minrelaytxfee'], Decimal('0.00001000')) + 'minrelaytxfee'], Decimal('10.00')) assert_equal(self.nodes[0].getmempoolinfo()[ - 'mempoolminfee'], Decimal('0.00001000')) + 'mempoolminfee'], Decimal('10.00')) txids = [] utxo_groups = 4 @@ -48,7 +48,7 @@ self.log.info('Create a mempool tx that will be evicted') us0 = utxos.pop() inputs = [{"txid": us0["txid"], "vout": us0["vout"]}] - outputs = {self.nodes[0].getnewaddress(): 0.0001} + outputs = {self.nodes[0].getnewaddress(): 100} tx = self.nodes[0].createrawtransaction(inputs, outputs) # specifically fund this tx with low fee self.nodes[0].settxfee(relayfee) @@ -71,14 +71,14 @@ self.log.info('Check that mempoolminfee is larger than minrelytxfee') assert_equal(self.nodes[0].getmempoolinfo()[ - 'minrelaytxfee'], Decimal('0.00001000')) + 'minrelaytxfee'], Decimal('10.00')) assert_greater_than(self.nodes[0].getmempoolinfo()[ - 'mempoolminfee'], Decimal('0.00001000')) + 'mempoolminfee'], Decimal('10.00')) self.log.info('Create a mempool tx that will not pass mempoolminfee') us0 = utxos.pop() inputs = [{"txid": us0["txid"], "vout": us0["vout"]}] - outputs = {self.nodes[0].getnewaddress(): 0.0001} + outputs = {self.nodes[0].getnewaddress(): 100} tx = self.nodes[0].createrawtransaction(inputs, outputs) # specifically fund this tx with a fee < mempoolminfee, >= than # minrelaytxfee diff --git a/test/functional/mempool_packages.py b/test/functional/mempool_packages.py --- a/test/functional/mempool_packages.py +++ b/test/functional/mempool_packages.py @@ -6,7 +6,7 @@ from decimal import Decimal -from test_framework.messages import COIN +from test_framework.messages import XEC from test_framework.p2p import P2PTxInvStore from test_framework.test_framework import BitcoinTestFramework from test_framework.util import ( @@ -61,7 +61,7 @@ vout = utxo[0]['vout'] value = utxo[0]['amount'] - fee = Decimal("0.0001") + fee = Decimal("100") # MAX_ANCESTORS transactions off a confirmed tx should be fine chain = [] for i in range(MAX_ANCESTORS): @@ -102,7 +102,7 @@ assert_equal(mempool[x]['fees']['base'], mempool[x]['fee']) assert_equal(mempool[x]['fees']['modified'], mempool[x]['modifiedfee']) - assert_equal(mempool[x]['descendantfees'], descendant_fees * COIN) + assert_equal(mempool[x]['descendantfees'], descendant_fees * XEC) assert_equal(mempool[x]['fees']['descendant'], descendant_fees) descendant_size += mempool[x]['size'] assert_equal(mempool[x]['descendantsize'], descendant_size) @@ -110,7 +110,7 @@ # Check that ancestor calculations are correct assert_equal(mempool[x]['ancestorcount'], ancestor_count) - assert_equal(mempool[x]['ancestorfees'], ancestor_fees * COIN) + assert_equal(mempool[x]['ancestorfees'], ancestor_fees * XEC) assert_equal(mempool[x]['ancestorsize'], ancestor_size) ancestor_size -= mempool[x]['size'] ancestor_fees -= mempool[x]['fee'] @@ -174,9 +174,9 @@ for x in chain: ancestor_fees += mempool[x]['fee'] assert_equal(mempool[x]['fees']['ancestor'], - ancestor_fees + Decimal('0.00001')) + ancestor_fees + Decimal('10.00')) assert_equal(mempool[x]['ancestorfees'], - ancestor_fees * COIN + 1000) + ancestor_fees * XEC + 1000) # Undo the prioritisetransaction for later tests self.nodes[0].prioritisetransaction(txid=chain[0], fee_delta=-1000) @@ -190,9 +190,9 @@ for x in reversed(chain): descendant_fees += mempool[x]['fee'] assert_equal(mempool[x]['fees']['descendant'], - descendant_fees + Decimal('0.00001')) + descendant_fees + Decimal('10.00')) assert_equal(mempool[x]['descendantfees'], - descendant_fees * COIN + 1000) + descendant_fees * XEC + 1000) # Adding one more transaction on to the chain should fail. assert_raises_rpc_error(-26, "too-long-mempool-chain", @@ -219,13 +219,13 @@ descendant_fees += mempool[x]['fee'] if (x == chain[-1]): assert_equal(mempool[x]['modifiedfee'], - mempool[x]['fee'] + satoshi_round(0.00002)) + mempool[x]['fee'] + satoshi_round(20.00)) assert_equal(mempool[x]['fees']['modified'], - mempool[x]['fee'] + satoshi_round(0.00002)) + mempool[x]['fee'] + satoshi_round(20.00)) assert_equal(mempool[x]['descendantfees'], - descendant_fees * COIN + 2000) + descendant_fees * XEC + 2000) assert_equal(mempool[x]['fees']['descendant'], - descendant_fees + satoshi_round(0.00002)) + descendant_fees + satoshi_round(20.00)) # Check that node1's mempool is as expected (-> custom ancestor limit) mempool0 = self.nodes[0].getrawmempool(False) diff --git a/test/functional/mempool_persist.py b/test/functional/mempool_persist.py --- a/test/functional/mempool_persist.py +++ b/test/functional/mempool_persist.py @@ -79,7 +79,7 @@ assert_equal(fees['base'], fees['modified']) self.nodes[0].prioritisetransaction(txid=last_txid, fee_delta=1000) fees = self.nodes[0].getmempoolentry(txid=last_txid)['fees'] - assert_equal(fees['base'] + Decimal('0.00001000'), fees['modified']) + assert_equal(fees['base'] + Decimal('10.0'), fees['modified']) tx_creation_time = self.nodes[0].getmempoolentry(txid=last_txid)[ 'time'] @@ -91,7 +91,7 @@ assert(len(self.nodes[0].getpeerinfo()) == 0) assert(len(self.nodes[0].p2ps) == 0) self.nodes[0].sendtoaddress( - self.nodes[2].getnewaddress(), Decimal("12")) + self.nodes[2].getnewaddress(), Decimal("12000000")) connect_nodes(self.nodes[0], self.nodes[2]) self.log.debug("Stop-start the nodes. Verify that node0 has the " @@ -116,7 +116,7 @@ self.log.debug('Verify prioritization is loaded correctly') fees = self.nodes[0].getmempoolentry(txid=last_txid)['fees'] - assert_equal(fees['base'] + Decimal('0.00001000'), fees['modified']) + assert_equal(fees['base'] + Decimal('10.00'), fees['modified']) self.log.debug('Verify time is loaded correctly') assert_equal( diff --git a/test/functional/mempool_reorg.py b/test/functional/mempool_reorg.py --- a/test/functional/mempool_reorg.py +++ b/test/functional/mempool_reorg.py @@ -48,11 +48,11 @@ 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_raw_transaction( - self.nodes[0], coinbase_txids[1], node1_address, amount=49.99) + self.nodes[0], coinbase_txids[1], node1_address, amount=49990000) spend_102_raw = create_raw_transaction( - self.nodes[0], coinbase_txids[2], node0_address, amount=49.99) + self.nodes[0], coinbase_txids[2], node0_address, amount=49990000) spend_103_raw = create_raw_transaction( - self.nodes[0], coinbase_txids[3], node0_address, amount=49.99) + self.nodes[0], coinbase_txids[3], node0_address, amount=49990000) # Create a transaction which is time-locked to two blocks in the future timelock_tx = self.nodes[0].createrawtransaction( @@ -60,7 +60,7 @@ "txid": coinbase_txids[0], "vout": 0 }], - outputs={node0_address: 49.99}, + outputs={node0_address: 49990000}, locktime=self.nodes[0].getblockcount() + 2, ) timelock_tx = self.nodes[0].signrawtransactionwithwallet(timelock_tx)[ @@ -80,9 +80,9 @@ # Create 102_1 and 103_1: spend_102_1_raw = create_raw_transaction( - self.nodes[0], spend_102_id, node1_address, amount=49.98) + self.nodes[0], spend_102_id, node1_address, amount=49980000) spend_103_1_raw = create_raw_transaction( - self.nodes[0], spend_103_id, node1_address, amount=49.98) + self.nodes[0], spend_103_id, node1_address, amount=49980000) # Broadcast and mine 103_1: spend_103_1_id = self.nodes[0].sendrawtransaction(spend_103_1_raw) diff --git a/test/functional/mempool_resurrect.py b/test/functional/mempool_resurrect.py --- a/test/functional/mempool_resurrect.py +++ b/test/functional/mempool_resurrect.py @@ -30,7 +30,7 @@ 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_raw_transaction(self.nodes[0], txid, node0_address, amount=49.99) + spends1_raw = [create_raw_transaction(self.nodes[0], txid, node0_address, amount=49990000) for txid in coinbase_txids] spends1_id = [self.nodes[0].sendrawtransaction(tx) for tx in spends1_raw] @@ -38,7 +38,7 @@ blocks = [] blocks.extend(self.nodes[0].generate(1)) - spends2_raw = [create_raw_transaction(self.nodes[0], txid, node0_address, amount=49.98) + spends2_raw = [create_raw_transaction(self.nodes[0], txid, node0_address, amount=49980000) for txid in spends1_id] spends2_id = [self.nodes[0].sendrawtransaction(tx) for tx in spends2_raw] diff --git a/test/functional/mempool_spend_coinbase.py b/test/functional/mempool_spend_coinbase.py --- a/test/functional/mempool_spend_coinbase.py +++ b/test/functional/mempool_spend_coinbase.py @@ -34,7 +34,7 @@ # 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_raw_transaction(self.nodes[0], txid, node0_address, amount=49.99) + spends_raw = [create_raw_transaction(self.nodes[0], txid, node0_address, amount=49990000) for txid in coinbase_txids] spend_101_id = self.nodes[0].sendrawtransaction(spends_raw[0]) diff --git a/test/functional/mempool_unbroadcast.py b/test/functional/mempool_unbroadcast.py --- a/test/functional/mempool_unbroadcast.py +++ b/test/functional/mempool_unbroadcast.py @@ -45,13 +45,13 @@ # generate a wallet txn addr = node.getnewaddress() - wallet_tx_hsh = node.sendtoaddress(addr, 0.0001) + wallet_tx_hsh = node.sendtoaddress(addr, 100) utxos = node.listunspent() # generate a txn using sendrawtransaction us0 = utxos.pop() inputs = [{"txid": us0["txid"], "vout": us0["vout"]}] - outputs = {addr: 0.0001} + outputs = {addr: 100} tx = node.createrawtransaction(inputs, outputs) node.settxfee(min_relay_fee) txF = node.fundrawtransaction(tx) @@ -110,7 +110,7 @@ # any GETDATAs & thus the transaction will remain in the unbroadcast # set. addr = node.getnewaddress() - txhsh = node.sendtoaddress(addr, 0.0001) + txhsh = node.sendtoaddress(addr, 100) # check transaction was removed from unbroadcast set due to presence in # a block diff --git a/test/functional/mempool_updatefromblock.py b/test/functional/mempool_updatefromblock.py --- a/test/functional/mempool_updatefromblock.py +++ b/test/functional/mempool_updatefromblock.py @@ -25,7 +25,7 @@ def transaction_graph_test(self, size, n_tx_to_mine=None, start_input_txid='', end_address='', - fee=Decimal(0.00100000)): + fee=Decimal(1000)): """Create an acyclic tournament (a type of directed graph) of transactions and use it for testing. @@ -84,7 +84,7 @@ (inputs_value - fee) / Decimal(n_outputs)).quantize( - Decimal('0.00000001')) + Decimal('0.01')) outputs = {} for n in range(0, n_outputs): outputs[self.nodes[0].getnewaddress()] = output_value @@ -92,7 +92,7 @@ output_value = ( inputs_value - fee).quantize( - Decimal('0.00000001')) + Decimal('0.01')) outputs = {end_address: output_value} self.log.debug('output_value={}'.format(output_value)) diff --git a/test/functional/mining_getblocktemplate_longpoll.py b/test/functional/mining_getblocktemplate_longpoll.py --- a/test/functional/mining_getblocktemplate_longpoll.py +++ b/test/functional/mining_getblocktemplate_longpoll.py @@ -81,7 +81,7 @@ # min_relay_fee is fee per 1000 bytes, which should be more than # enough. (txid, txhex, fee) = random_transaction(self.nodes, - Decimal("1.1"), min_relay_fee, Decimal("0.001"), 20) + Decimal("1100000"), min_relay_fee, Decimal("1000"), 20) # after one minute, every 10 seconds the mempool is probed, so in 80 # seconds it should have returned thr.join(60 + 20) diff --git a/test/functional/p2p_blocksonly.py b/test/functional/p2p_blocksonly.py --- a/test/functional/p2p_blocksonly.py +++ b/test/functional/p2p_blocksonly.py @@ -29,8 +29,8 @@ 'vout': 0 }], outputs=[{ - self.nodes[0].get_deterministic_priv_key().address: 50 - - 0.00125 + self.nodes[0].get_deterministic_priv_key().address: 50000000 - + 1250.00 }], ) self.log.info(prevtx) diff --git a/test/functional/p2p_compactblocks.py b/test/functional/p2p_compactblocks.py --- a/test/functional/p2p_compactblocks.py +++ b/test/functional/p2p_compactblocks.py @@ -317,7 +317,7 @@ address = node.getnewaddress() for i in range(num_transactions): - txid = node.sendtoaddress(address, 0.1) + txid = node.sendtoaddress(address, 100000) hex_tx = node.gettransaction(txid)["hex"] tx = FromHex(CTransaction(), hex_tx) diff --git a/test/functional/p2p_eviction.py b/test/functional/p2p_eviction.py --- a/test/functional/p2p_eviction.py +++ b/test/functional/p2p_eviction.py @@ -85,7 +85,7 @@ rawtx = node.createrawtransaction( inputs=[{'txid': prevtx['txid'], 'vout': 0}], outputs=[ - {node.get_deterministic_priv_key().address: 50 - 0.00125}], + {node.get_deterministic_priv_key().address: 50000000 - 1250.00}], ) sigtx = node.signrawtransactionwithkey( hexstring=rawtx, diff --git a/test/functional/p2p_feefilter.py b/test/functional/p2p_feefilter.py --- a/test/functional/p2p_feefilter.py +++ b/test/functional/p2p_feefilter.py @@ -65,8 +65,8 @@ # mempool and wallet feerate calculation based on GetFee # rounding down 3 places, leading to stranded transactions. # See issue #16499 - self.extra_args = [["-minrelaytxfee=0.00000100", - "-mintxfee=0.00000100"]] * self.num_nodes + self.extra_args = [["-minrelaytxfee=1", + "-mintxfee=1"]] * self.num_nodes def skip_test_if_missing_module(self): self.skip_if_no_wallet() @@ -99,8 +99,8 @@ # Test that invs are received by test connection for all txs at # feerate of .2 sat/byte - node1.settxfee(Decimal("0.00000200")) - txids = [node1.sendtoaddress(node1.getnewaddress(), 1) + node1.settxfee(Decimal("2")) + txids = [node1.sendtoaddress(node1.getnewaddress(), 1000000) for x in range(3)] assert allInvsMatch(txids, conn) conn.clear_invs() @@ -110,16 +110,16 @@ # Test that txs are still being received by test connection # (paying .15 sat/byte) - node1.settxfee(Decimal("0.00000150")) - txids = [node1.sendtoaddress(node1.getnewaddress(), 1) + node1.settxfee(Decimal("1.5")) + txids = [node1.sendtoaddress(node1.getnewaddress(), 1000000) for x in range(3)] assert allInvsMatch(txids, conn) conn.clear_invs() # Change tx fee rate to .1 sat/byte and test they are no longer received # by the test connection - node1.settxfee(Decimal("0.00000100")) - [node1.sendtoaddress(node1.getnewaddress(), 1) for x in range(3)] + node1.settxfee(Decimal("1")) + [node1.sendtoaddress(node1.getnewaddress(), 1000000) for x in range(3)] self.sync_mempools() # must be sure node 0 has received all txs # Send one transaction from node0 that should be received, so that we @@ -129,14 +129,14 @@ # to 35 entries in an inv, which means that when this next transaction # is eligible for relay, the prior transactions from node1 are eligible # as well. - node0.settxfee(Decimal("0.00020000")) - txids = [node0.sendtoaddress(node0.getnewaddress(), 1)] + node0.settxfee(Decimal("200.00")) + txids = [node0.sendtoaddress(node0.getnewaddress(), 1000000)] assert allInvsMatch(txids, conn) conn.clear_invs() # Remove fee filter and check that txs are received again conn.send_and_ping(msg_feefilter(0)) - txids = [node1.sendtoaddress(node1.getnewaddress(), 1) + txids = [node1.sendtoaddress(node1.getnewaddress(), 1000000) for x in range(3)] assert allInvsMatch(txids, conn) conn.clear_invs() diff --git a/test/functional/p2p_inv_download.py b/test/functional/p2p_inv_download.py --- a/test/functional/p2p_inv_download.py +++ b/test/functional/p2p_inv_download.py @@ -165,7 +165,7 @@ "txid": self.nodes[0].getblock(self.nodes[0].getblockhash(1))['tx'][0], "vout": 0 }], - outputs={ADDRESS_BCHREG_UNSPENDABLE: 50 - 0.00025}, + outputs={ADDRESS_BCHREG_UNSPENDABLE: 50000000 - 250.00}, ) tx = self.nodes[0].signrawtransactionwithkey( hexstring=tx, diff --git a/test/functional/p2p_leak_tx.py b/test/functional/p2p_leak_tx.py --- a/test/functional/p2p_leak_tx.py +++ b/test/functional/p2p_leak_tx.py @@ -36,7 +36,7 @@ self.log.info("Running test up to {} times.".format(MAX_REPEATS)) for i in range(MAX_REPEATS): self.log.info('Run repeat {}'.format(i + 1)) - txid = gen_node.sendtoaddress(gen_node.getnewaddress(), 0.01) + txid = gen_node.sendtoaddress(gen_node.getnewaddress(), 10000) want_tx = msg_getdata() want_tx.inv.append(CInv(t=MSG_TX, h=int(txid, 16))) diff --git a/test/functional/rpc_blockchain.py b/test/functional/rpc_blockchain.py --- a/test/functional/rpc_blockchain.py +++ b/test/functional/rpc_blockchain.py @@ -233,7 +233,7 @@ node = self.nodes[0] res = node.gettxoutsetinfo() - assert_equal(res['total_amount'], Decimal('8725.00000000')) + assert_equal(res['total_amount'], Decimal('8725000000.00')) assert_equal(res['transactions'], 200) assert_equal(res['height'], 200) assert_equal(res['txouts'], 200) diff --git a/test/functional/rpc_createmultisig.py b/test/functional/rpc_createmultisig.py --- a/test/functional/rpc_createmultisig.py +++ b/test/functional/rpc_createmultisig.py @@ -120,7 +120,7 @@ height = node0.getblockchaininfo()["blocks"] assert 150 < height < 350 - total = 149 * 50 + (height - 149 - 100) * 25 + total = 149 * 50000000 + (height - 149 - 100) * 25000000 assert bal1 == 0 assert bal2 == self.moved assert bal0 + bal1 + bal2 == total @@ -147,7 +147,7 @@ assert maddw == madd assert mredeemw == mredeem - txid = node0.sendtoaddress(madd, 40) + txid = node0.sendtoaddress(madd, 40000000) tx = node0.getrawtransaction(txid, True) vout = [v["n"] for v in tx["vout"] @@ -161,7 +161,7 @@ node0.generate(1) - outval = value - decimal.Decimal("0.00001000") + outval = value - decimal.Decimal("10.00") rawtx = node2.createrawtransaction( [{"txid": txid, "vout": vout}], [{self.final: outval}]) diff --git a/test/functional/rpc_estimatefee.py b/test/functional/rpc_estimatefee.py --- a/test/functional/rpc_estimatefee.py +++ b/test/functional/rpc_estimatefee.py @@ -15,8 +15,8 @@ self.num_nodes = 3 self.extra_args = [ [], - ["-minrelaytxfee=0.001"], - ["-mintxfee=0.00002", "-maxtxfee=0.000025"], + ["-minrelaytxfee=1000"], + ["-mintxfee=20", "-maxtxfee=25"], ] def skip_test_if_missing_module(self): @@ -30,19 +30,19 @@ self.nodes[0].generate(1) # estimatefee is 0.00001 by default, regardless of block contents - assert_equal(default_node.estimatefee(), Decimal('0.00001')) + assert_equal(default_node.estimatefee(), Decimal('10.00')) # estimatefee may be different for nodes that set it in their # config - assert_equal(diff_relay_fee_node.estimatefee(), Decimal('0.001')) + assert_equal(diff_relay_fee_node.estimatefee(), Decimal('1000.00')) # Check the reasonableness of settxfee assert_raises_rpc_error(-8, "txfee cannot be less than min relay tx fee", - diff_tx_fee_node.settxfee, Decimal('0.000005')) + diff_tx_fee_node.settxfee, Decimal('5.00')) assert_raises_rpc_error(-8, "txfee cannot be less than wallet min fee", - diff_tx_fee_node.settxfee, Decimal('0.000015')) + diff_tx_fee_node.settxfee, Decimal('15.00')) assert_raises_rpc_error(-8, "txfee cannot be more than wallet max tx fee", - diff_tx_fee_node.settxfee, Decimal('0.00003')) + diff_tx_fee_node.settxfee, Decimal('30.00')) if __name__ == '__main__': diff --git a/test/functional/rpc_fundrawtransaction.py b/test/functional/rpc_fundrawtransaction.py --- a/test/functional/rpc_fundrawtransaction.py +++ b/test/functional/rpc_fundrawtransaction.py @@ -100,7 +100,7 @@ handled properly.""" self.log.info("Test fundrawtxn changePosition option") rawmatch = self.nodes[2].createrawtransaction( - [], {self.nodes[2].getnewaddress(): 50}) + [], {self.nodes[2].getnewaddress(): 50000000}) rawmatch = self.nodes[2].fundrawtransaction( rawmatch, {"changePosition": 1, "subtractFeeFromOutputs": [0]}) assert_equal(rawmatch["changepos"], -1) @@ -108,7 +108,7 @@ watchonly_address = self.nodes[0].getnewaddress() watchonly_pubkey = self.nodes[0].getaddressinfo(watchonly_address)[ "pubkey"] - self.watchonly_amount = Decimal(200) + self.watchonly_amount = Decimal(200000000) self.nodes[3].importpubkey(watchonly_pubkey, "", True) self.watchonly_txid = self.nodes[0].sendtoaddress( watchonly_address, self.watchonly_amount) @@ -123,9 +123,9 @@ self.nodes[3].getnewaddress(), self.watchonly_amount / 10) - self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), 1.5) - self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), 1.0) - self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), 5.0) + self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), 1500000) + self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), 1000000) + self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), 5000000) self.nodes[0].generate(1) self.sync_all() @@ -133,7 +133,7 @@ def test_simple(self): self.log.info("Test fundrawtxn") inputs = [] - outputs = {self.nodes[0].getnewaddress(): 1.0} + outputs = {self.nodes[0].getnewaddress(): 1000000} rawTx = self.nodes[2].createrawtransaction(inputs, outputs) dec_tx = self.nodes[2].decoderawtransaction(rawTx) rawtxfund = self.nodes[2].fundrawtransaction(rawTx) @@ -144,7 +144,7 @@ def test_simple_two_coins(self): self.log.info("Test fundrawtxn with 2 coins") inputs = [] - outputs = {self.nodes[0].getnewaddress(): 2.2} + outputs = {self.nodes[0].getnewaddress(): 2200000} rawTx = self.nodes[2].createrawtransaction(inputs, outputs) dec_tx = self.nodes[2].decoderawtransaction(rawTx) @@ -158,7 +158,7 @@ self.log.info("Test fundrawtxn with 2 outputs") inputs = [] outputs = { - self.nodes[0].getnewaddress(): 2.6, self.nodes[1].getnewaddress(): 2.5} + self.nodes[0].getnewaddress(): 2600000, self.nodes[1].getnewaddress(): 2500000} rawTx = self.nodes[2].createrawtransaction(inputs, outputs) dec_tx = self.nodes[2].decoderawtransaction(rawTx) @@ -173,10 +173,10 @@ def test_change(self): self.log.info("Test fundrawtxn with a vin > required amount") - utx = get_unspent(self.nodes[2].listunspent(), 5) + utx = get_unspent(self.nodes[2].listunspent(), 5000000) inputs = [{'txid': utx['txid'], 'vout': utx['vout']}] - outputs = {self.nodes[0].getnewaddress(): 1.0} + outputs = {self.nodes[0].getnewaddress(): 1000000} rawTx = self.nodes[2].createrawtransaction(inputs, outputs) dec_tx = self.nodes[2].decoderawtransaction(rawTx) assert_equal(utx['txid'], dec_tx['vin'][0]['txid']) @@ -195,11 +195,11 @@ def test_no_change(self): self.log.info("Test fundrawtxn not having a change output") - utx = get_unspent(self.nodes[2].listunspent(), 5) + utx = get_unspent(self.nodes[2].listunspent(), 5000000) inputs = [{'txid': utx['txid'], 'vout': utx['vout']}] outputs = { - self.nodes[0].getnewaddress(): Decimal(5.0) - + self.nodes[0].getnewaddress(): Decimal(5000000) - self.test_no_change_fee - self.fee_tolerance} rawTx = self.nodes[2].createrawtransaction(inputs, outputs) @@ -219,10 +219,10 @@ def test_invalid_option(self): self.log.info("Test fundrawtxn with an invalid option") - utx = get_unspent(self.nodes[2].listunspent(), 5) + utx = get_unspent(self.nodes[2].listunspent(), 5000000) inputs = [{'txid': utx['txid'], 'vout': utx['vout']}] - outputs = {self.nodes[0].getnewaddress(): Decimal(4.0)} + outputs = {self.nodes[0].getnewaddress(): Decimal(4000000)} rawTx = self.nodes[2].createrawtransaction(inputs, outputs) dec_tx = self.nodes[2].decoderawtransaction(rawTx) assert_equal(utx['txid'], dec_tx['vin'][0]['txid']) @@ -237,10 +237,10 @@ def test_invalid_change_address(self): self.log.info("Test fundrawtxn with an invalid change address") - utx = get_unspent(self.nodes[2].listunspent(), 5) + utx = get_unspent(self.nodes[2].listunspent(), 5000000) inputs = [{'txid': utx['txid'], 'vout': utx['vout']}] - outputs = {self.nodes[0].getnewaddress(): Decimal(4.0)} + outputs = {self.nodes[0].getnewaddress(): Decimal(4000000)} rawTx = self.nodes[2].createrawtransaction(inputs, outputs) dec_tx = self.nodes[2].decoderawtransaction(rawTx) assert_equal(utx['txid'], dec_tx['vin'][0]['txid']) @@ -251,10 +251,10 @@ def test_valid_change_address(self): self.log.info("Test fundrawtxn with a provided change address") - utx = get_unspent(self.nodes[2].listunspent(), 5) + utx = get_unspent(self.nodes[2].listunspent(), 5000000) inputs = [{'txid': utx['txid'], 'vout': utx['vout']}] - outputs = {self.nodes[0].getnewaddress(): Decimal(4.0)} + outputs = {self.nodes[0].getnewaddress(): Decimal(4000000)} rawTx = self.nodes[2].createrawtransaction(inputs, outputs) dec_tx = self.nodes[2].decoderawtransaction(rawTx) assert_equal(utx['txid'], dec_tx['vin'][0]['txid']) @@ -270,10 +270,10 @@ def test_coin_selection(self): self.log.info("Test fundrawtxn with a vin < required amount") - utx = get_unspent(self.nodes[2].listunspent(), 1) + utx = get_unspent(self.nodes[2].listunspent(), 1000000) inputs = [{'txid': utx['txid'], 'vout': utx['vout']}] - outputs = {self.nodes[0].getnewaddress(): 1.0} + outputs = {self.nodes[0].getnewaddress(): 1000000} rawTx = self.nodes[2].createrawtransaction(inputs, outputs) # 4-byte version + 1-byte vin count + 36-byte prevout then script_len @@ -310,12 +310,12 @@ def test_two_vin(self): self.log.info("Test fundrawtxn with 2 vins") - utx = get_unspent(self.nodes[2].listunspent(), 1) - utx2 = get_unspent(self.nodes[2].listunspent(), 5) + utx = get_unspent(self.nodes[2].listunspent(), 1000000) + utx2 = get_unspent(self.nodes[2].listunspent(), 5000000) inputs = [{'txid': utx['txid'], 'vout': utx['vout']}, {'txid': utx2['txid'], 'vout': utx2['vout']}] - outputs = {self.nodes[0].getnewaddress(): 6.0} + outputs = {self.nodes[0].getnewaddress(): 6000000} rawTx = self.nodes[2].createrawtransaction(inputs, outputs) dec_tx = self.nodes[2].decoderawtransaction(rawTx) assert_equal(utx['txid'], dec_tx['vin'][0]['txid']) @@ -351,13 +351,13 @@ def test_two_vin_two_vout(self): self.log.info("Test fundrawtxn with 2 vins and 2 vouts") - utx = get_unspent(self.nodes[2].listunspent(), 1) - utx2 = get_unspent(self.nodes[2].listunspent(), 5) + utx = get_unspent(self.nodes[2].listunspent(), 1000000) + utx2 = get_unspent(self.nodes[2].listunspent(), 5000000) inputs = [{'txid': utx['txid'], 'vout': utx['vout']}, {'txid': utx2['txid'], 'vout': utx2['vout']}] outputs = { - self.nodes[0].getnewaddress(): 6.0, self.nodes[0].getnewaddress(): 1.0} + self.nodes[0].getnewaddress(): 6000000, self.nodes[0].getnewaddress(): 1000000} rawTx = self.nodes[2].createrawtransaction(inputs, outputs) dec_tx = self.nodes[2].decoderawtransaction(rawTx) assert_equal(utx['txid'], dec_tx['vin'][0]['txid']) @@ -386,7 +386,7 @@ self.log.info("Test fundrawtxn with an invalid vin") inputs = [ {'txid': "1c7f966dab21119bac53213a2bc7532bff1fa844c124fd750a7d0b1332440bd1", 'vout': 0}] - outputs = {self.nodes[0].getnewaddress(): 1.0} + outputs = {self.nodes[0].getnewaddress(): 1000000} rawTx = self.nodes[2].createrawtransaction(inputs, outputs) assert_raises_rpc_error( @@ -396,12 +396,13 @@ """Compare fee of a standard pubkeyhash transaction.""" self.log.info("Test fundrawtxn p2pkh fee") inputs = [] - outputs = {self.nodes[1].getnewaddress(): 1.1} + outputs = {self.nodes[1].getnewaddress(): 1100000} rawTx = self.nodes[0].createrawtransaction(inputs, outputs) fundedTx = self.nodes[0].fundrawtransaction(rawTx) # Create same transaction over sendtoaddress. - txId = self.nodes[0].sendtoaddress(self.nodes[1].getnewaddress(), 1.1) + txId = self.nodes[0].sendtoaddress( + self.nodes[1].getnewaddress(), 1100000) signedFee = self.nodes[0].getrawmempool(True)[txId]['fee'] # Compare fee. @@ -414,12 +415,12 @@ self.log.info("Test fundrawtxn p2pkh fee with multiple outputs") inputs = [] outputs = { - self.nodes[1].getnewaddress(): 1.1, - self.nodes[1].getnewaddress(): 1.2, - self.nodes[1].getnewaddress(): 0.1, - self.nodes[1].getnewaddress(): 1.3, - self.nodes[1].getnewaddress(): 0.2, - self.nodes[1].getnewaddress(): 0.3, + self.nodes[1].getnewaddress(): 1100000, + self.nodes[1].getnewaddress(): 1200000, + self.nodes[1].getnewaddress(): 100000, + self.nodes[1].getnewaddress(): 1300000, + self.nodes[1].getnewaddress(): 200000, + self.nodes[1].getnewaddress(): 300000, } rawtx = self.nodes[0].createrawtransaction(inputs, outputs) fundedTx = self.nodes[0].fundrawtransaction(rawtx) @@ -444,12 +445,12 @@ 2, [addr1Obj['pubkey'], addr2Obj['pubkey']])['address'] inputs = [] - outputs = {mSigObj: 1.1} + outputs = {mSigObj: 1100000} rawTx = self.nodes[0].createrawtransaction(inputs, outputs) fundedTx = self.nodes[0].fundrawtransaction(rawTx) # Create same transaction over sendtoaddress. - txId = self.nodes[0].sendtoaddress(mSigObj, 1.1) + txId = self.nodes[0].sendtoaddress(mSigObj, 1100000) signedFee = self.nodes[0].getrawmempool(True)[txId]['fee'] # Compare fee. @@ -485,12 +486,12 @@ )['address'] inputs = [] - outputs = {mSigObj: 1.1} + outputs = {mSigObj: 1100000} rawTx = self.nodes[0].createrawtransaction(inputs, outputs) fundedTx = self.nodes[0].fundrawtransaction(rawTx) # Create same transaction over sendtoaddress. - txId = self.nodes[0].sendtoaddress(mSigObj, 1.1) + txId = self.nodes[0].sendtoaddress(mSigObj, 1100000) signedFee = self.nodes[0].getrawmempool(True)[txId]['fee'] # Compare fee. @@ -517,13 +518,13 @@ )['address'] # Send 1.2 BCH to msig addr. - self.nodes[0].sendtoaddress(mSigObj, 1.2) + self.nodes[0].sendtoaddress(mSigObj, 1200000) self.nodes[0].generate(1) self.sync_all() oldBalance = self.nodes[1].getbalance() inputs = [] - outputs = {self.nodes[1].getnewaddress(): 1.1} + outputs = {self.nodes[1].getnewaddress(): 1100000} rawTx = self.nodes[2].createrawtransaction(inputs, outputs) fundedTx = self.nodes[2].fundrawtransaction(rawTx) @@ -534,7 +535,7 @@ # Make sure funds are received at node1. assert_equal( - oldBalance + Decimal('1.10000000'), self.nodes[1].getbalance()) + oldBalance + Decimal('1100000.00'), self.nodes[1].getbalance()) def test_locked_wallet(self): self.log.info("Test fundrawtxn with locked wallet") @@ -545,7 +546,7 @@ self.nodes[1].getnewaddress() self.nodes[1].getrawchangeaddress() inputs = [] - outputs = {self.nodes[0].getnewaddress(): 1.09999700} + outputs = {self.nodes[0].getnewaddress(): 1099997.00} rawtx = self.nodes[1].createrawtransaction(inputs, outputs) # fund a transaction that does not require a new key for the change # output @@ -553,7 +554,7 @@ # fund a transaction that requires a new key for the change output # creating the key must be impossible because the wallet is locked - outputs = {self.nodes[0].getnewaddress(): 1.1} + outputs = {self.nodes[0].getnewaddress(): 1100000} rawtx = self.nodes[1].createrawtransaction(inputs, outputs) assert_raises_rpc_error( -4, @@ -568,12 +569,12 @@ self.nodes[1].walletlock() assert_raises_rpc_error(-13, "walletpassphrase", self.nodes[ - 1].sendtoaddress, self.nodes[0].getnewaddress(), 1.2) + 1].sendtoaddress, self.nodes[0].getnewaddress(), 1200000) oldBalance = self.nodes[0].getbalance() inputs = [] - outputs = {self.nodes[0].getnewaddress(): 1.1} + outputs = {self.nodes[0].getnewaddress(): 1100000} rawTx = self.nodes[1].createrawtransaction(inputs, outputs) fundedTx = self.nodes[1].fundrawtransaction(rawTx) @@ -586,7 +587,7 @@ # Make sure funds are received at node1. assert_equal( - oldBalance + Decimal('51.10000000'), self.nodes[0].getbalance()) + oldBalance + Decimal('51100000.00'), self.nodes[0].getbalance()) def test_many_inputs_fee(self): """Multiple (~19) inputs tx test | Compare fee.""" @@ -599,14 +600,14 @@ self.sync_all() for _ in range(0, 20): - self.nodes[0].sendtoaddress(self.nodes[1].getnewaddress(), 0.01) + self.nodes[0].sendtoaddress(self.nodes[1].getnewaddress(), 10000) self.nodes[0].generate(1) self.sync_all() # Fund a tx with ~20 small inputs. inputs = [] outputs = { - self.nodes[0].getnewaddress(): 0.15, self.nodes[0].getnewaddress(): 0.04} + self.nodes[0].getnewaddress(): 150000, self.nodes[0].getnewaddress(): 40000} rawTx = self.nodes[1].createrawtransaction(inputs, outputs) fundedTx = self.nodes[1].fundrawtransaction(rawTx) @@ -630,7 +631,7 @@ self.sync_all() for _ in range(0, 20): - self.nodes[0].sendtoaddress(self.nodes[1].getnewaddress(), 0.01) + self.nodes[0].sendtoaddress(self.nodes[1].getnewaddress(), 10000) self.nodes[0].generate(1) self.sync_all() @@ -639,7 +640,7 @@ inputs = [] outputs = { - self.nodes[0].getnewaddress(): 0.15, self.nodes[0].getnewaddress(): 0.04} + self.nodes[0].getnewaddress(): 150000, self.nodes[0].getnewaddress(): 40000} rawTx = self.nodes[1].createrawtransaction(inputs, outputs) fundedTx = self.nodes[1].fundrawtransaction(rawTx) fundedAndSignedTx = self.nodes[1].signrawtransactionwithwallet( @@ -647,7 +648,7 @@ self.nodes[1].sendrawtransaction(fundedAndSignedTx['hex']) self.nodes[1].generate(1) self.sync_all() - assert_equal(oldBalance + Decimal('50.19000000'), + assert_equal(oldBalance + Decimal('50190000.00'), self.nodes[0].getbalance()) # 0.19+block reward def test_op_return(self): @@ -718,7 +719,7 @@ assert_equal(len(self.nodes[3].listunspent(1)), 1) inputs = [] - outputs = {self.nodes[3].getnewaddress(): 1} + outputs = {self.nodes[3].getnewaddress(): 1000000} rawTx = self.nodes[3].createrawtransaction(inputs, outputs) # uses self.min_relay_tx_fee (set by settxfee) result = self.nodes[3].fundrawtransaction(rawTx) @@ -735,7 +736,7 @@ "Fee exceeds maximum configured by -maxtxfee", self.nodes[3].fundrawtransaction, rawTx, - {"feeRate": 1}) + {"feeRate": 1000000}) # allow this transaction to be underfunded by 10 bytes. This is due # to the first transaction possibly being overfunded by up to .9 # satoshi due to fee ceilings being used. @@ -747,12 +748,12 @@ self.log.info("Test fundrawtxn does not reuse addresses") rawTx = self.nodes[3].createrawtransaction( - inputs=[], outputs={self.nodes[3].getnewaddress(): 1}) + inputs=[], outputs={self.nodes[3].getnewaddress(): 1000000}) result3 = self.nodes[3].fundrawtransaction(rawTx) res_dec = self.nodes[0].decoderawtransaction(result3["hex"]) changeaddress = "" for out in res_dec['vout']: - if out['value'] > 1.0: + if out['value'] > 1000000.0: changeaddress += out['scriptPubKey']['addresses'][0] assert changeaddress != "" nextaddr = self.nodes[3].getnewaddress() @@ -767,7 +768,7 @@ assert_equal(len(self.nodes[3].listunspent(1)), 1) inputs = [] - outputs = {self.nodes[2].getnewaddress(): 1} + outputs = {self.nodes[2].getnewaddress(): 1000000} rawTx = self.nodes[3].createrawtransaction(inputs, outputs) # uses self.min_relay_tx_fee (set by settxfee) @@ -802,7 +803,7 @@ inputs = [] outputs = { - self.nodes[2].getnewaddress(): value for value in (1.0, 1.1, 1.2, 1.3)} + self.nodes[2].getnewaddress(): value for value in (1000000.0, 1100000.0, 1200000.0, 1300000.0)} rawTx = self.nodes[3].createrawtransaction(inputs, outputs) # Split the fee between outputs 0, 2, and 3, but not output 1 @@ -848,11 +849,11 @@ "Test fundrawtxn subtract fee from outputs with preset inputs that are sufficient") addr = self.nodes[0].getnewaddress() - txid = self.nodes[0].sendtoaddress(addr, 10) + txid = self.nodes[0].sendtoaddress(addr, 10000000) vout = find_vout_for_address(self.nodes[0], txid, addr) rawtx = self.nodes[0].createrawtransaction([{'txid': txid, 'vout': vout}], [ - {self.nodes[0].getnewaddress(): 5}]) + {self.nodes[0].getnewaddress(): 5000000}]) fundedtx = self.nodes[0].fundrawtransaction( rawtx, {'subtractFeeFromOutputs': [0]}) signedtx = self.nodes[0].signrawtransactionwithwallet(fundedtx['hex']) diff --git a/test/functional/rpc_generateblock.py b/test/functional/rpc_generateblock.py --- a/test/functional/rpc_generateblock.py +++ b/test/functional/rpc_generateblock.py @@ -63,10 +63,10 @@ # Generate some extra mempool transactions to verify they don't get # mined for i in range(10): - node.sendtoaddress(address, 0.001) + node.sendtoaddress(address, 1000) self.log.info('Generate block with txid') - txid = node.sendtoaddress(address, 1) + txid = node.sendtoaddress(address, 1000000) hash = node.generateblock(address, [txid])['hash'] block = node.getblock(hash, 1) assert_equal(len(block['tx']), 2) @@ -75,7 +75,7 @@ self.log.info('Generate block with raw tx') utxos = node.listunspent(addresses=[address]) raw = node.createrawtransaction( - [{'txid': utxos[0]['txid'], 'vout':utxos[0]['vout']}], [{address: 1}]) + [{'txid': utxos[0]['txid'], 'vout':utxos[0]['vout']}], [{address: 1000000}]) signed_raw = node.signrawtransactionwithwallet(raw)['hex'] hash = node.generateblock(address, [signed_raw])['hash'] block = node.getblock(hash, 1) @@ -85,11 +85,11 @@ self.log.info('Fail to generate block with out of order txs') raw1 = node.createrawtransaction( - [{'txid': txid, 'vout': 0}], [{address: 0.9999}]) + [{'txid': txid, 'vout': 0}], [{address: 999900}]) signed_raw1 = node.signrawtransactionwithwallet(raw1)['hex'] txid1 = node.sendrawtransaction(signed_raw1) raw2 = node.createrawtransaction( - [{'txid': txid1, 'vout': 0}], [{address: 0.999}]) + [{'txid': txid1, 'vout': 0}], [{address: 999000}]) signed_raw2 = node.signrawtransactionwithwallet(raw2)['hex'] txid2 = node.sendrawtransaction(signed_raw2) # Reversed CTOR diff --git a/test/functional/rpc_getblockstats.py b/test/functional/rpc_getblockstats.py --- a/test/functional/rpc_getblockstats.py +++ b/test/functional/rpc_getblockstats.py @@ -58,23 +58,23 @@ address = self.nodes[0].get_deterministic_priv_key().address self.nodes[0].sendtoaddress( address=address, - amount=10, + amount=10000000, subtractfeefromamount=True) self.nodes[0].generate(1) self.sync_all() self.nodes[0].sendtoaddress( address=address, - amount=10, + amount=10000000, subtractfeefromamount=True) self.nodes[0].sendtoaddress( address=address, - amount=10, + amount=10000000, subtractfeefromamount=False) - self.nodes[0].settxfee(amount=0.003) + self.nodes[0].settxfee(amount=3000) self.nodes[0].sendtoaddress( address=address, - amount=1, + amount=1000000, subtractfeefromamount=True) self.sync_all() self.nodes[0].generate(1) diff --git a/test/functional/rpc_net.py b/test/functional/rpc_net.py --- a/test/functional/rpc_net.py +++ b/test/functional/rpc_net.py @@ -49,8 +49,8 @@ def set_test_params(self): self.setup_clean_chain = True self.num_nodes = 2 - self.extra_args = [["-minrelaytxfee=0.00001000"], - ["-minrelaytxfee=0.00000500"]] + self.extra_args = [["-minrelaytxfee=10"], + ["-minrelaytxfee=5"]] self.supports_cli = False def run_test(self): @@ -159,7 +159,7 @@ self.log.info("Test getpeerinfo") # Create a few getpeerinfo last_block/last_transaction values. if self.is_wallet_compiled(): - self.nodes[0].sendtoaddress(self.nodes[1].getnewaddress(), 1) + self.nodes[0].sendtoaddress(self.nodes[1].getnewaddress(), 1000000) self.nodes[1].generate(1) self.sync_all() time_now = int(time.time()) @@ -175,8 +175,8 @@ # other node assert_equal(peer_info[0][0]['addrbind'], peer_info[1][0]['addr']) assert_equal(peer_info[1][0]['addrbind'], peer_info[0][0]['addr']) - assert_equal(peer_info[0][0]['minfeefilter'], Decimal("0.00000500")) - assert_equal(peer_info[1][0]['minfeefilter'], Decimal("0.00001000")) + assert_equal(peer_info[0][0]['minfeefilter'], Decimal("5.00")) + assert_equal(peer_info[1][0]['minfeefilter'], Decimal("10.00")) # check the `servicesnames` field for info in peer_info: assert_net_servicesnames(int(info[0]["services"], 0x10), diff --git a/test/functional/rpc_psbt.py b/test/functional/rpc_psbt.py --- a/test/functional/rpc_psbt.py +++ b/test/functional/rpc_psbt.py @@ -33,7 +33,7 @@ def run_test(self): # Create and fund a raw tx for sending 10 BTC psbtx1 = self.nodes[0].walletcreatefundedpsbt( - [], {self.nodes[2].getnewaddress(): 10})['psbt'] + [], {self.nodes[2].getnewaddress(): 10000000})['psbt'] # If inputs are specified, do not automatically add more: utxo1 = self.nodes[0].listunspent()[0] @@ -42,10 +42,10 @@ self.nodes[0].walletcreatefundedpsbt, [{"txid": utxo1['txid'], "vout": utxo1['vout']}], - {self.nodes[2].getnewaddress(): 90}) + {self.nodes[2].getnewaddress(): 90000000}) psbtx1 = self.nodes[0].walletcreatefundedpsbt([{"txid": utxo1['txid'], "vout": utxo1['vout']}], { - self.nodes[2].getnewaddress(): 90}, 0, {"add_inputs": True})['psbt'] + self.nodes[2].getnewaddress(): 90000000}, 0, {"add_inputs": True})['psbt'] assert_equal(len(self.nodes[0].decodepsbt(psbtx1)['tx']['vin']), 2) # Node 1 should not be able to add anything to it but still return the @@ -70,7 +70,8 @@ p2pkh = self.nodes[1].getnewaddress("") # fund those addresses - rawtx = self.nodes[0].createrawtransaction([], {p2sh: 10, p2pkh: 10}) + rawtx = self.nodes[0].createrawtransaction( + [], {p2sh: 10000000, p2pkh: 10000000}) rawtx = self.nodes[0].fundrawtransaction(rawtx, {"changePosition": 0}) signed_tx = self.nodes[0].signrawtransactionwithwallet(rawtx['hex'])[ 'hex'] @@ -90,7 +91,7 @@ # spend single key from node 1 rawtx = self.nodes[1].walletcreatefundedpsbt([{"txid": txid, "vout": p2pkh_pos}], { - self.nodes[1].getnewaddress(): 9.99})['psbt'] + self.nodes[1].getnewaddress(): 9990000})['psbt'] walletprocesspsbt_out = self.nodes[1].walletprocesspsbt(rawtx) # Make sure it has UTXOs decoded = self.nodes[1].decodepsbt(walletprocesspsbt_out['psbt']) @@ -105,9 +106,9 @@ { "txid": txid, "vout": p2sh_pos}, { "txid": txid, "vout": p2pkh_pos}], { - self.nodes[1].getnewaddress(): 29.99}, 0, { - "feeRate": 0.1, "add_inputs": True}) - assert_approx(res["fee"], 0.065, 0.005) + self.nodes[1].getnewaddress(): 29990000}, 0, { + "feeRate": 100000, "add_inputs": True}) + assert_approx(res["fee"], 65000, 5000) # feeRate of 10 BCH / KB produces a total fee well above -maxtxfee # previously this was silently capped at -maxtxfee @@ -118,9 +119,9 @@ "vout": p2sh_pos}, {"txid": txid, "vout": p2pkh_pos}], - {self.nodes[1].getnewaddress(): 29.99}, + {self.nodes[1].getnewaddress(): 29990000}, 0, - {"feeRate": 10, + {"feeRate": 10000000, "add_inputs": True}) assert_raises_rpc_error(-4, "Fee exceeds maximum configured by -maxtxfee", @@ -129,14 +130,14 @@ "vout": p2sh_pos}, {"txid": txid, "vout": p2pkh_pos}], - {self.nodes[1].getnewaddress(): 1}, + {self.nodes[1].getnewaddress(): 1000000}, 0, - {"feeRate": 10, + {"feeRate": 10000000, "add_inputs": False}) # partially sign multisig things with node 1 psbtx = self.nodes[1].walletcreatefundedpsbt([{"txid": txid, "vout": p2sh_pos}], { - self.nodes[1].getnewaddress(): 9.99})['psbt'] + self.nodes[1].getnewaddress(): 9990000})['psbt'] walletprocesspsbt_out = self.nodes[1].walletprocesspsbt(psbtx) psbtx = walletprocesspsbt_out['psbt'] assert_equal(walletprocesspsbt_out['complete'], False) @@ -149,13 +150,13 @@ # check that walletprocesspsbt fails to decode a non-psbt rawtx = self.nodes[1].createrawtransaction([{"txid": txid, "vout": p2pkh_pos}], { - self.nodes[1].getnewaddress(): 9.99}) + self.nodes[1].getnewaddress(): 9990000}) assert_raises_rpc_error(-22, "TX decode failed", self.nodes[1].walletprocesspsbt, rawtx) # Convert a non-psbt to psbt and make sure we can decode it rawtx = self.nodes[0].createrawtransaction( - [], {self.nodes[1].getnewaddress(): 10}) + [], {self.nodes[1].getnewaddress(): 10000000}) rawtx = self.nodes[0].fundrawtransaction(rawtx) new_psbt = self.nodes[0].converttopsbt(rawtx['hex']) self.nodes[0].decodepsbt(new_psbt) @@ -182,16 +183,24 @@ # Create outputs to nodes 1 and 2 node1_addr = self.nodes[1].getnewaddress() node2_addr = self.nodes[2].getnewaddress() - txid1 = self.nodes[0].sendtoaddress(node1_addr, 13) - txid2 = self.nodes[0].sendtoaddress(node2_addr, 13) + txid1 = self.nodes[0].sendtoaddress(node1_addr, 13000000) + txid2 = self.nodes[0].sendtoaddress(node2_addr, 13000000) blockhash = self.nodes[0].generate(6)[0] self.sync_all() - vout1 = find_output(self.nodes[1], txid1, 13, blockhash=blockhash) - vout2 = find_output(self.nodes[2], txid2, 13, blockhash=blockhash) + vout1 = find_output( + self.nodes[1], + txid1, + 13000000, + blockhash=blockhash) + vout2 = find_output( + self.nodes[2], + txid2, + 13000000, + blockhash=blockhash) # Create a psbt spending outputs from nodes 1 and 2 psbt_orig = self.nodes[0].createpsbt([{"txid": txid1, "vout": vout1}, { - "txid": txid2, "vout": vout2}], {self.nodes[0].getnewaddress(): 25.999}) + "txid": txid2, "vout": vout2}], {self.nodes[0].getnewaddress(): 25999000}) # Update psbts, should only have data for one input and not the other psbt1 = self.nodes[1].walletprocesspsbt( @@ -225,7 +234,7 @@ # when attempting BnB coin selection self.nodes[0].walletcreatefundedpsbt( [], - [{self.nodes[2].getnewaddress():unspent["amount"] + 1}], + [{self.nodes[2].getnewaddress():unspent["amount"] + 1000000}], block_height + 2, {"changeAddress": self.nodes[1].getnewaddress()}, False) @@ -233,7 +242,7 @@ # Regression test for 14473 (mishandling of already-signed # transaction): psbtx_info = self.nodes[0].walletcreatefundedpsbt([{"txid": unspent["txid"], "vout":unspent["vout"]}], [ - {self.nodes[2].getnewaddress():unspent["amount"] + 1}], 0, {"add_inputs": True}) + {self.nodes[2].getnewaddress():unspent["amount"] + 1000000}], 0, {"add_inputs": True}) complete_psbt = self.nodes[0].walletprocesspsbt(psbtx_info["psbt"]) double_processed_psbt = self.nodes[0].walletprocesspsbt( complete_psbt["psbt"]) @@ -315,19 +324,19 @@ # Test that psbts with p2pkh outputs are created properly p2pkh = self.nodes[0].getnewaddress() psbt = self.nodes[1].walletcreatefundedpsbt( - [], [{p2pkh: 1}], 0, {"includeWatching": True}, True) + [], [{p2pkh: 1000000}], 0, {"includeWatching": True}, True) self.nodes[0].decodepsbt(psbt['psbt']) # Send to all types of addresses addr1 = self.nodes[1].getnewaddress("") # originally bech32 - txid1 = self.nodes[0].sendtoaddress(addr1, 11) - vout1 = find_output(self.nodes[0], txid1, 11) + txid1 = self.nodes[0].sendtoaddress(addr1, 11000000) + vout1 = find_output(self.nodes[0], txid1, 11000000) addr2 = self.nodes[1].getnewaddress("") # originally legacy - txid2 = self.nodes[0].sendtoaddress(addr2, 11) - vout2 = find_output(self.nodes[0], txid2, 11) + txid2 = self.nodes[0].sendtoaddress(addr2, 11000000) + vout2 = find_output(self.nodes[0], txid2, 11000000) addr3 = self.nodes[1].getnewaddress("") # originally p2sh-segwit - txid3 = self.nodes[0].sendtoaddress(addr3, 11) - vout3 = find_output(self.nodes[0], txid3, 11) + txid3 = self.nodes[0].sendtoaddress(addr3, 11000000) + vout3 = find_output(self.nodes[0], txid3, 11000000) self.sync_all() def test_psbt_input_keys(psbt_input, keys): @@ -336,7 +345,7 @@ # Create a PSBT. None of the inputs are filled initially psbt = self.nodes[1].createpsbt([{"txid": txid1, "vout": vout1}, {"txid": txid2, "vout": vout2}, { - "txid": txid3, "vout": vout3}], {self.nodes[0].getnewaddress(): 32.999}) + "txid": txid3, "vout": vout3}], {self.nodes[0].getnewaddress(): 32999000}) decoded = self.nodes[1].decodepsbt(psbt) test_psbt_input_keys(decoded['inputs'][0], []) test_psbt_input_keys(decoded['inputs'][1], []) @@ -357,18 +366,18 @@ # Two PSBTs with a common input should not be joinable psbt1 = self.nodes[1].createpsbt([{"txid": txid1, "vout": vout1}], { - self.nodes[0].getnewaddress(): Decimal('10.999')}) + self.nodes[0].getnewaddress(): Decimal('10999000')}) assert_raises_rpc_error(-8, "exists in multiple PSBTs", self.nodes[1].joinpsbts, [psbt1, updated]) # Join two distinct PSBTs addr4 = self.nodes[1].getnewaddress("") - txid4 = self.nodes[0].sendtoaddress(addr4, 5) - vout4 = find_output(self.nodes[0], txid4, 5) + txid4 = self.nodes[0].sendtoaddress(addr4, 5000000) + vout4 = find_output(self.nodes[0], txid4, 5000000) self.nodes[0].generate(6) self.sync_all() psbt2 = self.nodes[1].createpsbt([{"txid": txid4, "vout": vout4}], { - self.nodes[0].getnewaddress(): Decimal('4.999')}) + self.nodes[0].getnewaddress(): Decimal('4999000')}) psbt2 = self.nodes[1].walletprocesspsbt(psbt2)['psbt'] psbt2_decoded = self.nodes[0].decodepsbt(psbt2) assert "final_scriptSig" in psbt2_decoded['inputs'][0] @@ -395,12 +404,12 @@ # Newly created PSBT needs UTXOs and updating addr = self.nodes[1].getnewaddress("") - txid = self.nodes[0].sendtoaddress(addr, 7) + txid = self.nodes[0].sendtoaddress(addr, 7000000) blockhash = self.nodes[0].generate(6)[0] self.sync_all() - vout = find_output(self.nodes[0], txid, 7, blockhash=blockhash) + vout = find_output(self.nodes[0], txid, 7000000, blockhash=blockhash) psbt = self.nodes[1].createpsbt([{"txid": txid, "vout": vout}], { - self.nodes[0].getnewaddress(""): Decimal('6.999')}) + self.nodes[0].getnewaddress(""): Decimal('6999000')}) analyzed = self.nodes[0].analyzepsbt(psbt) assert not analyzed['inputs'][0]['has_utxo'] and not analyzed['inputs'][0][ 'is_final'] and analyzed['inputs'][0]['next'] == 'updater' and analyzed['next'] == 'updater' @@ -414,7 +423,7 @@ # Check fee and size things assert analyzed['fee'] == Decimal( - '0.001') and analyzed['estimated_vsize'] == 191 and analyzed['estimated_feerate'] == Decimal('0.00523560') + '1000') and analyzed['estimated_vsize'] == 191 and analyzed['estimated_feerate'] == Decimal('5235.60') # After signing and finalizing, needs extracting signed = self.nodes[1].walletprocesspsbt(updated)['psbt'] diff --git a/test/functional/rpc_rawtransaction.py b/test/functional/rpc_rawtransaction.py --- a/test/functional/rpc_rawtransaction.py +++ b/test/functional/rpc_rawtransaction.py @@ -73,9 +73,9 @@ self.sync_all() self.nodes[0].generate(101) self.sync_all() - self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), 1.5) - self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), 1.0) - self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), 5.0) + self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), 1500000) + self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), 1000000) + self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), 5000000) self.sync_all() self.nodes[0].generate(5) self.sync_all() @@ -261,7 +261,7 @@ # won't exists inputs = [ {'txid': "1d1d4e24ed99057e84c3f80fd8fbec79ed9e1acee37da269356ecea000000000", 'vout': 1}] - outputs = {self.nodes[0].getnewaddress(): 4.998} + outputs = {self.nodes[0].getnewaddress(): 4998000} rawtx = self.nodes[2].createrawtransaction(inputs, outputs) rawtx = pad_raw_tx(rawtx) rawtx = self.nodes[2].signrawtransactionwithwallet(rawtx) @@ -277,7 +277,8 @@ ##################################### # make a tx by sending then generate 2 blocks; block1 has the tx in it - tx = self.nodes[2].sendtoaddress(self.nodes[1].getnewaddress(), 1) + tx = self.nodes[2].sendtoaddress( + self.nodes[1].getnewaddress(), 1000000) block1, block2 = self.nodes[2].generate(2) self.sync_all() # We should be able to get the raw transaction by providing the correct @@ -357,13 +358,13 @@ bal = self.nodes[2].getbalance() # send 1.2 BCH to msig adr - txId = self.nodes[0].sendtoaddress(mSigObj, 1.2) + txId = self.nodes[0].sendtoaddress(mSigObj, 1200000) self.sync_all() self.nodes[0].generate(1) self.sync_all() # node2 has both keys of the 2of2 ms addr., tx should affect the # balance - assert_equal(self.nodes[2].getbalance(), bal + Decimal('1.20000000')) + assert_equal(self.nodes[2].getbalance(), bal + Decimal('1200000.00')) # 2of3 test from different nodes bal = self.nodes[2].getbalance() @@ -378,7 +379,7 @@ mSigObj = self.nodes[2].addmultisigaddress( 2, [addr1Obj['pubkey'], addr2Obj['pubkey'], addr3Obj['pubkey']])['address'] - txId = self.nodes[0].sendtoaddress(mSigObj, 2.2) + txId = self.nodes[0].sendtoaddress(mSigObj, 2200000) decTx = self.nodes[0].gettransaction(txId) rawTx = self.nodes[0].decoderawtransaction(decTx['hex']) self.sync_all() @@ -395,7 +396,7 @@ txDetails = self.nodes[0].gettransaction(txId, True) rawTx = self.nodes[0].decoderawtransaction(txDetails['hex']) vout = next(o for o in rawTx['vout'] - if o['value'] == Decimal('2.20000000')) + if o['value'] == Decimal('2200000.00')) bal = self.nodes[0].getbalance() inputs = [{ @@ -404,7 +405,7 @@ "scriptPubKey": vout['scriptPubKey']['hex'], "amount": vout['value'], }] - outputs = {self.nodes[0].getnewaddress(): 2.19} + outputs = {self.nodes[0].getnewaddress(): 2190000} rawTx = self.nodes[2].createrawtransaction(inputs, outputs) rawTxPartialSigned = self.nodes[1].signrawtransactionwithwallet( rawTx, inputs) @@ -420,7 +421,7 @@ self.nodes[0].generate(1) self.sync_all() assert_equal(self.nodes[0].getbalance(), bal + Decimal( - '50.00000000') + Decimal('2.19000000')) # block reward + tx + '50000000.00') + Decimal('2190000.00')) # block reward + tx rawTxBlock = self.nodes[0].getblock(self.nodes[0].getbestblockhash()) @@ -438,7 +439,7 @@ 2, [addr1Obj['pubkey'], addr2Obj['pubkey']])['address'] mSigObjValid = self.nodes[2].getaddressinfo(mSigObj) - txId = self.nodes[0].sendtoaddress(mSigObj, 2.2) + txId = self.nodes[0].sendtoaddress(mSigObj, 2200000) decTx = self.nodes[0].gettransaction(txId) rawTx2 = self.nodes[0].decoderawtransaction(decTx['hex']) self.sync_all() @@ -451,12 +452,12 @@ txDetails = self.nodes[0].gettransaction(txId, True) rawTx2 = self.nodes[0].decoderawtransaction(txDetails['hex']) vout = next(o for o in rawTx2['vout'] - if o['value'] == Decimal('2.20000000')) + if o['value'] == Decimal('2200000.00')) bal = self.nodes[0].getbalance() inputs = [{"txid": txId, "vout": vout['n'], "scriptPubKey": vout['scriptPubKey'] ['hex'], "redeemScript": mSigObjValid['hex'], "amount": vout['value']}] - outputs = {self.nodes[0].getnewaddress(): 2.19} + outputs = {self.nodes[0].getnewaddress(): 2190000} rawTx2 = self.nodes[2].createrawtransaction(inputs, outputs) rawTxPartialSigned1 = self.nodes[1].signrawtransactionwithwallet( rawTx2, inputs) @@ -478,7 +479,7 @@ self.nodes[0].generate(1) self.sync_all() assert_equal(self.nodes[0].getbalance( - ), bal + Decimal('50.00000000') + Decimal('2.19000000')) # block reward + tx + ), bal + Decimal('50000000.00') + Decimal('2190000.00')) # block reward + tx # getrawtransaction tests # 1. valid parameters - only supply txid @@ -594,22 +595,23 @@ self.log.info('sendrawtransaction/testmempoolaccept with maxfeerate') # Test a transaction with a small fee. - txId = self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), 1.0) + txId = self.nodes[0].sendtoaddress( + self.nodes[2].getnewaddress(), 1000000) rawTx = self.nodes[0].getrawtransaction(txId, True) vout = next(o for o in rawTx['vout'] - if o['value'] == Decimal('1.00000000')) + if o['value'] == Decimal('1000000.00')) self.sync_all() inputs = [{"txid": txId, "vout": vout['n']}] # Fee 10,000 satoshis, (1 - (10000 sat * 0.00000001 BCH/sat)) = 0.9999 - outputs = {self.nodes[0].getnewaddress(): Decimal("0.99990000")} + outputs = {self.nodes[0].getnewaddress(): Decimal("999900.00")} rawTx = self.nodes[2].createrawtransaction(inputs, outputs) rawTxSigned = self.nodes[2].signrawtransactionwithwallet(rawTx) assert_equal(rawTxSigned['complete'], True) # Fee 10,000 satoshis, ~200 b transaction, fee rate should land around 50 sat/byte = 0.00050000 BCH/kB # Thus, testmempoolaccept should reject testres = self.nodes[2].testmempoolaccept( - [rawTxSigned['hex']], 0.00050000)[0] + [rawTxSigned['hex']], 500.00)[0] assert_equal(testres['allowed'], False) assert_equal(testres['reject-reason'], 'absurdly-high-fee') # and sendrawtransaction should throw @@ -617,7 +619,7 @@ "absurdly-high-fee", self.nodes[2].sendrawtransaction, rawTxSigned['hex'], - 0.00001000) + 10.00) # and the following calls should both succeed testres = self.nodes[2].testmempoolaccept( rawtxs=[rawTxSigned['hex']])[0] @@ -625,16 +627,17 @@ self.nodes[2].sendrawtransaction(hexstring=rawTxSigned['hex']) # Test a transaction with a large fee. - txId = self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), 1.0) + txId = self.nodes[0].sendtoaddress( + self.nodes[2].getnewaddress(), 1000000) rawTx = self.nodes[0].getrawtransaction(txId, True) vout = next(o for o in rawTx['vout'] - if o['value'] == Decimal('1.00000000')) + if o['value'] == Decimal('1000000.00')) self.sync_all() inputs = [{"txid": txId, "vout": vout['n']}] # Fee 2,000,000 satoshis, (1 - (2000000 sat * 0.00000001 BCH/sat)) = # 0.98 - outputs = {self.nodes[0].getnewaddress(): Decimal("0.98000000")} + outputs = {self.nodes[0].getnewaddress(): Decimal("980000.00")} rawTx = self.nodes[2].createrawtransaction(inputs, outputs) rawTxSigned = self.nodes[2].signrawtransactionwithwallet(rawTx) assert_equal(rawTxSigned['complete'], True) @@ -650,11 +653,11 @@ rawTxSigned['hex']) # and the following calls should both succeed testres = self.nodes[2].testmempoolaccept( - rawtxs=[rawTxSigned['hex']], maxfeerate='0.20000000')[0] + rawtxs=[rawTxSigned['hex']], maxfeerate='200000.00')[0] assert_equal(testres['allowed'], True) self.nodes[2].sendrawtransaction( hexstring=rawTxSigned['hex'], - maxfeerate='0.20000000') + maxfeerate='200000.00') ########################################## # Decoding weird scripts in transactions # diff --git a/test/functional/rpc_scantxoutset.py b/test/functional/rpc_scantxoutset.py --- a/test/functional/rpc_scantxoutset.py +++ b/test/functional/rpc_scantxoutset.py @@ -29,45 +29,45 @@ addr = self.nodes[0].getnewaddress("") pubkey = self.nodes[0].getaddressinfo(addr)['pubkey'] - self.nodes[0].sendtoaddress(addr, 0.002) + self.nodes[0].sendtoaddress(addr, 2000) # send to child keys of tprv8ZgxMBicQKsPd7Uf69XL1XwhmjHopUGep8GuEiJDZmbQz6o58LninorQAfcKZWARbtRtfnLcJ5MQ2AtHcQJCCRUcMRvmDUjyEmNUWwx8UbK # (m/0'/0'/0') self.nodes[0].sendtoaddress( - "mkHV1C6JLheLoUSSZYk7x3FH5tnx9bu7yc", 0.008) + "mkHV1C6JLheLoUSSZYk7x3FH5tnx9bu7yc", 8000) # (m/0'/0'/1') self.nodes[0].sendtoaddress( - "mipUSRmJAj2KrjSvsPQtnP8ynUon7FhpCR", 0.016) + "mipUSRmJAj2KrjSvsPQtnP8ynUon7FhpCR", 16000) # (m/0'/0'/1500') self.nodes[0].sendtoaddress( - "n37dAGe6Mq1HGM9t4b6rFEEsDGq7Fcgfqg", 0.032) + "n37dAGe6Mq1HGM9t4b6rFEEsDGq7Fcgfqg", 32000) # (m/0'/0'/0) self.nodes[0].sendtoaddress( - "mqS9Rpg8nNLAzxFExsgFLCnzHBsoQ3PRM6", 0.064) + "mqS9Rpg8nNLAzxFExsgFLCnzHBsoQ3PRM6", 64000) # (m/0'/0'/1) self.nodes[0].sendtoaddress( - "mnTg5gVWr3rbhHaKjJv7EEEc76ZqHgSj4S", 0.128) + "mnTg5gVWr3rbhHaKjJv7EEEc76ZqHgSj4S", 128000) # (m/0'/0'/1500) self.nodes[0].sendtoaddress( - "mketCd6B9U9Uee1iCsppDJJBHfvi6U6ukC", 0.256) + "mketCd6B9U9Uee1iCsppDJJBHfvi6U6ukC", 256000) # (m/1/1/0') self.nodes[0].sendtoaddress( - "mj8zFzrbBcdaWXowCQ1oPZ4qioBVzLzAp7", 0.512) + "mj8zFzrbBcdaWXowCQ1oPZ4qioBVzLzAp7", 512000) # (m/1/1/1') self.nodes[0].sendtoaddress( - "mfnKpKQEftniaoE1iXuMMePQU3PUpcNisA", 1.024) + "mfnKpKQEftniaoE1iXuMMePQU3PUpcNisA", 1024000) # (m/1/1/1500') self.nodes[0].sendtoaddress( - "mou6cB1kaP1nNJM1sryW6YRwnd4shTbXYQ", 2.048) + "mou6cB1kaP1nNJM1sryW6YRwnd4shTbXYQ", 2048000) # (m/1/1/0) self.nodes[0].sendtoaddress( - "mtfUoUax9L4tzXARpw1oTGxWyoogp52KhJ", 4.096) + "mtfUoUax9L4tzXARpw1oTGxWyoogp52KhJ", 4096000) # (m/1/1/1) self.nodes[0].sendtoaddress( - "mxp7w7j8S1Aq6L8StS2PqVvtt4HGxXEvdy", 8.192) + "mxp7w7j8S1Aq6L8StS2PqVvtt4HGxXEvdy", 8192000) # (m/1/1/1500) self.nodes[0].sendtoaddress( - "mpQ8rokAhp1TAtJQR6F6TaUmjAWkAWYYBq", 16.384) + "mpQ8rokAhp1TAtJQR6F6TaUmjAWkAWYYBq", 16384000) self.nodes[0].generate(1) @@ -88,13 +88,13 @@ self.restart_node(0, ['-nowallet']) self.log.info("Test if we have found the non HD unspent outputs.") assert_equal(self.nodes[0].scantxoutset( - "start", ["pkh(" + pubkey + ")"])['total_amount'], Decimal("0.002")) + "start", ["pkh(" + pubkey + ")"])['total_amount'], Decimal("2000")) assert_equal(self.nodes[0].scantxoutset( - "start", ["combo(" + pubkey + ")"])['total_amount'], Decimal("0.002")) + "start", ["combo(" + pubkey + ")"])['total_amount'], Decimal("2000")) assert_equal(self.nodes[0].scantxoutset( - "start", ["addr(" + addr + ")"])['total_amount'], Decimal("0.002")) + "start", ["addr(" + addr + ")"])['total_amount'], Decimal("2000")) assert_equal(self.nodes[0].scantxoutset( - "start", ["addr(" + addr + ")"])['total_amount'], Decimal("0.002")) + "start", ["addr(" + addr + ")"])['total_amount'], Decimal("2000")) self.log.info("Test range validation.") assert_raises_rpc_error(-8, @@ -137,55 +137,55 @@ # Note that all amounts in the UTXO set are powers of 2 multiplied by # 0.001 BTC, so each amounts uniquely identifies a subset. assert_equal(self.nodes[0].scantxoutset("start", [ - "combo(tprv8ZgxMBicQKsPd7Uf69XL1XwhmjHopUGep8GuEiJDZmbQz6o58LninorQAfcKZWARbtRtfnLcJ5MQ2AtHcQJCCRUcMRvmDUjyEmNUWwx8UbK/0'/0h/0h)"])['total_amount'], Decimal("0.008")) + "combo(tprv8ZgxMBicQKsPd7Uf69XL1XwhmjHopUGep8GuEiJDZmbQz6o58LninorQAfcKZWARbtRtfnLcJ5MQ2AtHcQJCCRUcMRvmDUjyEmNUWwx8UbK/0'/0h/0h)"])['total_amount'], Decimal("8000")) assert_equal(self.nodes[0].scantxoutset("start", [ - "combo(tprv8ZgxMBicQKsPd7Uf69XL1XwhmjHopUGep8GuEiJDZmbQz6o58LninorQAfcKZWARbtRtfnLcJ5MQ2AtHcQJCCRUcMRvmDUjyEmNUWwx8UbK/0'/0'/1h)"])['total_amount'], Decimal("0.016")) + "combo(tprv8ZgxMBicQKsPd7Uf69XL1XwhmjHopUGep8GuEiJDZmbQz6o58LninorQAfcKZWARbtRtfnLcJ5MQ2AtHcQJCCRUcMRvmDUjyEmNUWwx8UbK/0'/0'/1h)"])['total_amount'], Decimal("16000")) assert_equal(self.nodes[0].scantxoutset("start", [ - "combo(tprv8ZgxMBicQKsPd7Uf69XL1XwhmjHopUGep8GuEiJDZmbQz6o58LninorQAfcKZWARbtRtfnLcJ5MQ2AtHcQJCCRUcMRvmDUjyEmNUWwx8UbK/0h/0'/1500')"])['total_amount'], Decimal("0.032")) + "combo(tprv8ZgxMBicQKsPd7Uf69XL1XwhmjHopUGep8GuEiJDZmbQz6o58LninorQAfcKZWARbtRtfnLcJ5MQ2AtHcQJCCRUcMRvmDUjyEmNUWwx8UbK/0h/0'/1500')"])['total_amount'], Decimal("32000")) assert_equal(self.nodes[0].scantxoutset("start", [ - "combo(tprv8ZgxMBicQKsPd7Uf69XL1XwhmjHopUGep8GuEiJDZmbQz6o58LninorQAfcKZWARbtRtfnLcJ5MQ2AtHcQJCCRUcMRvmDUjyEmNUWwx8UbK/0h/0h/0)"])['total_amount'], Decimal("0.064")) + "combo(tprv8ZgxMBicQKsPd7Uf69XL1XwhmjHopUGep8GuEiJDZmbQz6o58LninorQAfcKZWARbtRtfnLcJ5MQ2AtHcQJCCRUcMRvmDUjyEmNUWwx8UbK/0h/0h/0)"])['total_amount'], Decimal("64000")) assert_equal(self.nodes[0].scantxoutset("start", [ - "combo(tprv8ZgxMBicQKsPd7Uf69XL1XwhmjHopUGep8GuEiJDZmbQz6o58LninorQAfcKZWARbtRtfnLcJ5MQ2AtHcQJCCRUcMRvmDUjyEmNUWwx8UbK/0'/0h/1)"])['total_amount'], Decimal("0.128")) + "combo(tprv8ZgxMBicQKsPd7Uf69XL1XwhmjHopUGep8GuEiJDZmbQz6o58LninorQAfcKZWARbtRtfnLcJ5MQ2AtHcQJCCRUcMRvmDUjyEmNUWwx8UbK/0'/0h/1)"])['total_amount'], Decimal("128000")) assert_equal(self.nodes[0].scantxoutset("start", [ - "combo(tprv8ZgxMBicQKsPd7Uf69XL1XwhmjHopUGep8GuEiJDZmbQz6o58LninorQAfcKZWARbtRtfnLcJ5MQ2AtHcQJCCRUcMRvmDUjyEmNUWwx8UbK/0h/0'/1500)"])['total_amount'], Decimal("0.256")) + "combo(tprv8ZgxMBicQKsPd7Uf69XL1XwhmjHopUGep8GuEiJDZmbQz6o58LninorQAfcKZWARbtRtfnLcJ5MQ2AtHcQJCCRUcMRvmDUjyEmNUWwx8UbK/0h/0'/1500)"])['total_amount'], Decimal("256000")) assert_equal(self.nodes[0].scantxoutset("start", [ - {"desc": "combo(tprv8ZgxMBicQKsPd7Uf69XL1XwhmjHopUGep8GuEiJDZmbQz6o58LninorQAfcKZWARbtRtfnLcJ5MQ2AtHcQJCCRUcMRvmDUjyEmNUWwx8UbK/0'/0h/*h)", "range": 1499}])['total_amount'], Decimal("0.024")) + {"desc": "combo(tprv8ZgxMBicQKsPd7Uf69XL1XwhmjHopUGep8GuEiJDZmbQz6o58LninorQAfcKZWARbtRtfnLcJ5MQ2AtHcQJCCRUcMRvmDUjyEmNUWwx8UbK/0'/0h/*h)", "range": 1499}])['total_amount'], Decimal("24000")) assert_equal(self.nodes[0].scantxoutset("start", [ - {"desc": "combo(tprv8ZgxMBicQKsPd7Uf69XL1XwhmjHopUGep8GuEiJDZmbQz6o58LninorQAfcKZWARbtRtfnLcJ5MQ2AtHcQJCCRUcMRvmDUjyEmNUWwx8UbK/0'/0'/*h)", "range": 1500}])['total_amount'], Decimal("0.056")) + {"desc": "combo(tprv8ZgxMBicQKsPd7Uf69XL1XwhmjHopUGep8GuEiJDZmbQz6o58LninorQAfcKZWARbtRtfnLcJ5MQ2AtHcQJCCRUcMRvmDUjyEmNUWwx8UbK/0'/0'/*h)", "range": 1500}])['total_amount'], Decimal("56000")) assert_equal(self.nodes[0].scantxoutset("start", [ - {"desc": "combo(tprv8ZgxMBicQKsPd7Uf69XL1XwhmjHopUGep8GuEiJDZmbQz6o58LninorQAfcKZWARbtRtfnLcJ5MQ2AtHcQJCCRUcMRvmDUjyEmNUWwx8UbK/0h/0'/*)", "range": 1499}])['total_amount'], Decimal("0.192")) + {"desc": "combo(tprv8ZgxMBicQKsPd7Uf69XL1XwhmjHopUGep8GuEiJDZmbQz6o58LninorQAfcKZWARbtRtfnLcJ5MQ2AtHcQJCCRUcMRvmDUjyEmNUWwx8UbK/0h/0'/*)", "range": 1499}])['total_amount'], Decimal("192000")) assert_equal(self.nodes[0].scantxoutset("start", [ - {"desc": "combo(tprv8ZgxMBicQKsPd7Uf69XL1XwhmjHopUGep8GuEiJDZmbQz6o58LninorQAfcKZWARbtRtfnLcJ5MQ2AtHcQJCCRUcMRvmDUjyEmNUWwx8UbK/0'/0h/*)", "range": 1500}])['total_amount'], Decimal("0.448")) + {"desc": "combo(tprv8ZgxMBicQKsPd7Uf69XL1XwhmjHopUGep8GuEiJDZmbQz6o58LninorQAfcKZWARbtRtfnLcJ5MQ2AtHcQJCCRUcMRvmDUjyEmNUWwx8UbK/0'/0h/*)", "range": 1500}])['total_amount'], Decimal("448000")) assert_equal(self.nodes[0].scantxoutset("start", [ - "combo(tprv8ZgxMBicQKsPd7Uf69XL1XwhmjHopUGep8GuEiJDZmbQz6o58LninorQAfcKZWARbtRtfnLcJ5MQ2AtHcQJCCRUcMRvmDUjyEmNUWwx8UbK/1/1/0')"])['total_amount'], Decimal("0.512")) + "combo(tprv8ZgxMBicQKsPd7Uf69XL1XwhmjHopUGep8GuEiJDZmbQz6o58LninorQAfcKZWARbtRtfnLcJ5MQ2AtHcQJCCRUcMRvmDUjyEmNUWwx8UbK/1/1/0')"])['total_amount'], Decimal("0512000")) assert_equal(self.nodes[0].scantxoutset("start", [ - "combo(tprv8ZgxMBicQKsPd7Uf69XL1XwhmjHopUGep8GuEiJDZmbQz6o58LninorQAfcKZWARbtRtfnLcJ5MQ2AtHcQJCCRUcMRvmDUjyEmNUWwx8UbK/1/1/1')"])['total_amount'], Decimal("1.024")) + "combo(tprv8ZgxMBicQKsPd7Uf69XL1XwhmjHopUGep8GuEiJDZmbQz6o58LninorQAfcKZWARbtRtfnLcJ5MQ2AtHcQJCCRUcMRvmDUjyEmNUWwx8UbK/1/1/1')"])['total_amount'], Decimal("1024000")) assert_equal(self.nodes[0].scantxoutset("start", [ - "combo(tprv8ZgxMBicQKsPd7Uf69XL1XwhmjHopUGep8GuEiJDZmbQz6o58LninorQAfcKZWARbtRtfnLcJ5MQ2AtHcQJCCRUcMRvmDUjyEmNUWwx8UbK/1/1/1500h)"])['total_amount'], Decimal("2.048")) + "combo(tprv8ZgxMBicQKsPd7Uf69XL1XwhmjHopUGep8GuEiJDZmbQz6o58LninorQAfcKZWARbtRtfnLcJ5MQ2AtHcQJCCRUcMRvmDUjyEmNUWwx8UbK/1/1/1500h)"])['total_amount'], Decimal("2048000")) assert_equal(self.nodes[0].scantxoutset("start", [ - "combo(tprv8ZgxMBicQKsPd7Uf69XL1XwhmjHopUGep8GuEiJDZmbQz6o58LninorQAfcKZWARbtRtfnLcJ5MQ2AtHcQJCCRUcMRvmDUjyEmNUWwx8UbK/1/1/0)"])['total_amount'], Decimal("4.096")) + "combo(tprv8ZgxMBicQKsPd7Uf69XL1XwhmjHopUGep8GuEiJDZmbQz6o58LninorQAfcKZWARbtRtfnLcJ5MQ2AtHcQJCCRUcMRvmDUjyEmNUWwx8UbK/1/1/0)"])['total_amount'], Decimal("4096000")) assert_equal(self.nodes[0].scantxoutset("start", [ - "combo(tprv8ZgxMBicQKsPd7Uf69XL1XwhmjHopUGep8GuEiJDZmbQz6o58LninorQAfcKZWARbtRtfnLcJ5MQ2AtHcQJCCRUcMRvmDUjyEmNUWwx8UbK/1/1/1)"])['total_amount'], Decimal("8.192")) + "combo(tprv8ZgxMBicQKsPd7Uf69XL1XwhmjHopUGep8GuEiJDZmbQz6o58LninorQAfcKZWARbtRtfnLcJ5MQ2AtHcQJCCRUcMRvmDUjyEmNUWwx8UbK/1/1/1)"])['total_amount'], Decimal("8192000")) assert_equal(self.nodes[0].scantxoutset("start", [ - "combo(tprv8ZgxMBicQKsPd7Uf69XL1XwhmjHopUGep8GuEiJDZmbQz6o58LninorQAfcKZWARbtRtfnLcJ5MQ2AtHcQJCCRUcMRvmDUjyEmNUWwx8UbK/1/1/1500)"])['total_amount'], Decimal("16.384")) + "combo(tprv8ZgxMBicQKsPd7Uf69XL1XwhmjHopUGep8GuEiJDZmbQz6o58LninorQAfcKZWARbtRtfnLcJ5MQ2AtHcQJCCRUcMRvmDUjyEmNUWwx8UbK/1/1/1500)"])['total_amount'], Decimal("16384000")) assert_equal(self.nodes[0].scantxoutset("start", [ - "combo(tpubD6NzVbkrYhZ4WaWSyoBvQwbpLkojyoTZPRsgXELWz3Popb3qkjcJyJUGLnL4qHHoQvao8ESaAstxYSnhyswJ76uZPStJRJCTKvosUCJZL5B/1/1/0)"])['total_amount'], Decimal("4.096")) + "combo(tpubD6NzVbkrYhZ4WaWSyoBvQwbpLkojyoTZPRsgXELWz3Popb3qkjcJyJUGLnL4qHHoQvao8ESaAstxYSnhyswJ76uZPStJRJCTKvosUCJZL5B/1/1/0)"])['total_amount'], Decimal("4096000")) assert_equal(self.nodes[0].scantxoutset("start", [ - "combo([abcdef88/1/2'/3/4h]tpubD6NzVbkrYhZ4WaWSyoBvQwbpLkojyoTZPRsgXELWz3Popb3qkjcJyJUGLnL4qHHoQvao8ESaAstxYSnhyswJ76uZPStJRJCTKvosUCJZL5B/1/1/1)"])['total_amount'], Decimal("8.192")) + "combo([abcdef88/1/2'/3/4h]tpubD6NzVbkrYhZ4WaWSyoBvQwbpLkojyoTZPRsgXELWz3Popb3qkjcJyJUGLnL4qHHoQvao8ESaAstxYSnhyswJ76uZPStJRJCTKvosUCJZL5B/1/1/1)"])['total_amount'], Decimal("8192000")) assert_equal(self.nodes[0].scantxoutset("start", [ - "combo(tpubD6NzVbkrYhZ4WaWSyoBvQwbpLkojyoTZPRsgXELWz3Popb3qkjcJyJUGLnL4qHHoQvao8ESaAstxYSnhyswJ76uZPStJRJCTKvosUCJZL5B/1/1/1500)"])['total_amount'], Decimal("16.384")) + "combo(tpubD6NzVbkrYhZ4WaWSyoBvQwbpLkojyoTZPRsgXELWz3Popb3qkjcJyJUGLnL4qHHoQvao8ESaAstxYSnhyswJ76uZPStJRJCTKvosUCJZL5B/1/1/1500)"])['total_amount'], Decimal("16384000")) assert_equal(self.nodes[0].scantxoutset("start", [ - {"desc": "combo(tprv8ZgxMBicQKsPd7Uf69XL1XwhmjHopUGep8GuEiJDZmbQz6o58LninorQAfcKZWARbtRtfnLcJ5MQ2AtHcQJCCRUcMRvmDUjyEmNUWwx8UbK/1/1/*')", "range": 1499}])['total_amount'], Decimal("1.536")) + {"desc": "combo(tprv8ZgxMBicQKsPd7Uf69XL1XwhmjHopUGep8GuEiJDZmbQz6o58LninorQAfcKZWARbtRtfnLcJ5MQ2AtHcQJCCRUcMRvmDUjyEmNUWwx8UbK/1/1/*')", "range": 1499}])['total_amount'], Decimal("1536000")) assert_equal(self.nodes[0].scantxoutset("start", [ - {"desc": "combo(tprv8ZgxMBicQKsPd7Uf69XL1XwhmjHopUGep8GuEiJDZmbQz6o58LninorQAfcKZWARbtRtfnLcJ5MQ2AtHcQJCCRUcMRvmDUjyEmNUWwx8UbK/1/1/*')", "range": 1500}])['total_amount'], Decimal("3.584")) + {"desc": "combo(tprv8ZgxMBicQKsPd7Uf69XL1XwhmjHopUGep8GuEiJDZmbQz6o58LninorQAfcKZWARbtRtfnLcJ5MQ2AtHcQJCCRUcMRvmDUjyEmNUWwx8UbK/1/1/*')", "range": 1500}])['total_amount'], Decimal("3584000")) assert_equal(self.nodes[0].scantxoutset("start", [ - {"desc": "combo(tprv8ZgxMBicQKsPd7Uf69XL1XwhmjHopUGep8GuEiJDZmbQz6o58LninorQAfcKZWARbtRtfnLcJ5MQ2AtHcQJCCRUcMRvmDUjyEmNUWwx8UbK/1/1/*)", "range": 1499}])['total_amount'], Decimal("12.288")) + {"desc": "combo(tprv8ZgxMBicQKsPd7Uf69XL1XwhmjHopUGep8GuEiJDZmbQz6o58LninorQAfcKZWARbtRtfnLcJ5MQ2AtHcQJCCRUcMRvmDUjyEmNUWwx8UbK/1/1/*)", "range": 1499}])['total_amount'], Decimal("12288000")) assert_equal(self.nodes[0].scantxoutset("start", [ - {"desc": "combo(tprv8ZgxMBicQKsPd7Uf69XL1XwhmjHopUGep8GuEiJDZmbQz6o58LninorQAfcKZWARbtRtfnLcJ5MQ2AtHcQJCCRUcMRvmDUjyEmNUWwx8UbK/1/1/*)", "range": 1500}])['total_amount'], Decimal("28.672")) + {"desc": "combo(tprv8ZgxMBicQKsPd7Uf69XL1XwhmjHopUGep8GuEiJDZmbQz6o58LninorQAfcKZWARbtRtfnLcJ5MQ2AtHcQJCCRUcMRvmDUjyEmNUWwx8UbK/1/1/*)", "range": 1500}])['total_amount'], Decimal("28672000")) assert_equal(self.nodes[0].scantxoutset("start", [ - {"desc": "combo(tpubD6NzVbkrYhZ4WaWSyoBvQwbpLkojyoTZPRsgXELWz3Popb3qkjcJyJUGLnL4qHHoQvao8ESaAstxYSnhyswJ76uZPStJRJCTKvosUCJZL5B/1/1/*)", "range": 1499}])['total_amount'], Decimal("12.288")) + {"desc": "combo(tpubD6NzVbkrYhZ4WaWSyoBvQwbpLkojyoTZPRsgXELWz3Popb3qkjcJyJUGLnL4qHHoQvao8ESaAstxYSnhyswJ76uZPStJRJCTKvosUCJZL5B/1/1/*)", "range": 1499}])['total_amount'], Decimal("12288000")) assert_equal(self.nodes[0].scantxoutset("start", [ - {"desc": "combo(tpubD6NzVbkrYhZ4WaWSyoBvQwbpLkojyoTZPRsgXELWz3Popb3qkjcJyJUGLnL4qHHoQvao8ESaAstxYSnhyswJ76uZPStJRJCTKvosUCJZL5B/1/1/*)", "range": 1500}])['total_amount'], Decimal("28.672")) + {"desc": "combo(tpubD6NzVbkrYhZ4WaWSyoBvQwbpLkojyoTZPRsgXELWz3Popb3qkjcJyJUGLnL4qHHoQvao8ESaAstxYSnhyswJ76uZPStJRJCTKvosUCJZL5B/1/1/*)", "range": 1500}])['total_amount'], Decimal("28672000")) assert_equal( self.nodes[0].scantxoutset( "start", @@ -195,7 +195,7 @@ "range": [ 1500, 1500]}])['total_amount'], - Decimal("16.384")) + Decimal("16384000")) # Test the reported descriptors for a few matches assert_equal(descriptors(self.nodes[0].scantxoutset("start", diff --git a/test/functional/rpc_signrawtransaction.py b/test/functional/rpc_signrawtransaction.py --- a/test/functional/rpc_signrawtransaction.py +++ b/test/functional/rpc_signrawtransaction.py @@ -33,14 +33,14 @@ inputs = [ # Valid pay-to-pubkey scripts {'txid': '9b907ef1e3c26fc71fe4a4b3580bc75264112f95050014157059c736f0202e71', - 'vout': 0, 'amount': 3.14159, + 'vout': 0, 'amount': 3141590, 'scriptPubKey': '76a91460baa0f494b38ce3c940dea67f3804dc52d1fb9488ac'}, {'txid': '83a4f6a6b73660e13ee6cb3c6063fa3759c50c9b7521d0536022961898f4fb02', - 'vout': 0, 'amount': '123.456', + 'vout': 0, 'amount': '123456000', 'scriptPubKey': '76a914669b857c03a5ed269d5d85a1ffac9ed5d663072788ac'}, ] - outputs = {'mpLQjfK79b7CCV4VMJWEWAj5Mpx8Up5zxB': 0.1} + outputs = {'mpLQjfK79b7CCV4VMJWEWAj5Mpx8Up5zxB': 100000} rawTx = self.nodes[0].createrawtransaction(inputs, outputs) rawTxSigned = self.nodes[0].signrawtransactionwithkey( @@ -151,11 +151,11 @@ inputs = [ # Valid pay-to-pubkey script {'txid': '9b907ef1e3c26fc71fe4a4b3580bc75264112f95050014157059c736f0202e71', - 'vout': 0, 'amount': 3.14159, + 'vout': 0, 'amount': 3141590, 'scriptPubKey': '76a91460baa0f494b38ce3c940dea67f3804dc52d1fb9488ac'} ] - outputs = {'mpLQjfK79b7CCV4VMJWEWAj5Mpx8Up5zxB': 0.1} + outputs = {'mpLQjfK79b7CCV4VMJWEWAj5Mpx8Up5zxB': 100000} rawTx = self.nodes[0].createrawtransaction(inputs, outputs) @@ -212,11 +212,11 @@ inputs = [ # Valid pay-to-pubkey scripts {'txid': '9b907ef1e3c26fc71fe4a4b3580bc75264112f95050014157059c736f0202e71', - 'vout': 0, 'amount': 3.14159, + 'vout': 0, 'amount': 3141590, 'scriptPubKey': '76a91460baa0f494b38ce3c940dea67f3804dc52d1fb9488ac'}, ] - outputs = {'mpLQjfK79b7CCV4VMJWEWAj5Mpx8Up5zxB': 0.1} + outputs = {'mpLQjfK79b7CCV4VMJWEWAj5Mpx8Up5zxB': 100000} multiwallet_node = self.nodes[0] diff --git a/test/functional/rpc_txoutproof.py b/test/functional/rpc_txoutproof.py --- a/test/functional/rpc_txoutproof.py +++ b/test/functional/rpc_txoutproof.py @@ -43,11 +43,11 @@ node0utxos = self.nodes[0].listunspent(1) tx1 = self.nodes[0].createrawtransaction( - [node0utxos.pop()], {self.nodes[1].getnewaddress(): 49.99}) + [node0utxos.pop()], {self.nodes[1].getnewaddress(): 49990000}) txid1 = self.nodes[0].sendrawtransaction( self.nodes[0].signrawtransactionwithwallet(tx1)["hex"]) tx2 = self.nodes[0].createrawtransaction( - [node0utxos.pop()], {self.nodes[1].getnewaddress(): 49.99}) + [node0utxos.pop()], {self.nodes[1].getnewaddress(): 49990000}) txid2 = self.nodes[0].sendrawtransaction( self.nodes[0].signrawtransactionwithwallet(tx2)["hex"]) # This will raise an exception because the transaction is not yet in a @@ -73,7 +73,7 @@ txin_spent = self.nodes[1].listunspent(1).pop() tx3 = self.nodes[1].createrawtransaction( - [txin_spent], {self.nodes[0].getnewaddress(): 49.98}) + [txin_spent], {self.nodes[0].getnewaddress(): 49980000}) txid3 = self.nodes[0].sendrawtransaction( self.nodes[1].signrawtransactionwithwallet(tx3)["hex"]) self.nodes[0].generate(1) diff --git a/test/functional/test_framework/blocktools.py b/test/functional/test_framework/blocktools.py --- a/test/functional/test_framework/blocktools.py +++ b/test/functional/test_framework/blocktools.py @@ -21,6 +21,7 @@ from .messages import ( CBlock, COIN, + XEC, COutPoint, CTransaction, CTxIn, @@ -216,7 +217,7 @@ txid = int(utxo['txid'], 16) ctx.vin.append(CTxIn(COutPoint(txid, int(utxo["vout"])), b"")) ctx.vout.append( - CTxOut(int(satoshi_round(utxo['amount'] * COIN)), + CTxOut(int(satoshi_round(utxo['amount'] * XEC)), CScript([OP_DUP, OP_HASH160, addrHash, OP_EQUALVERIFY, OP_CHECKSIG]))) for i in range(0, 127): ctx.vout.append(CTxOut(0, CScript( diff --git a/test/functional/test_framework/messages.py b/test/functional/test_framework/messages.py --- a/test/functional/test_framework/messages.py +++ b/test/functional/test_framework/messages.py @@ -49,6 +49,8 @@ # 1 BCH in satoshis COIN = 100000000 +# 1 XEC in satoshis +XEC = 100 MAX_MONEY = 21000000 * COIN # Maximum length of incoming protocol messages @@ -426,8 +428,8 @@ return r def __repr__(self): - return "CTxOut(nValue={}.{:08d} scriptPubKey={})".format( - self.nValue // COIN, self.nValue % COIN, self.scriptPubKey.hex()) + return "CTxOut(nValue={}.{:02d} scriptPubKey={})".format( + self.nValue // XEC, self.nValue % XEC, self.scriptPubKey.hex()) class CTransaction: diff --git a/test/functional/test_framework/test_node.py b/test/functional/test_framework/test_node.py --- a/test/functional/test_framework/test_node.py +++ b/test/functional/test_framework/test_node.py @@ -23,7 +23,7 @@ from .authproxy import JSONRPCException from .descriptors import descsum_create -from .messages import COIN, CTransaction, FromHex, MY_SUBVERSION +from .messages import XEC, CTransaction, FromHex, MY_SUBVERSION from .util import ( MAX_NODES, append_config, @@ -108,7 +108,8 @@ "-debugexclude=leveldb", "-uacomment=" + self.name, "-noprinttoconsole", - "-ecash" + "-ecash", + "-xec" ] if use_valgrind: @@ -657,7 +658,7 @@ billable_size_estimate += len(tx.vin) * 107 # relay_fee gives a value in BCH per kB. - return int(self.relay_fee() / 1000 * billable_size_estimate * COIN) + return int(self.relay_fee() / 1000 * billable_size_estimate * XEC) def calculate_fee_from_txid(self, txid): ctx = FromHex(CTransaction(), self.getrawtransaction(txid)) diff --git a/test/functional/test_framework/util.py b/test/functional/test_framework/util.py --- a/test/functional/test_framework/util.py +++ b/test/functional/test_framework/util.py @@ -26,7 +26,7 @@ ################## -def assert_approx(v, vexp, vspan=0.00001): +def assert_approx(v, vexp, vspan=10): """Assert that `v` is within `vspan` of `vexp`""" if v < vexp - vspan: raise AssertionError("{} < [{}..{}]".format( @@ -244,7 +244,7 @@ def satoshi_round(amount): - return Decimal(amount).quantize(Decimal('0.00000001'), rounding=ROUND_DOWN) + return Decimal(amount).quantize(Decimal('0.01'), rounding=ROUND_DOWN) def wait_until(predicate, *, attempts=float('inf'), @@ -359,7 +359,7 @@ f.write("[{}]\n".format(chain_name_conf_section)) f.write("port=" + str(p2p_port(n)) + "\n") f.write("rpcport=" + str(rpc_port(n)) + "\n") - f.write("fallbackfee=0.0002\n") + f.write("fallbackfee=200\n") f.write("server=1\n") f.write("keypool=1\n") f.write("discover=0\n") diff --git a/test/functional/wallet_abandonconflict.py b/test/functional/wallet_abandonconflict.py --- a/test/functional/wallet_abandonconflict.py +++ b/test/functional/wallet_abandonconflict.py @@ -25,7 +25,7 @@ class AbandonConflictTest(BitcoinTestFramework): def set_test_params(self): self.num_nodes = 2 - self.extra_args = [["-minrelaytxfee=0.00001"], []] + self.extra_args = [["-minrelaytxfee=10"], []] def skip_test_if_missing_module(self): self.skip_if_no_wallet() @@ -42,11 +42,11 @@ self.sync_blocks() balance = self.nodes[0].getbalance() txA = self.nodes[0].sendtoaddress( - self.nodes[0].getnewaddress(), Decimal("10")) + self.nodes[0].getnewaddress(), Decimal("10000000")) txB = self.nodes[0].sendtoaddress( - self.nodes[0].getnewaddress(), Decimal("10")) + self.nodes[0].getnewaddress(), Decimal("10000000")) txC = self.nodes[0].sendtoaddress( - self.nodes[0].getnewaddress(), Decimal("10")) + self.nodes[0].getnewaddress(), Decimal("10000000")) self.sync_mempools() self.nodes[1].generate(1) @@ -71,11 +71,11 @@ # Identify the 10btc outputs nA = next(tx_out["vout"] for tx_out in self.nodes[0].gettransaction( - txA)["details"] if tx_out["amount"] == Decimal("10")) + txA)["details"] if tx_out["amount"] == Decimal("10000000")) nB = next(tx_out["vout"] for tx_out in self.nodes[0].gettransaction( - txB)["details"] if tx_out["amount"] == Decimal("10")) + txB)["details"] if tx_out["amount"] == Decimal("10000000")) nC = next(tx_out["vout"] for tx_out in self.nodes[0].gettransaction( - txC)["details"] if tx_out["amount"] == Decimal("10")) + txC)["details"] if tx_out["amount"] == Decimal("10000000")) inputs = [] # spend 10btc outputs from txA and txB @@ -83,15 +83,15 @@ inputs.append({"txid": txB, "vout": nB}) outputs = {} - outputs[self.nodes[0].getnewaddress()] = Decimal("14.99998") - outputs[self.nodes[1].getnewaddress()] = Decimal("5") + outputs[self.nodes[0].getnewaddress()] = Decimal("14999980") + outputs[self.nodes[1].getnewaddress()] = Decimal("5000000") signed = self.nodes[0].signrawtransactionwithwallet( self.nodes[0].createrawtransaction(inputs, outputs)) txAB1 = self.nodes[0].sendrawtransaction(signed["hex"]) # Identify the 14.99998btc output nAB = next(tx_out["vout"] for tx_out in self.nodes[0].gettransaction( - txAB1)["details"] if tx_out["amount"] == Decimal("14.99998")) + txAB1)["details"] if tx_out["amount"] == Decimal("14999980")) # Create a child tx spending AB1 and C inputs = [] @@ -100,13 +100,13 @@ # Amount 10 BCH inputs.append({"txid": txC, "vout": nC}) outputs = {} - outputs[self.nodes[0].getnewaddress()] = Decimal("24.9996") + outputs[self.nodes[0].getnewaddress()] = Decimal("24999600") signed2 = self.nodes[0].signrawtransactionwithwallet( self.nodes[0].createrawtransaction(inputs, outputs)) txABC2 = self.nodes[0].sendrawtransaction(signed2["hex"]) # Create a child tx spending ABC2 - signed3_change = Decimal("24.999") + signed3_change = Decimal("24999000") inputs = [{"txid": txABC2, "vout": 0}] outputs = {self.nodes[0].getnewaddress(): signed3_change} signed3 = self.nodes[0].signrawtransactionwithwallet( @@ -117,12 +117,16 @@ # In mempool txs from self should increase balance from change newbalance = self.nodes[0].getbalance() - assert_equal(newbalance, balance - Decimal("30") + signed3_change) + assert_equal( + newbalance, + balance - + Decimal("30000000") + + signed3_change) balance = newbalance # Restart the node with a higher min relay fee so the parent tx is no longer in mempool # TODO: redo with eviction - self.restart_node(0, extra_args=["-minrelaytxfee=0.0001"]) + self.restart_node(0, extra_args=["-minrelaytxfee=100"]) assert self.nodes[0].getmempoolinfo()['loaded'] # Verify txs no longer in either node's mempool @@ -152,12 +156,12 @@ # including that the child tx was also abandoned self.nodes[0].abandontransaction(txAB1) newbalance = self.nodes[0].getbalance() - assert_equal(newbalance, balance + Decimal("30")) + assert_equal(newbalance, balance + Decimal("30000000")) balance = newbalance # Verify that even with a low min relay fee, the tx is not re-accepted # from wallet on startup once abandoned. - self.restart_node(0, extra_args=["-minrelaytxfee=0.00001"]) + self.restart_node(0, extra_args=["-minrelaytxfee=10"]) assert self.nodes[0].getmempoolinfo()['loaded'] assert_equal(len(self.nodes[0].getrawmempool()), 0) @@ -170,22 +174,26 @@ # separately from other indices. self.nodes[0].sendrawtransaction(signed["hex"]) newbalance = self.nodes[0].getbalance() - assert_equal(newbalance, balance - Decimal("20") + Decimal("14.99998")) + assert_equal( + newbalance, + balance - + Decimal("20000000") + + Decimal("14999980")) balance = newbalance # Send child tx again so it is no longer abandoned. self.nodes[0].sendrawtransaction(signed2["hex"]) newbalance = self.nodes[0].getbalance() - assert_equal(newbalance, balance - Decimal("10") - - Decimal("14.99998") + Decimal("24.9996")) + assert_equal(newbalance, balance - Decimal("10000000") + - Decimal("14999980") + Decimal("24999600")) balance = newbalance # Reset to a higher relay fee so that we abandon a transaction - self.restart_node(0, extra_args=["-minrelaytxfee=0.0001"]) + self.restart_node(0, extra_args=["-minrelaytxfee=100"]) assert self.nodes[0].getmempoolinfo()['loaded'] assert_equal(len(self.nodes[0].getrawmempool()), 0) newbalance = self.nodes[0].getbalance() - assert_equal(newbalance, balance - Decimal("24.9996")) + assert_equal(newbalance, balance - Decimal("24999600")) balance = newbalance # Create a double spend of AB1. Spend it again from only A's 10 output. @@ -193,7 +201,7 @@ inputs = [] inputs.append({"txid": txA, "vout": nA}) outputs = {} - outputs[self.nodes[1].getnewaddress()] = Decimal("9.9999") + outputs[self.nodes[1].getnewaddress()] = Decimal("9999900") tx = self.nodes[0].createrawtransaction(inputs, outputs) signed = self.nodes[0].signrawtransactionwithwallet(tx) self.nodes[1].sendrawtransaction(signed["hex"]) @@ -205,7 +213,7 @@ # Verify that B and C's 10 BCH outputs are available for spending again # because AB1 is now conflicted newbalance = self.nodes[0].getbalance() - assert_equal(newbalance, balance + Decimal("20")) + assert_equal(newbalance, balance + Decimal("20000000")) balance = newbalance # There is currently a minor bug around this and so this test doesn't work. See Issue #7315 diff --git a/test/functional/wallet_address_types.py b/test/functional/wallet_address_types.py --- a/test/functional/wallet_address_types.py +++ b/test/functional/wallet_address_types.py @@ -101,7 +101,7 @@ # the PSBT logic. However, this does test consistency between the PSBT reported # fingerprints/paths and the descriptor logic. psbt = self.nodes[node].createpsbt( - [{'txid': utxo['txid'], 'vout':utxo['vout']}], [{address: 0.00010000}]) + [{'txid': utxo['txid'], 'vout':utxo['vout']}], [{address: 100.00}]) psbt = self.nodes[node].walletprocesspsbt( psbt, False, "ALL|FORKID", True) decode = self.nodes[node].decodepsbt(psbt['psbt']) @@ -146,7 +146,7 @@ self, node_sender, destinations, expected_type): txid = self.nodes[node_sender].sendmany( dummy="", amounts=dict.fromkeys( - destinations, 0.001)) + destinations, 1000.00)) raw_tx = self.nodes[node_sender].getrawtransaction(txid) tx = self.nodes[node_sender].decoderawtransaction(raw_tx) @@ -204,7 +204,7 @@ to_send = ( old_balances[from_node] / 101).quantize( - Decimal("0.00000001")) + Decimal("0.01")) sends = {} addresses = {} diff --git a/test/functional/wallet_avoidreuse.py b/test/functional/wallet_avoidreuse.py --- a/test/functional/wallet_avoidreuse.py +++ b/test/functional/wallet_avoidreuse.py @@ -16,7 +16,7 @@ def reset_balance(node, discardaddr): '''Throw away all owned coins by the node so it gets a balance of 0.''' balance = node.getbalance(avoid_reuse=False) - if balance > 0.5: + if balance > 500000: node.sendtoaddress( address=discardaddr, amount=balance, @@ -57,7 +57,7 @@ if total_count is not None: assert_equal(stats["total"]["count"], total_count) if total_sum is not None: - assert_approx(stats["total"]["sum"], total_sum, 0.001) + assert_approx(stats["total"]["sum"], total_sum, 1000) if reused_supported is not None: assert_equal(stats["reused"]["supported"], reused_supported) if reused_count is not None: @@ -70,7 +70,7 @@ '''Make assertions about a node's getbalances output''' got = node.getbalances()["mine"] for k, v in mine.items(): - assert_approx(got[k], v, 0.001) + assert_approx(got[k], v, 1000) class AvoidReuseTest(BitcoinTestFramework): @@ -168,8 +168,10 @@ reset_balance(node, node.getnewaddress()) addr = node.getnewaddress() - txid = node.sendtoaddress(addr, 1) - out = node.listunspent(minconf=0, query_options={'minimumAmount': 2}) + txid = node.sendtoaddress(addr, 1000000) + out = node.listunspent( + minconf=0, query_options={ + 'minimumAmount': 2000000}) assert_equal(len(out), 1) assert_equal(out[0]['txid'], txid) changeaddr = out[0]['address'] @@ -199,7 +201,7 @@ fundaddr = self.nodes[1].getnewaddress() retaddr = self.nodes[0].getnewaddress() - self.nodes[0].sendtoaddress(fundaddr, 10) + self.nodes[0].sendtoaddress(fundaddr, 10000000) self.nodes[0].generate(1) self.sync_all() @@ -207,16 +209,16 @@ assert_unspent( self.nodes[1], total_count=1, - total_sum=10, + total_sum=10000000, reused_supported=True, reused_count=0) # getbalances should show no used, 10 BCH trusted - assert_balances(self.nodes[1], mine={"used": 0, "trusted": 10}) + assert_balances(self.nodes[1], mine={"used": 0, "trusted": 10000000}) # node 0 should not show a used entry, as it does not enable # avoid_reuse assert("used" not in self.nodes[0].getbalances()["mine"]) - self.nodes[1].sendtoaddress(retaddr, 5) + self.nodes[1].sendtoaddress(retaddr, 5000000) self.nodes[0].generate(1) self.sync_all() @@ -224,13 +226,13 @@ assert_unspent( self.nodes[1], total_count=1, - total_sum=5, + total_sum=5000000, reused_supported=True, reused_count=0) # getbalances should show no used, 5 BCH trusted - assert_balances(self.nodes[1], mine={"used": 0, "trusted": 5}) + assert_balances(self.nodes[1], mine={"used": 0, "trusted": 5000000}) - self.nodes[0].sendtoaddress(fundaddr, 10) + self.nodes[0].sendtoaddress(fundaddr, 10000000) self.nodes[0].generate(1) self.sync_all() @@ -239,27 +241,35 @@ assert_unspent( self.nodes[1], total_count=2, - total_sum=15, + total_sum=15000000, reused_count=1, - reused_sum=10) + reused_sum=10000000) # getbalances should show 10 used, 5 BCH trusted - assert_balances(self.nodes[1], mine={"used": 10, "trusted": 5}) + assert_balances( + self.nodes[1], + mine={ + "used": 10000000, + "trusted": 5000000}) self.nodes[1].sendtoaddress( - address=retaddr, amount=10, avoid_reuse=False) + address=retaddr, amount=10000000, avoid_reuse=False) # listunspent should show 1 total outputs (5 BCH), unused assert_unspent( self.nodes[1], total_count=1, - total_sum=5, + total_sum=5000000, reused_count=0) # getbalances should show no used, 5 BCH trusted - assert_balances(self.nodes[1], mine={"used": 0, "trusted": 5}) + assert_balances(self.nodes[1], mine={"used": 0, "trusted": 5000000}) # node 1 should now have about 5 BCH left (for both cases) - assert_approx(self.nodes[1].getbalance(), 5, 0.001) - assert_approx(self.nodes[1].getbalance(avoid_reuse=False), 5, 0.001) + assert_approx(self.nodes[1].getbalance(), 5000000, 1000) + assert_approx( + self.nodes[1].getbalance( + avoid_reuse=False), + 5000000, + 1000) def test_sending_from_reused_address_fails(self): ''' @@ -275,7 +285,7 @@ fundaddr = self.nodes[1].getnewaddress(label="", address_type="legacy") retaddr = self.nodes[0].getnewaddress() - self.nodes[0].sendtoaddress(fundaddr, 10) + self.nodes[0].sendtoaddress(fundaddr, 10000000) self.nodes[0].generate(1) self.sync_all() @@ -283,13 +293,13 @@ assert_unspent( self.nodes[1], total_count=1, - total_sum=10, + total_sum=10000000, reused_supported=True, reused_count=0) # getbalances should show no used, 10 BCH trusted - assert_balances(self.nodes[1], mine={"used": 0, "trusted": 10}) + assert_balances(self.nodes[1], mine={"used": 0, "trusted": 10000000}) - self.nodes[1].sendtoaddress(retaddr, 5) + self.nodes[1].sendtoaddress(retaddr, 5000000) self.nodes[0].generate(1) self.sync_all() @@ -297,11 +307,11 @@ assert_unspent( self.nodes[1], total_count=1, - total_sum=5, + total_sum=5000000, reused_supported=True, reused_count=0) # getbalances should show no used, 5 BCH trusted - assert_balances(self.nodes[1], mine={"used": 0, "trusted": 5}) + assert_balances(self.nodes[1], mine={"used": 0, "trusted": 5000000}) # For the second send, we transmute it to a related single-key address # to make sure it's also detected as re-use @@ -309,7 +319,7 @@ # name for consistency. new_fundaddr = fundaddr - self.nodes[0].sendtoaddress(new_fundaddr, 10) + self.nodes[0].sendtoaddress(new_fundaddr, 10000000) self.nodes[0].generate(1) self.sync_all() @@ -318,37 +328,53 @@ assert_unspent( self.nodes[1], total_count=2, - total_sum=15, + total_sum=15000000, reused_count=1, - reused_sum=10) + reused_sum=10000000) # getbalances should show 10 used, 5 BCH trusted - assert_balances(self.nodes[1], mine={"used": 10, "trusted": 5}) + assert_balances( + self.nodes[1], + mine={ + "used": 10000000, + "trusted": 5000000}) # node 1 should now have a balance of 5 (no dirty) or 15 (including # dirty) - assert_approx(self.nodes[1].getbalance(), 5, 0.001) - assert_approx(self.nodes[1].getbalance(avoid_reuse=False), 15, 0.001) + assert_approx(self.nodes[1].getbalance(), 5000000, 1000) + assert_approx( + self.nodes[1].getbalance( + avoid_reuse=False), + 15000000, + 1000) assert_raises_rpc_error(-6, "Insufficient funds", - self.nodes[1].sendtoaddress, retaddr, 10) + self.nodes[1].sendtoaddress, retaddr, 10000000) - self.nodes[1].sendtoaddress(retaddr, 4) + self.nodes[1].sendtoaddress(retaddr, 4000000) # listunspent should show 2 total outputs (1, 10 BCH), one unused (1), # one reused (10) assert_unspent( self.nodes[1], total_count=2, - total_sum=11, + total_sum=11000000, reused_count=1, - reused_sum=10) + reused_sum=10000000) # getbalances should show 10 used, 1 BCH trusted - assert_balances(self.nodes[1], mine={"used": 10, "trusted": 1}) + assert_balances( + self.nodes[1], + mine={ + "used": 10000000, + "trusted": 1000000}) # node 1 should now have about 1 BCH left (no dirty) and 11 (including # dirty) - assert_approx(self.nodes[1].getbalance(), 1, 0.001) - assert_approx(self.nodes[1].getbalance(avoid_reuse=False), 11, 0.001) + assert_approx(self.nodes[1].getbalance(), 1000000, 1000) + assert_approx( + self.nodes[1].getbalance( + avoid_reuse=False), + 11000000, + 1000) def test_getbalances_used(self): ''' @@ -366,24 +392,28 @@ # send multiple transactions, reusing one address for _ in range(11): - self.nodes[0].sendtoaddress(new_addr, 1) + self.nodes[0].sendtoaddress(new_addr, 1000000) self.nodes[0].generate(1) self.sync_all() # send transaction that should not use all the available outputs # per the current coin selection algorithm - self.nodes[1].sendtoaddress(ret_addr, 5) + self.nodes[1].sendtoaddress(ret_addr, 5000000) # getbalances and listunspent should show the remaining outputs # in the reused address as used/reused assert_unspent( self.nodes[1], total_count=2, - total_sum=6, + total_sum=6000000, reused_count=1, - reused_sum=1) - assert_balances(self.nodes[1], mine={"used": 1, "trusted": 5}) + reused_sum=1000000) + assert_balances( + self.nodes[1], + mine={ + "used": 1000000, + "trusted": 5000000}) def test_full_destination_group_is_preferred(self): ''' @@ -404,14 +434,14 @@ # Send 11 outputs of 1 BCH to the same, reused address in the wallet for _ in range(11): - self.nodes[0].sendtoaddress(new_addr, 1) + self.nodes[0].sendtoaddress(new_addr, 1000000) self.nodes[0].generate(1) self.sync_all() # Sending a transaction that is smaller than each one of the # available outputs - txid = self.nodes[1].sendtoaddress(address=ret_addr, amount=0.5) + txid = self.nodes[1].sendtoaddress(address=ret_addr, amount=500000) inputs = self.nodes[1].getrawtransaction(txid, 1)["vin"] # The transaction should use 10 inputs exactly @@ -433,14 +463,14 @@ # Send 22 outputs of 1 BCH to the same, reused address in the wallet for _ in range(22): - self.nodes[0].sendtoaddress(new_addr, 1) + self.nodes[0].sendtoaddress(new_addr, 1000000) self.nodes[0].generate(1) self.sync_all() # Sending a transaction that needs to use the full groups # of 10 inputs but also the incomplete group of 2 inputs. - txid = self.nodes[1].sendtoaddress(address=ret_addr, amount=20.5) + txid = self.nodes[1].sendtoaddress(address=ret_addr, amount=20500000) inputs = self.nodes[1].getrawtransaction(txid, 1)["vin"] # The transaction should use 22 inputs exactly diff --git a/test/functional/wallet_backup.py b/test/functional/wallet_backup.py --- a/test/functional/wallet_backup.py +++ b/test/functional/wallet_backup.py @@ -70,7 +70,7 @@ def one_send(self, from_node, to_address): if (randint(1, 2) == 1): - amount = Decimal(randint(1, 10)) / Decimal(10) + amount = Decimal(randint(1, 10)) * Decimal(100000) self.nodes[from_node].sendtoaddress(to_address, amount) def do_one_round(self): @@ -125,9 +125,9 @@ self.nodes[3].generate(100) self.sync_blocks() - assert_equal(self.nodes[0].getbalance(), 50) - assert_equal(self.nodes[1].getbalance(), 50) - assert_equal(self.nodes[2].getbalance(), 50) + assert_equal(self.nodes[0].getbalance(), 50000000) + assert_equal(self.nodes[1].getbalance(), 50000000) + assert_equal(self.nodes[2].getbalance(), 50000000) assert_equal(self.nodes[3].getbalance(), 0) self.log.info("Creating transactions") @@ -165,7 +165,7 @@ # At this point, there are 214 blocks (103 for setup, then 10 rounds, then 101.) # 114 are mature, so the sum of all wallets should be 114 * 50 = 5700. - assert_equal(total, 5700) + assert_equal(total, 5700000000) ## # Test restoring spender wallets from backups diff --git a/test/functional/wallet_balance.py b/test/functional/wallet_balance.py --- a/test/functional/wallet_balance.py +++ b/test/functional/wallet_balance.py @@ -77,43 +77,43 @@ self.nodes[1].generatetoaddress(101, ADDRESS_WATCHONLY) self.sync_all() - assert_equal(self.nodes[0].getbalances()['mine']['trusted'], 50) - assert_equal(self.nodes[0].getwalletinfo()['balance'], 50) - assert_equal(self.nodes[1].getbalances()['mine']['trusted'], 50) + assert_equal(self.nodes[0].getbalances()['mine']['trusted'], 50000000) + assert_equal(self.nodes[0].getwalletinfo()['balance'], 50000000) + assert_equal(self.nodes[1].getbalances()['mine']['trusted'], 50000000) assert_equal(self.nodes[0].getbalances()[ - 'watchonly']['immature'], 5000) + 'watchonly']['immature'], 5000000000) assert 'watchonly' not in self.nodes[1].getbalances() - assert_equal(self.nodes[0].getbalance(), 50) - assert_equal(self.nodes[1].getbalance(), 50) + assert_equal(self.nodes[0].getbalance(), 50000000) + assert_equal(self.nodes[1].getbalance(), 50000000) self.log.info("Test getbalance with different arguments") - assert_equal(self.nodes[0].getbalance("*"), 50) - assert_equal(self.nodes[0].getbalance("*", 1), 50) - assert_equal(self.nodes[0].getbalance("*", 1, True), 100) - assert_equal(self.nodes[0].getbalance(minconf=1), 50) + assert_equal(self.nodes[0].getbalance("*"), 50000000) + assert_equal(self.nodes[0].getbalance("*", 1), 50000000) + assert_equal(self.nodes[0].getbalance("*", 1, True), 100000000) + assert_equal(self.nodes[0].getbalance(minconf=1), 50000000) assert_equal( self.nodes[0].getbalance( minconf=0, include_watchonly=True), - 100) + 100000000) assert_equal( self.nodes[1].getbalance( minconf=0, include_watchonly=True), - 50) + 50000000) # Send 40 BTC from 0 to 1 and 60 BTC from 1 to 0. txs = create_transactions( - self.nodes[0], self.nodes[1].getnewaddress(), 40, [Decimal('0.01')]) + self.nodes[0], self.nodes[1].getnewaddress(), 40000000, [Decimal('10000')]) self.nodes[0].sendrawtransaction(txs[0]['hex']) # sending on both nodes is faster than waiting for propagation self.nodes[1].sendrawtransaction(txs[0]['hex']) self.sync_all() - txs = create_transactions(self.nodes[1], self.nodes[0].getnewaddress(), 60, [ - Decimal('0.01'), Decimal('0.02')]) + txs = create_transactions(self.nodes[1], self.nodes[0].getnewaddress(), 60000000, [ + Decimal('10000'), Decimal('20000')]) self.nodes[1].sendrawtransaction(txs[0]['hex']) # sending on both nodes is faster than waiting for propagation self.nodes[0].sendrawtransaction(txs[0]['hex']) @@ -164,28 +164,31 @@ def test_balances(*, fee_node_1=0): # getbalances - expected_balances_0 = {'mine': {'immature': Decimal('0E-8'), + expected_balances_0 = {'mine': {'immature': Decimal('0E-2'), # change from node 0's send - 'trusted': Decimal('9.99'), - 'untrusted_pending': Decimal('60.0')}, - 'watchonly': {'immature': Decimal('5000'), - 'trusted': Decimal('50.0'), - 'untrusted_pending': Decimal('0E-8')}} - expected_balances_1 = {'mine': {'immature': Decimal('0E-8'), + 'trusted': Decimal('9990000'), + 'untrusted_pending': Decimal('60000000.0')}, + 'watchonly': {'immature': Decimal('5000000000'), + 'trusted': Decimal('50000000.0'), + 'untrusted_pending': Decimal('0E-2')}} + expected_balances_1 = {'mine': {'immature': Decimal('0E-2'), # node 1's send had an unsafe input - 'trusted': Decimal('0E-8'), + 'trusted': Decimal('0E-2'), # Doesn't include output of node # 0's send since it was spent - 'untrusted_pending': Decimal('30.0') - fee_node_1}} + 'untrusted_pending': Decimal('30000000.0') - fee_node_1}} assert_equal(self.nodes[0].getbalances(), expected_balances_0) assert_equal(self.nodes[1].getbalances(), expected_balances_1) # getbalance without any arguments includes unconfirmed transactions, but not untrusted transactions # change from node 0's send - assert_equal(self.nodes[0].getbalance(), Decimal('9.99')) + assert_equal(self.nodes[0].getbalance(), Decimal('9990000')) # node 1's send had an unsafe input assert_equal(self.nodes[1].getbalance(), Decimal('0')) # Same with minconf=0 - assert_equal(self.nodes[0].getbalance(minconf=0), Decimal('9.99')) + assert_equal( + self.nodes[0].getbalance( + minconf=0), + Decimal('9990000')) assert_equal(self.nodes[1].getbalance(minconf=0), Decimal('0')) # getbalance with a minconf incorrectly excludes coins that have been spent more recently than the minconf blocks ago # TODO: fix getbalance tracking of coin spentness depth @@ -193,20 +196,22 @@ assert_equal(self.nodes[1].getbalance(minconf=1), Decimal('0')) # getunconfirmedbalance # output of node 1's spend - assert_equal(self.nodes[0].getunconfirmedbalance(), Decimal('60')) + assert_equal( + self.nodes[0].getunconfirmedbalance(), + Decimal('60000000')) # Doesn't include output of node 0's send since it was spent assert_equal( self.nodes[1].getunconfirmedbalance(), - Decimal('30') - fee_node_1) + Decimal('30000000') - fee_node_1) # getwalletinfo.unconfirmed_balance assert_equal(self.nodes[0].getwalletinfo()[ - "unconfirmed_balance"], Decimal('60')) + "unconfirmed_balance"], Decimal('60000000')) assert_equal( self.nodes[1].getwalletinfo()["unconfirmed_balance"], - Decimal('30') - fee_node_1) + Decimal('30000000') - fee_node_1) - test_balances(fee_node_1=Decimal('0.01')) + test_balances(fee_node_1=Decimal('10000')) # In the original Core version of this test, Node 1 would've bumped # the fee by 0.01 here to resend, but this is BCH, so it has 0.01 BCH @@ -215,16 +220,16 @@ self.log.info( "Test getbalance and getbalances.mine.untrusted_pending with conflicted unconfirmed inputs") - test_balances(fee_node_1=Decimal('0.01')) + test_balances(fee_node_1=Decimal('10000')) self.nodes[1].generatetoaddress(1, ADDRESS_WATCHONLY) self.sync_all() # balances are correct after the transactions are confirmed # node 1's send plus change from node 0's send - balance_node0 = Decimal('69.99') + balance_node0 = Decimal('69990000') # change from node 0's send - balance_node1 = Decimal('29.99') + balance_node1 = Decimal('29990000') assert_equal(self.nodes[0].getbalances()[ 'mine']['trusted'], balance_node0) assert_equal(self.nodes[1].getbalances()[ @@ -234,7 +239,7 @@ # Send total balance away from node 1 txs = create_transactions(self.nodes[1], self.nodes[0].getnewaddress( - ), Decimal('29.97'), [Decimal('0.01')]) + ), Decimal('29970000'), [Decimal('10000')]) self.nodes[1].sendrawtransaction(txs[0]['hex']) self.nodes[1].generatetoaddress(2, ADDRESS_WATCHONLY) self.sync_all() @@ -245,25 +250,25 @@ assert_equal(self.nodes[1].getbalance(minconf=3), Decimal('0')) # getbalance with minconf=2 will show the new balance. - assert_equal(self.nodes[1].getbalance(minconf=2), Decimal('0.01')) + assert_equal(self.nodes[1].getbalance(minconf=2), Decimal('10000')) # check mempool transactions count for wallet unconfirmed balance after # dynamically loading the wallet. before = self.nodes[1].getbalances()['mine']['untrusted_pending'] dst = self.nodes[1].getnewaddress() self.nodes[1].unloadwallet('') - self.nodes[0].sendtoaddress(dst, 0.1) + self.nodes[0].sendtoaddress(dst, 100000) self.sync_all() self.nodes[1].loadwallet('') after = self.nodes[1].getbalances()['mine']['untrusted_pending'] - assert_equal(before + Decimal('0.1'), after) + assert_equal(before + Decimal('100000'), after) # Create 3 more wallet txs, where the last is not accepted to the # mempool because it is the third descendant of the tx above for _ in range(3): # Set amount high enough such that all coins are spent by each tx txid = self.nodes[0].sendtoaddress( - self.nodes[0].getnewaddress(), 99) + self.nodes[0].getnewaddress(), 99000000) self.log.info('Check that wallet txs not in the mempool are untrusted') assert txid not in self.nodes[0].getrawmempool() @@ -309,7 +314,11 @@ self.nodes[1].generatetoaddress(1, ADDRESS_WATCHONLY) self.sync_all() # The reorg recovered our fee of 1 coin - assert_equal(self.nodes[0].getbalance(minconf=0), total_amount + 1) + assert_equal( + self.nodes[0].getbalance( + minconf=0), + total_amount + + 1000000) if __name__ == '__main__': diff --git a/test/functional/wallet_basic.py b/test/functional/wallet_basic.py --- a/test/functional/wallet_basic.py +++ b/test/functional/wallet_basic.py @@ -58,15 +58,15 @@ self.nodes[0].generate(1) walletinfo = self.nodes[0].getwalletinfo() - assert_equal(walletinfo['immature_balance'], 50) + assert_equal(walletinfo['immature_balance'], 50000000) assert_equal(walletinfo['balance'], 0) self.sync_all(self.nodes[0:3]) self.nodes[1].generate(101) self.sync_all(self.nodes[0:3]) - assert_equal(self.nodes[0].getbalance(), 50) - assert_equal(self.nodes[1].getbalance(), 50) + assert_equal(self.nodes[0].getbalance(), 50000000) + assert_equal(self.nodes[1].getbalance(), 50000000) assert_equal(self.nodes[2].getbalance(), 0) # Check that only first and second nodes have UTXOs @@ -81,21 +81,21 @@ # mempool should appear with or without include_mempool txout = self.nodes[0].gettxout( txid=confirmed_txid, n=confirmed_index, include_mempool=False) - assert_equal(txout['value'], 50) + assert_equal(txout['value'], 50000000) txout = self.nodes[0].gettxout( txid=confirmed_txid, n=confirmed_index, include_mempool=True) - assert_equal(txout['value'], 50) + assert_equal(txout['value'], 50000000) # Send 21 BCH from 0 to 2 using sendtoaddress call. - self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), 11) + self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), 11000000) mempool_txid = self.nodes[0].sendtoaddress( - self.nodes[2].getnewaddress(), 10) + self.nodes[2].getnewaddress(), 10000000) self.log.info("test gettxout (second part)") # utxo spent in mempool should be visible if you exclude mempool # but invisible if you include mempool txout = self.nodes[0].gettxout(confirmed_txid, confirmed_index, False) - assert_equal(txout['value'], 50) + assert_equal(txout['value'], 50000000) txout = self.nodes[0].gettxout(confirmed_txid, confirmed_index, True) assert txout is None # new utxo from mempool should be invisible if you exclude mempool @@ -108,7 +108,7 @@ # but 10 will go to node2 and the rest will go to node0 balance = self.nodes[0].getbalance() assert_equal(set([txout1['value'], txout2['value']]), - set([10, balance])) + set([10000000, balance])) walletinfo = self.nodes[0].getwalletinfo() assert_equal(walletinfo['immature_balance'], 0) @@ -125,7 +125,7 @@ assert_raises_rpc_error(-8, "Invalid parameter, output already locked", self.nodes[2].lockunspent, False, [unspent_0]) assert_raises_rpc_error(-4, "Insufficient funds", - self.nodes[2].sendtoaddress, self.nodes[2].getnewaddress(), 20) + self.nodes[2].sendtoaddress, self.nodes[2].getnewaddress(), 20000000) assert_equal([unspent_0], self.nodes[2].listlockunspent()) self.nodes[2].lockunspent(True, [unspent_0]) assert_equal(len(self.nodes[2].listlockunspent()), 0) @@ -145,7 +145,7 @@ unspent_0 = self.nodes[1].listunspent()[0] self.nodes[1].lockunspent(False, [unspent_0]) tx = self.nodes[1].createrawtransaction( - [unspent_0], {self.nodes[1].getnewaddress(): 1}) + [unspent_0], {self.nodes[1].getnewaddress(): 1000000}) tx = self.nodes[1].fundrawtransaction(tx)['hex'] tx = self.nodes[1].signrawtransactionwithwallet(tx)["hex"] self.nodes[1].sendrawtransaction(tx) @@ -157,8 +157,8 @@ # node0 should end up with 100 btc in block rewards plus fees, but # minus the 21 plus fees sent to node2 - assert_equal(self.nodes[0].getbalance(), 100 - 21) - assert_equal(self.nodes[2].getbalance(), 21) + assert_equal(self.nodes[0].getbalance(), 100000000 - 21000000) + assert_equal(self.nodes[2].getbalance(), 21000000) # Node0 should have two unspent outputs. # Create a couple of transactions to send them to node2, submit them through @@ -172,7 +172,7 @@ inputs = [] outputs = {} inputs.append({"txid": utxo["txid"], "vout": utxo["vout"]}) - outputs[self.nodes[2].getnewaddress()] = utxo["amount"] - 3 + outputs[self.nodes[2].getnewaddress()] = utxo["amount"] - 3000000 raw_tx = self.nodes[0].createrawtransaction(inputs, outputs) txns_to_send.append( self.nodes[0].signrawtransactionwithwallet(raw_tx)) @@ -188,7 +188,7 @@ self.sync_all(self.nodes[0:3]) assert_equal(self.nodes[0].getbalance(), 0) - assert_equal(self.nodes[2].getbalance(), 94) + assert_equal(self.nodes[2].getbalance(), 94000000) # Verify that a spent output cannot be locked anymore spent_0 = {"txid": node0utxos[0]["txid"], @@ -199,48 +199,49 @@ # Send 10 BCH normal old_balance = self.nodes[2].getbalance() address = self.nodes[0].getnewaddress("test") - fee_per_byte = Decimal('0.001') / 1000 + fee_per_byte = Decimal('1000') / 1000 self.nodes[2].settxfee(fee_per_byte * 1000) - txid = self.nodes[2].sendtoaddress(address, 10, "", "", False) + txid = self.nodes[2].sendtoaddress(address, 10000000, "", "", False) self.nodes[2].generate(1) self.sync_all(self.nodes[0:3]) ctx = FromHex(CTransaction(), self.nodes[2].gettransaction(txid)['hex']) - node_2_bal = self.check_fee_amount(self.nodes[2].getbalance(), old_balance - Decimal('10'), + node_2_bal = self.check_fee_amount(self.nodes[2].getbalance(), old_balance - Decimal('10000000'), fee_per_byte, ctx.billable_size()) - assert_equal(self.nodes[0].getbalance(), Decimal('10')) + assert_equal(self.nodes[0].getbalance(), Decimal('10000000')) # Send 10 BCH with subtract fee from amount - txid = self.nodes[2].sendtoaddress(address, 10, "", "", True) + txid = self.nodes[2].sendtoaddress(address, 10000000, "", "", True) self.nodes[2].generate(1) self.sync_all(self.nodes[0:3]) - node_2_bal -= Decimal('10') + node_2_bal -= Decimal('10000000') assert_equal(self.nodes[2].getbalance(), node_2_bal) node_0_bal = self.check_fee_amount(self.nodes[0].getbalance(), Decimal( - '20'), fee_per_byte, count_bytes(self.nodes[2].gettransaction(txid)['hex'])) + '20000000'), fee_per_byte, count_bytes(self.nodes[2].gettransaction(txid)['hex'])) # Sendmany 10 BCH - txid = self.nodes[2].sendmany('', {address: 10}, 0, "", []) + txid = self.nodes[2].sendmany('', {address: 10000000}, 0, "", []) self.nodes[2].generate(1) self.sync_all(self.nodes[0:3]) - node_0_bal += Decimal('10') + node_0_bal += Decimal('10000000') ctx = FromHex(CTransaction(), self.nodes[2].gettransaction(txid)['hex']) node_2_bal = self.check_fee_amount(self.nodes[2].getbalance( - ), node_2_bal - Decimal('10'), fee_per_byte, ctx.billable_size()) + ), node_2_bal - Decimal('10000000'), fee_per_byte, ctx.billable_size()) assert_equal(self.nodes[0].getbalance(), node_0_bal) # Sendmany 10 BCH with subtract fee from amount - txid = self.nodes[2].sendmany('', {address: 10}, 0, "", [address]) + txid = self.nodes[2].sendmany( + '', {address: 10000000}, 0, "", [address]) self.nodes[2].generate(1) self.sync_all(self.nodes[0:3]) - node_2_bal -= Decimal('10') + node_2_bal -= Decimal('10000000') assert_equal(self.nodes[2].getbalance(), node_2_bal) ctx = FromHex(CTransaction(), self.nodes[2].gettransaction(txid)['hex']) node_0_bal = self.check_fee_amount(self.nodes[0].getbalance( - ), node_0_bal + Decimal('10'), fee_per_byte, ctx.billable_size()) + ), node_0_bal + Decimal('10000000'), fee_per_byte, ctx.billable_size()) self.start_node(3, self.extra_args[3]) connect_nodes(self.nodes[0], self.nodes[3]) @@ -252,10 +253,10 @@ # 3. sign and send # 4. check if recipient (node0) can list the zero value tx usp = self.nodes[1].listunspent( - query_options={'minimumAmount': '49.998'})[0] + query_options={'minimumAmount': '49998000'})[0] inputs = [{"txid": usp['txid'], "vout": usp['vout']}] - outputs = {self.nodes[1].getnewaddress(): 49.998, - self.nodes[0].getnewaddress(): 11.11} + outputs = {self.nodes[1].getnewaddress(): 49998000, + self.nodes[0].getnewaddress(): 11110000} rawTx = self.nodes[1].createrawtransaction(inputs, outputs).replace( "c0833842", "00000000") # replace 11.11 with 0.0 (int32) @@ -289,7 +290,7 @@ self.sync_all(self.nodes[0:3]) txid_not_broadcast = self.nodes[0].sendtoaddress( - self.nodes[2].getnewaddress(), 2) + self.nodes[2].getnewaddress(), 2000000) tx_obj_not_broadcast = self.nodes[0].gettransaction(txid_not_broadcast) self.nodes[1].generate(1) # mine a block, tx should not be in there self.sync_all(self.nodes[0:3]) @@ -301,13 +302,13 @@ self.nodes[1].sendrawtransaction(tx_obj_not_broadcast['hex']) self.nodes[1].generate(1) self.sync_all(self.nodes[0:3]) - node_2_bal += 2 + node_2_bal += 2000000 tx_obj_not_broadcast = self.nodes[0].gettransaction(txid_not_broadcast) assert_equal(self.nodes[2].getbalance(), node_2_bal) # create another tx txid_not_broadcast = self.nodes[0].sendtoaddress( - self.nodes[2].getnewaddress(), 2) + self.nodes[2].getnewaddress(), 2000000) # restart the nodes with -walletbroadcast=1 self.stop_nodes() @@ -321,27 +322,28 @@ self.nodes[0].generate(1) self.sync_blocks(self.nodes[0:3]) - node_2_bal += 2 + node_2_bal += 2000000 # tx should be added to balance because after restarting the nodes tx # should be broadcasted assert_equal(self.nodes[2].getbalance(), node_2_bal) # send a tx with value in a string (PR#6380 +) - txid = self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), "2") + txid = self.nodes[0].sendtoaddress( + self.nodes[2].getnewaddress(), "2000000") tx_obj = self.nodes[0].gettransaction(txid) - assert_equal(tx_obj['amount'], Decimal('-2')) + assert_equal(tx_obj['amount'], Decimal('-2000000')) txid = self.nodes[0].sendtoaddress( - self.nodes[2].getnewaddress(), "0.0001") + self.nodes[2].getnewaddress(), "10000") tx_obj = self.nodes[0].gettransaction(txid) - assert_equal(tx_obj['amount'], Decimal('-0.0001')) + assert_equal(tx_obj['amount'], Decimal('-10000')) # check if JSON parser can handle scientific notation in strings txid = self.nodes[0].sendtoaddress( - self.nodes[2].getnewaddress(), "1e-4") + self.nodes[2].getnewaddress(), "1e3") tx_obj = self.nodes[0].gettransaction(txid) - assert_equal(tx_obj['amount'], Decimal('-0.0001')) + assert_equal(tx_obj['amount'], Decimal('-1000')) # General checks for errors from incorrect inputs # This will raise an exception because the amount type is wrong @@ -413,7 +415,7 @@ # Import address and private key to check correct behavior of spendable unspents # 1. Send some coins to generate new UTXO address_to_import = self.nodes[2].getnewaddress() - txid = self.nodes[0].sendtoaddress(address_to_import, 1) + txid = self.nodes[0].sendtoaddress(address_to_import, 1000000) self.nodes[0].generate(1) self.sync_all(self.nodes[0:3]) @@ -512,7 +514,7 @@ node0_balance = self.nodes[0].getbalance() # Split into two chains rawtx = self.nodes[0].createrawtransaction([{"txid": singletxid, "vout": 0}], { - chain_addrs[0]: node0_balance / 2 - Decimal('0.01'), chain_addrs[1]: node0_balance / 2 - Decimal('0.01')}) + chain_addrs[0]: node0_balance / 2 - Decimal('10000'), chain_addrs[1]: node0_balance / 2 - Decimal('10000')}) signedtx = self.nodes[0].signrawtransactionwithwallet(rawtx) singletxid = self.nodes[0].sendrawtransaction( hexstring=signedtx["hex"], maxfeerate=0) @@ -527,14 +529,14 @@ txid_list = [] for i in range(chainlimit * 2): txid_list.append(self.nodes[0].sendtoaddress( - sending_addr, Decimal('0.0001'))) + sending_addr, Decimal('10000'))) assert_equal(self.nodes[0].getmempoolinfo()['size'], chainlimit * 2) assert_equal(len(txid_list), chainlimit * 2) # Without walletrejectlongchains, we will still generate a txid # The tx will be stored in the wallet but not accepted to the mempool extra_txid = self.nodes[0].sendtoaddress( - sending_addr, Decimal('0.0001')) + sending_addr, Decimal('10000')) assert extra_txid not in self.nodes[0].getrawmempool() assert extra_txid in [tx["txid"] for tx in self.nodes[0].listtransactions()] @@ -559,7 +561,7 @@ # With walletrejectlongchains we will not create the tx and store it in # our wallet. assert_raises_rpc_error(-4, "Transaction has too long of a mempool chain", - self.nodes[0].sendtoaddress, sending_addr, node0_balance - Decimal('0.01')) + self.nodes[0].sendtoaddress, sending_addr, node0_balance - Decimal('10000')) # Verify nothing new in wallet assert_equal(total_txs, len( @@ -583,7 +585,7 @@ # Test getaddressinfo 'ischange' field on change address. self.nodes[0].generate(1) destination = self.nodes[1].getnewaddress() - txid = self.nodes[0].sendtoaddress(destination, 0.123) + txid = self.nodes[0].sendtoaddress(destination, 123000) tx = self.nodes[0].decoderawtransaction( self.nodes[0].gettransaction(txid)['hex']) output_addresses = [vout['scriptPubKey']['addresses'][0] diff --git a/test/functional/wallet_create_tx.py b/test/functional/wallet_create_tx.py --- a/test/functional/wallet_create_tx.py +++ b/test/functional/wallet_create_tx.py @@ -34,7 +34,8 @@ self.log.info( 'Check that we have some (old) blocks and that anti-fee-sniping is disabled') assert_equal(self.nodes[0].getblockchaininfo()['blocks'], 200) - txid = self.nodes[0].sendtoaddress(self.nodes[0].getnewaddress(), 1) + txid = self.nodes[0].sendtoaddress( + self.nodes[0].getnewaddress(), 1000000) tx = self.nodes[0].decoderawtransaction( self.nodes[0].gettransaction(txid)['hex']) assert_equal(tx['locktime'], 0) @@ -42,7 +43,8 @@ self.log.info( 'Check that anti-fee-sniping is enabled when we mine a recent block') self.nodes[0].generate(1) - txid = self.nodes[0].sendtoaddress(self.nodes[0].getnewaddress(), 1) + txid = self.nodes[0].sendtoaddress( + self.nodes[0].getnewaddress(), 1000000) tx = self.nodes[0].decoderawtransaction( self.nodes[0].gettransaction(txid)['hex']) assert 0 < tx['locktime'] <= 201 @@ -50,11 +52,11 @@ def test_tx_size_too_large(self): # More than 10kB of outputs, so that we hit -maxtxfee with a high # feerate - outputs = {self.nodes[0].getnewaddress(): 0.000025 for i in range(400)} + outputs = {self.nodes[0].getnewaddress(): 25 for i in range(400)} raw_tx = self.nodes[0].createrawtransaction(inputs=[], outputs=outputs) - for fee_setting in ['-minrelaytxfee=0.01', - '-mintxfee=0.01', '-paytxfee=0.01']: + for fee_setting in ['-minrelaytxfee=10000', + '-mintxfee=10000', '-paytxfee=10000']: self.log.info( 'Check maxtxfee in combination with {}'.format(fee_setting)) self.restart_node(0, extra_args=[fee_setting]) @@ -71,7 +73,7 @@ self.log.info('Check maxtxfee in combination with settxfee') self.restart_node(0) - self.nodes[0].settxfee(0.01) + self.nodes[0].settxfee(10000) assert_raises_rpc_error( -6, "Fee exceeds maximum configured by -maxtxfee", diff --git a/test/functional/wallet_groups.py b/test/functional/wallet_groups.py --- a/test/functional/wallet_groups.py +++ b/test/functional/wallet_groups.py @@ -17,7 +17,7 @@ self.setup_clean_chain = True self.num_nodes = 4 self.extra_args = [ - [], [], ['-avoidpartialspends'], ["-maxapsfee=0.0001"]] + [], [], ['-avoidpartialspends'], ["-maxapsfee=100"]] self.rpc_timeout = 120 self.supports_cli = False @@ -34,8 +34,8 @@ addrs = addr1 + addr2 # Send 1 + 0.5 coin to each address - [self.nodes[0].sendtoaddress(addr, 1.0) for addr in addrs] - [self.nodes[0].sendtoaddress(addr, 0.5) for addr in addrs] + [self.nodes[0].sendtoaddress(addr, 1000000) for addr in addrs] + [self.nodes[0].sendtoaddress(addr, 500000) for addr in addrs] self.nodes[0].generate(1) self.sync_all() @@ -44,25 +44,27 @@ # - node[1] should pick one 0.5 UTXO and leave the rest # - node[2] should pick one (1.0 + 0.5) UTXO group corresponding to a # given address, and leave the rest - txid1 = self.nodes[1].sendtoaddress(self.nodes[0].getnewaddress(), 0.2) + txid1 = self.nodes[1].sendtoaddress( + self.nodes[0].getnewaddress(), 200000) tx1 = self.nodes[1].getrawtransaction(txid1, True) # txid1 should have 1 input and 2 outputs assert_equal(1, len(tx1["vin"])) assert_equal(2, len(tx1["vout"])) # one output should be 0.2, the other should be ~0.3 v = sorted([vout["value"] for vout in tx1["vout"]]) - assert_approx(v[0], 0.2) - assert_approx(v[1], 0.3, 0.0001) + assert_approx(v[0], 200000) + assert_approx(v[1], 300000, 100) - txid2 = self.nodes[2].sendtoaddress(self.nodes[0].getnewaddress(), 0.2) + txid2 = self.nodes[2].sendtoaddress( + self.nodes[0].getnewaddress(), 200000) tx2 = self.nodes[2].getrawtransaction(txid2, True) # txid2 should have 2 inputs and 2 outputs assert_equal(2, len(tx2["vin"])) assert_equal(2, len(tx2["vout"])) # one output should be 0.2, the other should be ~1.3 v = sorted([vout["value"] for vout in tx2["vout"]]) - assert_approx(v[0], 0.2) - assert_approx(v[1], 1.3, 0.0001) + assert_approx(v[0], 200000) + assert_approx(v[1], 1300000, 100) # Test 'avoid partial if warranted, even if disabled' self.sync_all() @@ -75,13 +77,14 @@ # - C0 1.0 - E1 0.5 # - C1 0.5 - F ~1.3 # - D ~0.3 - assert_approx(self.nodes[1].getbalance(), 4.3, 0.0001) - assert_approx(self.nodes[2].getbalance(), 4.3, 0.0001) + assert_approx(self.nodes[1].getbalance(), 4300000, 100) + assert_approx(self.nodes[2].getbalance(), 4300000, 100) # Sending 1.4 btc should pick one 1.0 + one more. For node #1, # this could be (A / B0 / C0) + (B1 / C1 / D). We ensure that it is # B0 + B1 or C0 + C1, because this avoids partial spends while not being # detrimental to transaction cost - txid3 = self.nodes[1].sendtoaddress(self.nodes[0].getnewaddress(), 1.4) + txid3 = self.nodes[1].sendtoaddress( + self.nodes[0].getnewaddress(), 1400000) tx3 = self.nodes[1].getrawtransaction(txid3, True) # tx3 should have 2 inputs and 2 outputs assert_equal(2, len(tx3["vin"])) @@ -89,8 +92,8 @@ # the accumulated value should be 1.5, so the outputs should be # ~0.1 and 1.4 and should come from the same destination values = sorted([vout["value"] for vout in tx3["vout"]]) - assert_approx(values[0], 0.1, 0.0001) - assert_approx(values[1], 1.4) + assert_approx(values[0], 100000, 100) + assert_approx(values[1], 1400000) input_txids = [vin["txid"] for vin in tx3["vin"]] input_addrs = [self.nodes[1].gettransaction( @@ -100,11 +103,12 @@ # Test wallet option maxapsfee with Node 3 addr_aps = self.nodes[3].getnewaddress() - self.nodes[0].sendtoaddress(addr_aps, 1.0) - self.nodes[0].sendtoaddress(addr_aps, 1.0) + self.nodes[0].sendtoaddress(addr_aps, 1000000) + self.nodes[0].sendtoaddress(addr_aps, 1000000) self.nodes[0].generate(1) self.sync_all() - txid4 = self.nodes[3].sendtoaddress(self.nodes[0].getnewaddress(), 0.1) + txid4 = self.nodes[3].sendtoaddress( + self.nodes[0].getnewaddress(), 100000) tx4 = self.nodes[3].getrawtransaction(txid4, True) # tx4 should have 2 inputs and 2 outputs although one output would # have been enough and the transaction caused higher fees @@ -121,7 +125,7 @@ # scriptPubKey for i in range(5): raw_tx = self.nodes[0].createrawtransaction( - [{"txid": "0" * 64, "vout": 0}], [{addr2[0]: 0.05}]) + [{"txid": "0" * 64, "vout": 0}], [{addr2[0]: 50000}]) tx = FromHex(CTransaction(), raw_tx) tx.vin = [] tx.vout = [tx.vout[0]] * 2000 @@ -136,7 +140,7 @@ # Check that we can create a transaction that only requires ~100 of our # utxos, without pulling in all outputs and creating a transaction that # is way too big. - assert self.nodes[2].sendtoaddress(address=addr2[0], amount=5) + assert self.nodes[2].sendtoaddress(address=addr2[0], amount=5000000) if __name__ == '__main__': diff --git a/test/functional/wallet_hd.py b/test/functional/wallet_hd.py --- a/test/functional/wallet_hd.py +++ b/test/functional/wallet_hd.py @@ -55,9 +55,9 @@ hd_info = self.nodes[1].getaddressinfo(hd_add) assert_equal(hd_info["hdkeypath"], "m/0'/0'/" + str(i) + "'") assert_equal(hd_info["hdseedid"], masterkeyid) - self.nodes[0].sendtoaddress(hd_add, 1) + self.nodes[0].sendtoaddress(hd_add, 1000000) self.nodes[0].generate(1) - self.nodes[0].sendtoaddress(non_hd_add, 1) + self.nodes[0].sendtoaddress(non_hd_add, 1000000) self.nodes[0].generate(1) # create an internal key (again) @@ -67,7 +67,9 @@ assert_equal(change_addrV["hdkeypath"], "m/0'/1'/1'") self.sync_all() - assert_equal(self.nodes[1].getbalance(), NUM_HD_ADDS + 1) + assert_equal( + self.nodes[1].getbalance(), + (NUM_HD_ADDS * 1000000) + 1000000) self.log.info("Restore backup ...") self.stop_node(1) @@ -98,7 +100,9 @@ # Needs rescan self.restart_node(1, extra_args=self.extra_args[1] + ['-rescan']) - assert_equal(self.nodes[1].getbalance(), NUM_HD_ADDS + 1) + assert_equal( + self.nodes[1].getbalance(), + (NUM_HD_ADDS * 1000000) + 1000000) # Try a RPC based rescan self.stop_node(1) @@ -115,7 +119,9 @@ connect_nodes(self.nodes[0], self.nodes[1]) self.sync_all() # Wallet automatically scans blocks older than key on startup - assert_equal(self.nodes[1].getbalance(), NUM_HD_ADDS + 1) + assert_equal( + self.nodes[1].getbalance(), + (NUM_HD_ADDS * 1000000) + 1000000) out = self.nodes[1].rescanblockchain(0, 1) assert_equal(out['start_height'], 0) assert_equal(out['stop_height'], 1) @@ -128,16 +134,19 @@ out = self.nodes[1].rescanblockchain() assert_equal(out['start_height'], 0) assert_equal(out['stop_height'], self.nodes[1].getblockcount()) - assert_equal(self.nodes[1].getbalance(), NUM_HD_ADDS + 1) + assert_equal( + self.nodes[1].getbalance(), + (NUM_HD_ADDS * 1000000) + 1000000) # send a tx and make sure its using the internal chain for the # changeoutput - txid = self.nodes[1].sendtoaddress(self.nodes[0].getnewaddress(), 1) + txid = self.nodes[1].sendtoaddress( + self.nodes[0].getnewaddress(), 1000000) outs = self.nodes[1].decoderawtransaction( self.nodes[1].gettransaction(txid)['hex'])['vout'] keypath = "" for out in outs: - if out['value'] != 1: + if out['value'] != 1000000: keypath = self.nodes[1].getaddressinfo( out['scriptPubKey']['addresses'][0])['hdkeypath'] @@ -251,7 +260,7 @@ # Send a transaction to addr, which is out of the initial keypool. # The wallet that has set a new seed (restore_rpc) should not # detect this transaction. - txid = self.nodes[0].sendtoaddress(addr, 1) + txid = self.nodes[0].sendtoaddress(addr, 1000000) origin_rpc.sendrawtransaction( self.nodes[0].gettransaction(txid)['hex']) self.nodes[0].generate(1) @@ -268,7 +277,7 @@ # transaction and generate 3 new keys from the initial seed. # The previous transaction (out_of_kp_txid) should still not be # detected as a rescan is required. - txid = self.nodes[0].sendtoaddress(last_addr, 1) + txid = self.nodes[0].sendtoaddress(last_addr, 1000000) origin_rpc.sendrawtransaction( self.nodes[0].gettransaction(txid)['hex']) self.nodes[0].generate(1) diff --git a/test/functional/wallet_import_rescan.py b/test/functional/wallet_import_rescan.py --- a/test/functional/wallet_import_rescan.py +++ b/test/functional/wallet_import_rescan.py @@ -139,12 +139,12 @@ # Rescans start at the earliest block up to 2 hours before the key timestamp. TIMESTAMP_WINDOW = 2 * 60 * 60 -AMOUNT_DUST = 0.00000546 +AMOUNT_DUST = 5.46 def get_rand_amount(): - r = random.uniform(AMOUNT_DUST, 1) - return Decimal(str(round(r, 8))) + r = random.uniform(AMOUNT_DUST, 1000000) + return Decimal(str(round(r, 2))) class ImportRescanTest(BitcoinTestFramework): diff --git a/test/functional/wallet_importdescriptors.py b/test/functional/wallet_importdescriptors.py --- a/test/functional/wallet_importdescriptors.py +++ b/test/functional/wallet_importdescriptors.py @@ -276,11 +276,11 @@ address, solvable=True, ismine=True) - txid = w0.sendtoaddress(address, 49.99999600) + txid = w0.sendtoaddress(address, 49999996.00) w0.generatetoaddress(6, w0.getnewaddress()) self.sync_blocks() tx = wpriv.createrawtransaction([{"txid": txid, "vout": 0}], { - w0.getnewaddress(): 49.999}) + w0.getnewaddress(): 49999000}) signed_tx = wpriv.signrawtransactionwithwallet(tx) w1.sendrawtransaction(signed_tx['hex']) @@ -324,7 +324,7 @@ 'ecregtest:prnkfg7pxe3kpyv3l4v00ft6q3sfseag7vnva0k49n') assert_equal(wmulti_priv.getwalletinfo()['keypoolsize'], 1000) - txid = w0.sendtoaddress(addr, 10) + txid = w0.sendtoaddress(addr, 10000000) self.nodes[0].generate(6) self.sync_all() @@ -366,7 +366,7 @@ 'ecregtest:prnkfg7pxe3kpyv3l4v00ft6q3sfseag7vnva0k49n') assert_equal(wmulti_pub.getwalletinfo()['keypoolsize'], 999) - txid = w0.sendtoaddress(addr, 10) + txid = w0.sendtoaddress(addr, 10000000) vout = find_vout_for_address(self.nodes[0], txid, addr) self.nodes[0].generate(6) self.sync_all() @@ -433,7 +433,7 @@ 'Not all private keys provided. Some wallet functionality may return unexpected errors') rawtx = self.nodes[1].createrawtransaction( - [{'txid': txid, 'vout': vout}], {w0.getnewaddress(): 9.999}) + [{'txid': txid, 'vout': vout}], {w0.getnewaddress(): 9999000}) tx_signed_1 = wmulti_priv1.signrawtransactionwithwallet(rawtx) assert_equal(tx_signed_1['complete'], False) tx_signed_2 = wmulti_priv2.signrawtransactionwithwallet( diff --git a/test/functional/wallet_importprunedfunds.py b/test/functional/wallet_importprunedfunds.py --- a/test/functional/wallet_importprunedfunds.py +++ b/test/functional/wallet_importprunedfunds.py @@ -56,17 +56,17 @@ assert_equal(address_info['ismine'], False) # Send funds to self - txnid1 = self.nodes[0].sendtoaddress(address1, 0.1) + txnid1 = self.nodes[0].sendtoaddress(address1, 100000) self.nodes[0].generate(1) rawtxn1 = self.nodes[0].gettransaction(txnid1)['hex'] proof1 = self.nodes[0].gettxoutproof([txnid1]) - txnid2 = self.nodes[0].sendtoaddress(address2, 0.05) + txnid2 = self.nodes[0].sendtoaddress(address2, 50000) self.nodes[0].generate(1) rawtxn2 = self.nodes[0].gettransaction(txnid2)['hex'] proof2 = self.nodes[0].gettxoutproof([txnid2]) - txnid3 = self.nodes[0].sendtoaddress(address3, 0.025) + txnid3 = self.nodes[0].sendtoaddress(address3, 25000) self.nodes[0].generate(1) rawtxn3 = self.nodes[0].gettransaction(txnid3)['hex'] proof3 = self.nodes[0].gettxoutproof([txnid3]) @@ -93,7 +93,7 @@ assert [tx for tx in self.nodes[1].listtransactions() if tx['txid'] == txnid3] balance3 = self.nodes[1].getbalance() - assert_equal(balance3, Decimal('0.025')) + assert_equal(balance3, Decimal('25000')) # Addresses Test - after import address_info = self.nodes[1].getaddressinfo(address1) diff --git a/test/functional/wallet_keypool.py b/test/functional/wallet_keypool.py --- a/test/functional/wallet_keypool.py +++ b/test/functional/wallet_keypool.py @@ -105,7 +105,7 @@ assert_equal(res[0]['success'], True) w1.walletpassphrase('test', 100) - res = w1.sendtoaddress(address=address, amount=0.00010000) + res = w1.sendtoaddress(address=address, amount=100.00) nodes[0].generate(1) destination = addr.pop() @@ -115,53 +115,53 @@ "Transaction needs a change address, but we can't generate it. Please call keypoolrefill first.", w2.walletcreatefundedpsbt, inputs=[], - outputs=[{addr.pop(): 0.00005000}], + outputs=[{addr.pop(): 50.00}], options={"subtractFeeFromOutputs": [0], - "feeRate": 0.00010}) + "feeRate": 100}) # creating a 10,000 sat transaction without change, with a manual # input, should still be possible res = w2.walletcreatefundedpsbt( inputs=w2.listunspent(), - outputs=[{destination: 0.00010000}], - options={"subtractFeeFromOutputs": [0], "feeRate": 0.00010}) + outputs=[{destination: 100.00}], + options={"subtractFeeFromOutputs": [0], "feeRate": 100}) assert_equal("psbt" in res, True) # creating a 10,000 sat transaction without change should still be # possible res = w2.walletcreatefundedpsbt( inputs=[], - outputs=[{destination: 0.00010000}], - options={"subtractFeeFromOutputs": [0], "feeRate": 0.00010}) + outputs=[{destination: 100.00}], + options={"subtractFeeFromOutputs": [0], "feeRate": 100}) assert_equal("psbt" in res, True) # should work without subtractFeeFromOutputs if the exact fee is # subtracted from the amount res = w2.walletcreatefundedpsbt(inputs=[], - outputs=[{destination: 0.00008000}], - options={"feeRate": 0.00010}) + outputs=[{destination: 80.00}], + options={"feeRate": 100}) assert_equal("psbt" in res, True) # dust change should be removed res = w2.walletcreatefundedpsbt(inputs=[], - outputs=[{destination: 0.00007900}], - options={"feeRate": 0.00010}) + outputs=[{destination: 79.00}], + options={"feeRate": 100}) assert_equal("psbt" in res, True) # create a transaction without change at the maximum fee rate, such # that the output is still spendable: res = w2.walletcreatefundedpsbt( inputs=[], - outputs=[{destination: 0.00010000}], - options={"subtractFeeFromOutputs": [0], "feeRate": 0.0004949}) + outputs=[{destination: 100.00}], + options={"subtractFeeFromOutputs": [0], "feeRate": 494.90}) assert_equal("psbt" in res, True) - assert_equal(res["fee"], Decimal("0.00009453")) + assert_equal(res["fee"], Decimal("94.53")) # creating a 10,000 sat transaction with a manual change address should # be possible res = w2.walletcreatefundedpsbt(inputs=[], - outputs=[{destination: 0.00010000}], + outputs=[{destination: 100.00}], options={"subtractFeeFromOutputs": [0], - "feeRate": 0.00010, + "feeRate": 100, "changeAddress": addr.pop()}) assert_equal("psbt" in res, True) diff --git a/test/functional/wallet_keypool_topup.py b/test/functional/wallet_keypool_topup.py --- a/test/functional/wallet_keypool_topup.py +++ b/test/functional/wallet_keypool_topup.py @@ -48,9 +48,9 @@ addr_extpool = self.nodes[1].getnewaddress() self.log.info("Send funds to wallet") - self.nodes[0].sendtoaddress(addr_oldpool, 10) + self.nodes[0].sendtoaddress(addr_oldpool, 10000000) self.nodes[0].generate(1) - self.nodes[0].sendtoaddress(addr_extpool, 5) + self.nodes[0].sendtoaddress(addr_extpool, 5000000) self.nodes[0].generate(1) self.sync_blocks() @@ -62,7 +62,7 @@ self.sync_all() self.log.info("Verify keypool is restored and balance is correct") - assert_equal(self.nodes[1].getbalance(), 15) + assert_equal(self.nodes[1].getbalance(), 15000000) assert_equal(self.nodes[1].listtransactions() [0]['category'], "receive") # Check that we have marked all keys up to the used keypool key as used diff --git a/test/functional/wallet_labels.py b/test/functional/wallet_labels.py --- a/test/functional/wallet_labels.py +++ b/test/functional/wallet_labels.py @@ -38,7 +38,7 @@ nblocks=101, address=node.getnewaddress( label='coinbase')) - assert_equal(node.getbalance(), 100) + assert_equal(node.getbalance(), 100000000) # there should be 2 address groups # each with 1 address with a balance of 50 Bitcoins @@ -50,14 +50,14 @@ for address_group in address_groups: assert_equal(len(address_group), 1) assert_equal(len(address_group[0]), 3) - assert_equal(address_group[0][1], 50) + assert_equal(address_group[0][1], 50000000) assert_equal(address_group[0][2], 'coinbase') linked_addresses.add(address_group[0][0]) # send 50 from each address to a third address not in this wallet common_address = "msf4WtN1YQKXvNtvdFYt9JBnUD2FB41kjr" node.sendmany( - amounts={common_address: 100}, + amounts={common_address: 100000000}, subtractfeefrom=[common_address], minconf=1, ) @@ -74,7 +74,7 @@ # we want to reset so that the "" label has what's expected. # otherwise we're off by exactly the fee amount as that's mined # and matures in the next 100 blocks - amount_to_send = 1.0 + amount_to_send = 1000000 # Create labels and make sure subsequent label API calls # recognize the label/address associations. @@ -109,7 +109,7 @@ address = node.getnewaddress(label.name) label.add_receive_address(address) label.verify(node) - assert_equal(node.getreceivedbylabel(label.name), 2) + assert_equal(node.getreceivedbylabel(label.name), 2000000) label.verify(node) node.generate(101) diff --git a/test/functional/wallet_listreceivedby.py b/test/functional/wallet_listreceivedby.py --- a/test/functional/wallet_listreceivedby.py +++ b/test/functional/wallet_listreceivedby.py @@ -39,7 +39,7 @@ # Send from node 0 to 1 addr = self.nodes[1].getnewaddress() - txid = self.nodes[0].sendtoaddress(addr, 0.1) + txid = self.nodes[0].sendtoaddress(addr, 100000) self.sync_all() # Check not listed in listreceivedbyaddress because has 0 confirmations @@ -53,11 +53,11 @@ self.sync_all() assert_array_result(self.nodes[1].listreceivedbyaddress(), {"address": addr}, - {"address": addr, "label": "", "amount": Decimal("0.1"), "confirmations": 10, "txids": [txid, ]}) + {"address": addr, "label": "", "amount": Decimal("100000"), "confirmations": 10, "txids": [txid, ]}) # With min confidence < 10 assert_array_result(self.nodes[1].listreceivedbyaddress(5), {"address": addr}, - {"address": addr, "label": "", "amount": Decimal("0.1"), "confirmations": 10, "txids": [txid, ]}) + {"address": addr, "label": "", "amount": Decimal("100000"), "confirmations": 10, "txids": [txid, ]}) # With min confidence > 10, should not find Tx assert_array_result(self.nodes[1].listreceivedbyaddress(11), { "address": addr}, {}, True) @@ -71,7 +71,7 @@ # Test Address filtering # Only on addr expected = {"address": addr, "label": "", "amount": Decimal( - "0.1"), "confirmations": 10, "txids": [txid, ]} + "100000"), "confirmations": 10, "txids": [txid, ]} res = self.nodes[1].listreceivedbyaddress( minconf=0, include_empty=True, include_watchonly=True, address_filter=addr) assert_array_result(res, {"address": addr}, expected) @@ -88,18 +88,18 @@ # Right now 2 entries assert_equal(len(res), 2 + num_cb_reward_addresses) other_addr = self.nodes[1].getnewaddress() - txid2 = self.nodes[0].sendtoaddress(other_addr, 0.1) + txid2 = self.nodes[0].sendtoaddress(other_addr, 100000) self.nodes[0].generate(1) self.sync_all() # Same test as above should still pass expected = {"address": addr, "label": "", "amount": Decimal( - "0.1"), "confirmations": 11, "txids": [txid, ]} + "100000"), "confirmations": 11, "txids": [txid, ]} res = self.nodes[1].listreceivedbyaddress(0, True, True, addr) assert_array_result(res, {"address": addr}, expected) assert_equal(len(res), 1) # Same test as above but with other_addr should still pass expected = {"address": other_addr, "label": "", "amount": Decimal( - "0.1"), "confirmations": 1, "txids": [txid2, ]} + "100000"), "confirmations": 1, "txids": [txid2, ]} res = self.nodes[1].listreceivedbyaddress(0, True, True, other_addr) assert_array_result(res, {"address": other_addr}, expected) assert_equal(len(res), 1) @@ -118,7 +118,7 @@ # Send from node 0 to 1 addr = self.nodes[1].getnewaddress() - txid = self.nodes[0].sendtoaddress(addr, 0.1) + txid = self.nodes[0].sendtoaddress(addr, 100000) self.sync_all() # Check balance is 0 because of 0 confirmations @@ -127,14 +127,14 @@ # Check balance is 0.1 balance = self.nodes[1].getreceivedbyaddress(addr, 0) - assert_equal(balance, Decimal("0.1")) + assert_equal(balance, Decimal("100000")) # Bury Tx under 10 block so it will be returned by the default # getreceivedbyaddress self.nodes[1].generate(10) self.sync_all() balance = self.nodes[1].getreceivedbyaddress(addr) - assert_equal(balance, Decimal("0.1")) + assert_equal(balance, Decimal("100000")) # Trying to getreceivedby for an address the wallet doesn't own should # return an error @@ -151,7 +151,7 @@ r for r in self.nodes[1].listreceivedbylabel() if r["label"] == label][0] balance_by_label = self.nodes[1].getreceivedbylabel(label) - txid = self.nodes[0].sendtoaddress(addr, 0.1) + txid = self.nodes[0].sendtoaddress(addr, 100000) self.sync_all() # listreceivedbylabel should return received_by_label_json because of 0 @@ -170,11 +170,11 @@ # listreceivedbylabel should return updated received list assert_array_result(self.nodes[1].listreceivedbylabel(), {"label": label}, - {"label": received_by_label_json["label"], "amount": (received_by_label_json["amount"] + Decimal("0.1"))}) + {"label": received_by_label_json["label"], "amount": (received_by_label_json["amount"] + Decimal("100000"))}) # getreceivedbylabel should return updated receive total balance = self.nodes[1].getreceivedbylabel(label) - assert_equal(balance, balance_by_label + Decimal("0.1")) + assert_equal(balance, balance_by_label + Decimal("100000")) # Create a new label named "mynewlabel" that has a 0 balance address = self.nodes[1].getnewaddress() diff --git a/test/functional/wallet_listsinceblock.py b/test/functional/wallet_listsinceblock.py --- a/test/functional/wallet_listsinceblock.py +++ b/test/functional/wallet_listsinceblock.py @@ -37,7 +37,8 @@ def test_no_blockhash(self): self.log.info("Test no blockhash") - txid = self.nodes[2].sendtoaddress(self.nodes[0].getnewaddress(), 1) + txid = self.nodes[2].sendtoaddress( + self.nodes[0].getnewaddress(), 1000000) blockhash, = self.nodes[2].generate(1) blockheight = self.nodes[2].getblockheader(blockhash)['height'] self.sync_all() @@ -45,7 +46,7 @@ txs = self.nodes[0].listtransactions() assert_array_result(txs, {"txid": txid}, { "category": "receive", - "amount": 1, + "amount": 1000000, "blockhash": blockhash, "blockheight": blockheight, "confirmations": 1, @@ -106,7 +107,8 @@ self.split_network() # send to nodes[0] from nodes[2] - senttx = self.nodes[2].sendtoaddress(self.nodes[0].getnewaddress(), 1) + senttx = self.nodes[2].sendtoaddress( + self.nodes[0].getnewaddress(), 1000000) # generate on both sides nodes1_last_blockhash = self.nodes[1].generate(6)[-1] @@ -174,9 +176,9 @@ self.nodes[1].importprivkey(privkey) # send from nodes[1] using utxo to nodes[0] - change = '{:.8f}'.format(float(utxo['amount']) - 1.0003) + change = '{:.2f}'.format(float(utxo['amount']) - 1000300.00) recipient_dict = { - self.nodes[0].getnewaddress(): 1, + self.nodes[0].getnewaddress(): 1000000, self.nodes[1].getnewaddress(): change, } utxo_dicts = [{ @@ -189,7 +191,7 @@ # send from nodes[2] using utxo to nodes[3] recipient_dict2 = { - self.nodes[3].getnewaddress(): 1, + self.nodes[3].getnewaddress(): 1000000, self.nodes[2].getnewaddress(): change, } self.nodes[2].sendrawtransaction( @@ -253,9 +255,9 @@ # create and sign a transaction utxos = self.nodes[2].listunspent() utxo = utxos[0] - change = '{:.8f}'.format(float(utxo['amount']) - 1.0003) + change = '{:.2f}'.format(float(utxo['amount']) - 1000300.00) recipient_dict = { - self.nodes[0].getnewaddress(): 1, + self.nodes[0].getnewaddress(): 1000000, self.nodes[2].getnewaddress(): change, } utxo_dicts = [{ diff --git a/test/functional/wallet_listtransactions.py b/test/functional/wallet_listtransactions.py --- a/test/functional/wallet_listtransactions.py +++ b/test/functional/wallet_listtransactions.py @@ -24,64 +24,70 @@ # Leave IBD self.nodes[0].generate(1) # Simple send, 0 to 1: - txid = self.nodes[0].sendtoaddress(self.nodes[1].getnewaddress(), 0.1) + txid = self.nodes[0].sendtoaddress( + self.nodes[1].getnewaddress(), 100000) self.sync_all() assert_array_result(self.nodes[0].listtransactions(), {"txid": txid}, - {"category": "send", "amount": Decimal("-0.1"), "confirmations": 0}) + {"category": "send", "amount": Decimal("-100000"), "confirmations": 0}) assert_array_result(self.nodes[1].listtransactions(), {"txid": txid}, - {"category": "receive", "amount": Decimal("0.1"), "confirmations": 0}) + {"category": "receive", "amount": Decimal("100000"), "confirmations": 0}) # mine a block, confirmations should change: blockhash = self.nodes[0].generate(1)[0] blockheight = self.nodes[0].getblockheader(blockhash)['height'] self.sync_all() assert_array_result(self.nodes[0].listtransactions(), {"txid": txid}, - {"category": "send", "amount": Decimal("-0.1"), "confirmations": 1, "blockhash": blockhash, "blockheight": blockheight}) + {"category": "send", "amount": Decimal("-100000"), "confirmations": 1, "blockhash": blockhash, "blockheight": blockheight}) assert_array_result(self.nodes[1].listtransactions(), {"txid": txid}, - {"category": "receive", "amount": Decimal("0.1"), "confirmations": 1, "blockhash": blockhash, "blockheight": blockheight}) + {"category": "receive", "amount": Decimal("100000"), "confirmations": 1, "blockhash": blockhash, "blockheight": blockheight}) # send-to-self: - txid = self.nodes[0].sendtoaddress(self.nodes[0].getnewaddress(), 0.2) + txid = self.nodes[0].sendtoaddress( + self.nodes[0].getnewaddress(), 200000) assert_array_result(self.nodes[0].listtransactions(), {"txid": txid, "category": "send"}, - {"amount": Decimal("-0.2")}) + {"amount": Decimal("-200000")}) assert_array_result(self.nodes[0].listtransactions(), {"txid": txid, "category": "receive"}, - {"amount": Decimal("0.2")}) + {"amount": Decimal("200000")}) # sendmany from node1: twice to self, twice to node2: - send_to = {self.nodes[0].getnewaddress(): 0.11, - self.nodes[1].getnewaddress(): 0.22, - self.nodes[0].getnewaddress(): 0.33, - self.nodes[1].getnewaddress(): 0.44} + send_to = {self.nodes[0].getnewaddress(): 110000, + self.nodes[1].getnewaddress(): 220000, + self.nodes[0].getnewaddress(): 330000, + self.nodes[1].getnewaddress(): 440000} txid = self.nodes[1].sendmany("", send_to) self.sync_all() assert_array_result(self.nodes[1].listtransactions(), - {"category": "send", "amount": Decimal("-0.11")}, + {"category": "send", "amount": Decimal("-110000")}, {"txid": txid}) assert_array_result(self.nodes[0].listtransactions(), - {"category": "receive", "amount": Decimal("0.11")}, + {"category": "receive", + "amount": Decimal("110000")}, {"txid": txid}) assert_array_result(self.nodes[1].listtransactions(), - {"category": "send", "amount": Decimal("-0.22")}, + {"category": "send", "amount": Decimal("-220000")}, {"txid": txid}) assert_array_result(self.nodes[1].listtransactions(), - {"category": "receive", "amount": Decimal("0.22")}, + {"category": "receive", + "amount": Decimal("220000")}, {"txid": txid}) assert_array_result(self.nodes[1].listtransactions(), - {"category": "send", "amount": Decimal("-0.33")}, + {"category": "send", "amount": Decimal("-330000")}, {"txid": txid}) assert_array_result(self.nodes[0].listtransactions(), - {"category": "receive", "amount": Decimal("0.33")}, + {"category": "receive", + "amount": Decimal("330000")}, {"txid": txid}) assert_array_result(self.nodes[1].listtransactions(), - {"category": "send", "amount": Decimal("-0.44")}, + {"category": "send", "amount": Decimal("-440000")}, {"txid": txid}) assert_array_result(self.nodes[1].listtransactions(), - {"category": "receive", "amount": Decimal("0.44")}, + {"category": "receive", + "amount": Decimal("440000")}, {"txid": txid}) pubkey = self.nodes[1].getaddressinfo( @@ -89,7 +95,7 @@ multisig = self.nodes[1].createmultisig(1, [pubkey]) self.nodes[0].importaddress( multisig["redeemScript"], "watchonly", False, True) - txid = self.nodes[1].sendtoaddress(multisig["address"], 0.1) + txid = self.nodes[1].sendtoaddress(multisig["address"], 100000) self.nodes[1].generate(1) self.sync_all() assert_equal(len(self.nodes[0].listtransactions( @@ -102,7 +108,8 @@ count=100, include_watchonly=False)) == 0 assert_array_result(self.nodes[0].listtransactions(label="watchonly", count=100, include_watchonly=True), - {"category": "receive", "amount": Decimal("0.1")}, + {"category": "receive", + "amount": Decimal("100000")}, {"txid": txid, "label": "watchonly"}) diff --git a/test/functional/wallet_multiwallet.py b/test/functional/wallet_multiwallet.py --- a/test/functional/wallet_multiwallet.py +++ b/test/functional/wallet_multiwallet.py @@ -173,7 +173,7 @@ assert_equal(set(node.listwallets()), {"w4", "w5"}) w5 = wallet("w5") w5_info = w5.getwalletinfo() - assert_equal(w5_info['immature_balance'], 50) + assert_equal(w5_info['immature_balance'], 50000000) competing_wallet_dir = os.path.join( self.options.tmpdir, 'competing_walletdir') @@ -196,7 +196,7 @@ for wallet_name, wallet in zip(wallet_names, wallets): info = wallet.getwalletinfo() assert_equal(info['immature_balance'], - 50 if wallet is wallets[0] else 0) + 50000000 if wallet is wallets[0] else 0) assert_equal(info['walletname'], wallet_name) # accessing invalid wallet fails @@ -209,18 +209,18 @@ w1, w2, w3, w4, *_ = wallets node.generatetoaddress(nblocks=101, address=w1.getnewaddress()) - assert_equal(w1.getbalance(), 100) + assert_equal(w1.getbalance(), 100000000) assert_equal(w2.getbalance(), 0) assert_equal(w3.getbalance(), 0) assert_equal(w4.getbalance(), 0) - w1.sendtoaddress(w2.getnewaddress(), 1) - w1.sendtoaddress(w3.getnewaddress(), 2) - w1.sendtoaddress(w4.getnewaddress(), 3) + w1.sendtoaddress(w2.getnewaddress(), 1000000) + w1.sendtoaddress(w3.getnewaddress(), 2000000) + w1.sendtoaddress(w4.getnewaddress(), 3000000) node.generatetoaddress(nblocks=1, address=w1.getnewaddress()) - assert_equal(w2.getbalance(), 1) - assert_equal(w3.getbalance(), 2) - assert_equal(w4.getbalance(), 3) + assert_equal(w2.getbalance(), 1000000) + assert_equal(w3.getbalance(), 2000000) + assert_equal(w4.getbalance(), 3000000) batch = w1.batch([w1.getblockchaininfo.get_request(), w1.getwalletinfo.get_request()]) @@ -230,9 +230,9 @@ self.log.info('Check for per-wallet settxfee call') assert_equal(w1.getwalletinfo()['paytxfee'], 0) assert_equal(w2.getwalletinfo()['paytxfee'], 0) - w2.settxfee(0.001) + w2.settxfee(1000) assert_equal(w1.getwalletinfo()['paytxfee'], 0) - assert_equal(w2.getwalletinfo()['paytxfee'], Decimal('0.00100000')) + assert_equal(w2.getwalletinfo()['paytxfee'], Decimal('1000.00')) self.log.info("Test dynamic wallet loading") diff --git a/test/functional/wallet_reorgsrestore.py b/test/functional/wallet_reorgsrestore.py --- a/test/functional/wallet_reorgsrestore.py +++ b/test/functional/wallet_reorgsrestore.py @@ -36,7 +36,7 @@ def run_test(self): # Send a tx from which to conflict outputs later txid_conflict_from = self.nodes[0].sendtoaddress( - self.nodes[0].getnewaddress(), Decimal("10")) + self.nodes[0].getnewaddress(), Decimal("10000000")) self.nodes[0].generate(1) self.sync_blocks() @@ -47,7 +47,7 @@ # Send a tx to be unconfirmed later txid = self.nodes[0].sendtoaddress( - self.nodes[0].getnewaddress(), Decimal("10")) + self.nodes[0].getnewaddress(), Decimal("10000000")) tx = self.nodes[0].gettransaction(txid) self.nodes[0].generate(4) tx_before_reorg = self.nodes[0].gettransaction(txid) @@ -57,7 +57,7 @@ # respective chains disconnect_nodes(self.nodes[0], self.nodes[2]) nA = next(tx_out["vout"] for tx_out in self.nodes[0].gettransaction( - txid_conflict_from)["details"] if tx_out["amount"] == Decimal("10")) + txid_conflict_from)["details"] if tx_out["amount"] == Decimal("10000000")) inputs = [] inputs.append({"txid": txid_conflict_from, "vout": nA}) outputs_1 = {} @@ -65,8 +65,8 @@ # Create a conflicted tx broadcast on node0 chain and conflicting tx # broadcast on node1 chain. Both spend from txid_conflict_from - outputs_1[self.nodes[0].getnewaddress()] = Decimal("9.99998") - outputs_2[self.nodes[0].getnewaddress()] = Decimal("9.99998") + outputs_1[self.nodes[0].getnewaddress()] = Decimal("9999980") + outputs_2[self.nodes[0].getnewaddress()] = Decimal("9999980") conflicted = self.nodes[0].signrawtransactionwithwallet( self.nodes[0].createrawtransaction(inputs, outputs_1)) conflicting = self.nodes[0].signrawtransactionwithwallet( diff --git a/test/functional/wallet_resendwallettransactions.py b/test/functional/wallet_resendwallettransactions.py --- a/test/functional/wallet_resendwallettransactions.py +++ b/test/functional/wallet_resendwallettransactions.py @@ -25,7 +25,7 @@ node.add_p2p_connection(P2PTxInvStore()) self.log.info("Create a new transaction and wait until it's broadcast") - txid = int(node.sendtoaddress(node.getnewaddress(), 1), 16) + txid = int(node.sendtoaddress(node.getnewaddress(), 1000000), 16) # Wallet rebroadcast is first scheduled 1 sec after startup (see # nNextResend in ResendWalletTransactions()). Sleep for just over a diff --git a/test/functional/wallet_txn_clone.py b/test/functional/wallet_txn_clone.py --- a/test/functional/wallet_txn_clone.py +++ b/test/functional/wallet_txn_clone.py @@ -11,7 +11,7 @@ connect_nodes, disconnect_nodes, ) -from test_framework.messages import CTransaction, COIN +from test_framework.messages import CTransaction, XEC class TxnMallTest(BitcoinTestFramework): @@ -36,20 +36,20 @@ output_type = "legacy" # All nodes should start with 1,250 BCH: - starting_balance = 1250 + starting_balance = 1250000000 for i in range(4): assert_equal(self.nodes[i].getbalance(), starting_balance) # bug workaround, coins generated assigned to first getnewaddress! self.nodes[i].getnewaddress() - self.nodes[0].settxfee(.001) + self.nodes[0].settxfee(1000) node0_address1 = self.nodes[0].getnewaddress(address_type=output_type) - node0_txid1 = self.nodes[0].sendtoaddress(node0_address1, 1219) + node0_txid1 = self.nodes[0].sendtoaddress(node0_address1, 1219000000) node0_tx1 = self.nodes[0].gettransaction(node0_txid1) node0_address2 = self.nodes[0].getnewaddress(address_type=output_type) - node0_txid2 = self.nodes[0].sendtoaddress(node0_address2, 29) + node0_txid2 = self.nodes[0].sendtoaddress(node0_address2, 29000000) node0_tx2 = self.nodes[0].gettransaction(node0_txid2) assert_equal(self.nodes[0].getbalance(), @@ -59,8 +59,8 @@ node1_address = self.nodes[1].getnewaddress() # Send tx1, and another transaction tx2 that won't be cloned - txid1 = self.nodes[0].sendtoaddress(node1_address, 40) - txid2 = self.nodes[0].sendtoaddress(node1_address, 20) + txid1 = self.nodes[0].sendtoaddress(node1_address, 40000000) + txid2 = self.nodes[0].sendtoaddress(node1_address, 20000000) # Construct a clone of tx1, to be malleated rawtx1 = self.nodes[0].getrawtransaction(txid1, 1) @@ -77,10 +77,10 @@ # them if necessary. clone_tx = CTransaction() clone_tx.deserialize(io.BytesIO(bytes.fromhex(clone_raw))) - if (rawtx1["vout"][0]["value"] == 40 and - clone_tx.vout[0].nValue != 40 * COIN or - rawtx1["vout"][0]["value"] != 40 and - clone_tx.vout[0].nValue == 40 * COIN): + if (rawtx1["vout"][0]["value"] == 40000000 and + clone_tx.vout[0].nValue != 40000000 * XEC or + rawtx1["vout"][0]["value"] != 40000000 and + clone_tx.vout[0].nValue == 40000000 * XEC): (clone_tx.vout[0], clone_tx.vout[1]) = (clone_tx.vout[1], clone_tx.vout[0]) @@ -102,7 +102,7 @@ # matured block, minus tx1 and tx2 amounts, and minus transaction fees: expected = starting_balance + node0_tx1["fee"] + node0_tx2["fee"] if self.options.mine_block: - expected += 50 + expected += 50000000 expected += tx1["amount"] + tx1["fee"] expected += tx2["amount"] + tx2["fee"] assert_equal(self.nodes[0].getbalance(), expected) @@ -140,9 +140,9 @@ # Check node0's total balance; should be same as before the clone, + 100 BCH for 2 matured, # less possible orphaned matured subsidy - expected += 100 + expected += 100000000 if (self.options.mine_block): - expected -= 50 + expected -= 50000000 assert_equal(self.nodes[0].getbalance(), expected) diff --git a/test/functional/wallet_txn_doublespend.py b/test/functional/wallet_txn_doublespend.py --- a/test/functional/wallet_txn_doublespend.py +++ b/test/functional/wallet_txn_doublespend.py @@ -34,7 +34,7 @@ def run_test(self): # All nodes should start with 1,250 BCH: - starting_balance = 1250 + starting_balance = 1250000000 # All nodes should be out of IBD. # If the nodes are not all out of IBD, that can interfere with @@ -50,11 +50,13 @@ # Assign coins to foo and bar addresses: node0_address_foo = self.nodes[0].getnewaddress() - fund_foo_txid = self.nodes[0].sendtoaddress(node0_address_foo, 1219) + fund_foo_txid = self.nodes[0].sendtoaddress( + node0_address_foo, 1219000000) fund_foo_tx = self.nodes[0].gettransaction(fund_foo_txid) node0_address_bar = self.nodes[0].getnewaddress() - fund_bar_txid = self.nodes[0].sendtoaddress(node0_address_bar, 29) + fund_bar_txid = self.nodes[0].sendtoaddress( + node0_address_bar, 29000000) fund_bar_tx = self.nodes[0].gettransaction(fund_bar_txid) assert_equal(self.nodes[0].getbalance(), @@ -65,25 +67,27 @@ # First: use raw transaction API to send 1240 BCH to node1_address, # but don't broadcast: - doublespend_fee = Decimal('-.02') + doublespend_fee = Decimal('-20000') rawtx_input_0 = {} rawtx_input_0["txid"] = fund_foo_txid - rawtx_input_0["vout"] = find_output(self.nodes[0], fund_foo_txid, 1219) + rawtx_input_0["vout"] = find_output( + self.nodes[0], fund_foo_txid, 1219000000) rawtx_input_1 = {} rawtx_input_1["txid"] = fund_bar_txid - rawtx_input_1["vout"] = find_output(self.nodes[0], fund_bar_txid, 29) + rawtx_input_1["vout"] = find_output( + self.nodes[0], fund_bar_txid, 29000000) inputs = [rawtx_input_0, rawtx_input_1] change_address = self.nodes[0].getnewaddress() outputs = {} - outputs[node1_address] = 1240 - outputs[change_address] = 1248 - 1240 + doublespend_fee + outputs[node1_address] = 1240000000 + outputs[change_address] = 1248000000 - 1240000000 + doublespend_fee rawtx = self.nodes[0].createrawtransaction(inputs, outputs) doublespend = self.nodes[0].signrawtransactionwithwallet(rawtx) assert_equal(doublespend["complete"], True) # Create two spends using 1 50 BCH coin each - txid1 = self.nodes[0].sendtoaddress(node1_address, 40) - txid2 = self.nodes[0].sendtoaddress(node1_address, 20) + txid1 = self.nodes[0].sendtoaddress(node1_address, 40000000) + txid2 = self.nodes[0].sendtoaddress(node1_address, 20000000) # Have node0 mine a block: if (self.options.mine_block): @@ -97,7 +101,7 @@ # matured block, minus 40, minus 20, and minus transaction fees: expected = starting_balance + fund_foo_tx["fee"] + fund_bar_tx["fee"] if self.options.mine_block: - expected += 50 + expected += 50000000 expected += tx1["amount"] + tx1["fee"] expected += tx2["amount"] + tx2["fee"] assert_equal(self.nodes[0].getbalance(), expected) @@ -137,13 +141,13 @@ # Node0's total balance should be starting balance, plus 100BTC for # two more matured blocks, minus 1240 for the double-spend, plus fees (which are # negative): - expected = starting_balance + 100 - 1240 + \ + expected = starting_balance + 100000000 - 1240000000 + \ fund_foo_tx["fee"] + fund_bar_tx["fee"] + doublespend_fee assert_equal(self.nodes[0].getbalance(), expected) # Node1's balance should be its initial balance (1250 for 25 block # rewards) plus the doublespend: - assert_equal(self.nodes[1].getbalance(), 1250 + 1240) + assert_equal(self.nodes[1].getbalance(), 1250000000 + 1240000000) if __name__ == '__main__': diff --git a/test/functional/wallet_watchonly.py b/test/functional/wallet_watchonly.py --- a/test/functional/wallet_watchonly.py +++ b/test/functional/wallet_watchonly.py @@ -42,14 +42,14 @@ node.generatetoaddress(101, a1) # send 1 btc to our watch-only address - txid = def_wallet.sendtoaddress(wo_addr, 1) + txid = def_wallet.sendtoaddress(wo_addr, 1000000) self.nodes[0].generate(1) # getbalance self.log.info( 'include_watchonly should default to true for watch-only wallets') self.log.info('Testing getbalance watch-only defaults') - assert_equal(wo_wallet.getbalance(), 1) + assert_equal(wo_wallet.getbalance(), 1000000) assert_equal(len(wo_wallet.listtransactions()), 1) assert_equal(wo_wallet.getbalance(include_watchonly=False), 0) @@ -89,7 +89,7 @@ self.log.info('Testing walletcreatefundedpsbt watch-only defaults') inputs = [] - outputs = [{a1: 0.5}] + outputs = [{a1: 500000}] options = {'changeAddress': wo_change} no_wo_options = {'changeAddress': wo_change, 'includeWatching': False}