Skip to content

Commit 6947723

Browse files
authored
Merge pull request jl777#303 from SirSevenG/patch-1
fix rawtransactions tests amount
2 parents 3d853d8 + 87ae0ad commit 6947723

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

qa/pytest_komodo/basic/test_rawtransactions.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python3
2-
# Copyright (c) 2019 SuperNET developers
2+
# Copyright (c) 2020 SuperNET developers
33
# Distributed under the MIT software license, see the accompanying
4-
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
4+
# file COPYING or https://www.opensource.org/licenses/mit-license.php.
55

66
import pytest
77
from decimal import *
@@ -32,11 +32,13 @@ def test_rawtransactions(self, test_params): # create, fund, sign, send calls
3232
txid = res[0].get('txid')
3333
vout = res[0].get('vout')
3434
base_amount = res[0].get('amount')
35+
# python float() is double precision floating point number,
36+
# createrawtransaction method expects C float (8 digits) value
37+
# "{0:.8f}".format(value)) returns number string with 8 digit precision and float() corrects the type
3538
if isinstance(base_amount, Decimal):
36-
amount = float(base_amount) * 0.9
37-
print(amount)
39+
amount = float("{0:.8f}".format(float(base_amount) * 0.9))
3840
else:
39-
amount = base_amount * 0.9
41+
amount = float("{0:.8f}".format(base_amount * 0.9))
4042
address = rpc.getnewaddress()
4143
ins = [{'txid': txid, 'vout': vout}]
4244
outs = {address: amount}

0 commit comments

Comments
 (0)