|
|
|
@ -218,5 +218,37 @@ class WalletTest (BitcoinTestFramework):
@@ -218,5 +218,37 @@ class WalletTest (BitcoinTestFramework):
|
|
|
|
|
#tx should be added to balance because after restarting the nodes tx should be broadcastet |
|
|
|
|
assert_equal(self.nodes[2].getbalance(), Decimal('63.99800000')); #should not be |
|
|
|
|
|
|
|
|
|
#send a tx with value in a string (PR#6380 +) |
|
|
|
|
txId = self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), "2") |
|
|
|
|
txObj = self.nodes[0].gettransaction(txId) |
|
|
|
|
assert_equal(txObj['amount'], Decimal('-2.00000000')) |
|
|
|
|
|
|
|
|
|
txId = self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), "0.0001") |
|
|
|
|
txObj = self.nodes[0].gettransaction(txId) |
|
|
|
|
assert_equal(txObj['amount'], Decimal('-0.00010000')) |
|
|
|
|
|
|
|
|
|
#check if JSON parser can handle scientific notation in strings |
|
|
|
|
txId = self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), "1e-4") |
|
|
|
|
txObj = self.nodes[0].gettransaction(txId) |
|
|
|
|
assert_equal(txObj['amount'], Decimal('-0.00010000')) |
|
|
|
|
|
|
|
|
|
#this should fail |
|
|
|
|
errorString = "" |
|
|
|
|
try: |
|
|
|
|
txId = self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), "1f-4") |
|
|
|
|
except JSONRPCException,e: |
|
|
|
|
errorString = e.error['message'] |
|
|
|
|
|
|
|
|
|
assert_equal("Invalid amount" in errorString, True); |
|
|
|
|
|
|
|
|
|
errorString = "" |
|
|
|
|
try: |
|
|
|
|
self.nodes[0].generate("2") #use a string to as block amount parameter must fail because it's not interpreted as amount |
|
|
|
|
except JSONRPCException,e: |
|
|
|
|
errorString = e.error['message'] |
|
|
|
|
|
|
|
|
|
assert_equal("not an integer" in errorString, True); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__': |
|
|
|
|
WalletTest ().main () |
|
|
|
|