test: Replace satoshi_round with int() or Decimal()

satoshi_round will round down. To make the code easier to parse use
Decimal() where possible, which does not round. Or use int(), which
explicitly rounds down.
This commit is contained in:
MarcoFalke
2021-10-06 15:19:34 +02:00
parent 66d11b1435
commit fa2ac5881e
3 changed files with 8 additions and 12 deletions

View File

@@ -14,7 +14,6 @@ from test_framework.util import (
assert_equal,
assert_raises_rpc_error,
chain_transaction,
satoshi_round,
)
# default limits
@@ -209,10 +208,10 @@ class MempoolPackagesTest(BitcoinTestFramework):
entry = self.nodes[0].getmempoolentry(x)
descendant_fees += entry['fee']
if (x == chain[-1]):
assert_equal(entry['modifiedfee'], entry['fee']+satoshi_round(0.00002))
assert_equal(entry['fees']['modified'], entry['fee']+satoshi_round(0.00002))
assert_equal(entry['modifiedfee'], entry['fee'] + Decimal("0.00002"))
assert_equal(entry['fees']['modified'], entry['fee'] + Decimal("0.00002"))
assert_equal(entry['descendantfees'], descendant_fees * COIN + 2000)
assert_equal(entry['fees']['descendant'], descendant_fees+satoshi_round(0.00002))
assert_equal(entry['fees']['descendant'], descendant_fees + Decimal("0.00002"))
# Check that node1's mempool is as expected (-> custom ancestor limit)
mempool0 = self.nodes[0].getrawmempool(False)
@@ -308,7 +307,7 @@ class MempoolPackagesTest(BitcoinTestFramework):
value = utxo[0]['amount']
vout = utxo[0]['vout']
send_value = satoshi_round((value - fee)/2)
send_value = (value - fee) / 2
inputs = [ {'txid' : txid, 'vout' : vout} ]
outputs = {}
for _ in range(2):