@ -5,8 +5,6 @@
@@ -5,8 +5,6 @@
from test_framework . test_framework import BitcoinTestFramework
from test_framework . util import *
from pprint import pprint
from time import sleep
# Create one-input, one-output, no-fee transaction:
class RawTransactionsTest ( BitcoinTestFramework ) :
@ -53,11 +51,11 @@ class RawTransactionsTest(BitcoinTestFramework):
@@ -53,11 +51,11 @@ class RawTransactionsTest(BitcoinTestFramework):
watchonly_amount = 200
self . nodes [ 3 ] . importpubkey ( watchonly_pubkey , " " , True )
watchonly_txid = self . nodes [ 0 ] . sendtoaddress ( watchonly_address , watchonly_amount )
self . nodes [ 0 ] . sendtoaddress ( self . nodes [ 3 ] . getnewaddress ( ) , watchonly_amount / 10 ) ;
self . nodes [ 0 ] . sendtoaddress ( self . nodes [ 3 ] . getnewaddress ( ) , 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 ( ) , 1.5 )
self . nodes [ 0 ] . sendtoaddress ( self . nodes [ 2 ] . getnewaddress ( ) , 1.0 )
self . nodes [ 0 ] . sendtoaddress ( self . nodes [ 2 ] . getnewaddress ( ) , 5.0 )
self . sync_all ( )
self . nodes [ 0 ] . generate ( 1 )
@ -130,7 +128,7 @@ class RawTransactionsTest(BitcoinTestFramework):
@@ -130,7 +128,7 @@ class RawTransactionsTest(BitcoinTestFramework):
for aUtx in listunspent :
if aUtx [ ' amount ' ] == 5.0 :
utx = aUtx
break ;
break
assert_equal ( utx != False , True )
@ -159,7 +157,7 @@ class RawTransactionsTest(BitcoinTestFramework):
@@ -159,7 +157,7 @@ class RawTransactionsTest(BitcoinTestFramework):
for aUtx in listunspent :
if aUtx [ ' amount ' ] == 5.0 :
utx = aUtx
break ;
break
assert_equal ( utx != False , True )
@ -189,7 +187,7 @@ class RawTransactionsTest(BitcoinTestFramework):
@@ -189,7 +187,7 @@ class RawTransactionsTest(BitcoinTestFramework):
for aUtx in listunspent :
if aUtx [ ' amount ' ] == 1.0 :
utx = aUtx
break ;
break
assert_equal ( utx != False , True )
@ -314,7 +312,7 @@ class RawTransactionsTest(BitcoinTestFramework):
@@ -314,7 +312,7 @@ class RawTransactionsTest(BitcoinTestFramework):
except JSONRPCException , e :
errorString = e . error [ ' message ' ]
assert_equal ( " Insufficient " in errorString , True ) ;
assert ( " Insufficient " in errorString )
@ -326,11 +324,11 @@ class RawTransactionsTest(BitcoinTestFramework):
@@ -326,11 +324,11 @@ class RawTransactionsTest(BitcoinTestFramework):
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 ( ) , 1.1 )
signedFee = self . nodes [ 0 ] . getrawmempool ( True ) [ txId ] [ ' fee ' ]
#compare fee
feeDelta = Decimal ( fundedTx [ ' fee ' ] ) - Decimal ( signedFee ) ;
feeDelta = Decimal ( fundedTx [ ' fee ' ] ) - Decimal ( signedFee )
assert ( feeDelta > = 0 and feeDelta < = feeTolerance )
############################################################
@ -341,11 +339,11 @@ class RawTransactionsTest(BitcoinTestFramework):
@@ -341,11 +339,11 @@ class RawTransactionsTest(BitcoinTestFramework):
rawTx = self . nodes [ 0 ] . createrawtransaction ( inputs , outputs )
fundedTx = self . nodes [ 0 ] . fundrawtransaction ( rawTx )
#create same transaction over sendtoaddress
txId = self . nodes [ 0 ] . sendmany ( " " , outputs ) ;
txId = self . nodes [ 0 ] . sendmany ( " " , outputs )
signedFee = self . nodes [ 0 ] . getrawmempool ( True ) [ txId ] [ ' fee ' ]
#compare fee
feeDelta = Decimal ( fundedTx [ ' fee ' ] ) - Decimal ( signedFee ) ;
feeDelta = Decimal ( fundedTx [ ' fee ' ] ) - Decimal ( signedFee )
assert ( feeDelta > = 0 and feeDelta < = feeTolerance )
############################################################
@ -368,11 +366,11 @@ class RawTransactionsTest(BitcoinTestFramework):
@@ -368,11 +366,11 @@ class RawTransactionsTest(BitcoinTestFramework):
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 , 1.1 )
signedFee = self . nodes [ 0 ] . getrawmempool ( True ) [ txId ] [ ' fee ' ]
#compare fee
feeDelta = Decimal ( fundedTx [ ' fee ' ] ) - Decimal ( signedFee ) ;
feeDelta = Decimal ( fundedTx [ ' fee ' ] ) - Decimal ( signedFee )
assert ( feeDelta > = 0 and feeDelta < = feeTolerance )
############################################################
@ -401,11 +399,11 @@ class RawTransactionsTest(BitcoinTestFramework):
@@ -401,11 +399,11 @@ class RawTransactionsTest(BitcoinTestFramework):
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 , 1.1 )
signedFee = self . nodes [ 0 ] . getrawmempool ( True ) [ txId ] [ ' fee ' ]
#compare fee
feeDelta = Decimal ( fundedTx [ ' fee ' ] ) - Decimal ( signedFee ) ;
feeDelta = Decimal ( fundedTx [ ' fee ' ] ) - Decimal ( signedFee )
assert ( feeDelta > = 0 and feeDelta < = feeTolerance )
############################################################
@ -424,7 +422,7 @@ class RawTransactionsTest(BitcoinTestFramework):
@@ -424,7 +422,7 @@ class RawTransactionsTest(BitcoinTestFramework):
# send 1.2 BTC to msig addr
txId = self . nodes [ 0 ] . sendtoaddress ( mSigObj , 1.2 ) ;
txId = self . nodes [ 0 ] . sendtoaddress ( mSigObj , 1.2 )
self . sync_all ( )
self . nodes [ 1 ] . generate ( 1 )
self . sync_all ( )
@ -466,7 +464,7 @@ class RawTransactionsTest(BitcoinTestFramework):
@@ -466,7 +464,7 @@ class RawTransactionsTest(BitcoinTestFramework):
error = False
try :
self . nodes [ 1 ] . sendtoaddress ( self . nodes [ 0 ] . getnewaddress ( ) , 1.2 ) ;
self . nodes [ 1 ] . sendtoaddress ( self . nodes [ 0 ] . getnewaddress ( ) , 1.2 )
except :
error = True
assert ( error )
@ -496,13 +494,13 @@ class RawTransactionsTest(BitcoinTestFramework):
@@ -496,13 +494,13 @@ class RawTransactionsTest(BitcoinTestFramework):
###############################################
#empty node1, send some small coins from node0 to node1
self . nodes [ 1 ] . sendtoaddress ( self . nodes [ 0 ] . getnewaddress ( ) , self . nodes [ 1 ] . getbalance ( ) , " " , " " , True ) ;
self . nodes [ 1 ] . sendtoaddress ( self . nodes [ 0 ] . getnewaddress ( ) , self . nodes [ 1 ] . getbalance ( ) , " " , " " , True )
self . sync_all ( )
self . nodes [ 0 ] . generate ( 1 )
self . sync_all ( )
for i in range ( 0 , 20 ) :
self . nodes [ 0 ] . sendtoaddress ( self . nodes [ 1 ] . getnewaddress ( ) , 0.01 ) ;
self . nodes [ 0 ] . sendtoaddress ( self . nodes [ 1 ] . getnewaddress ( ) , 0.01 )
self . sync_all ( )
self . nodes [ 0 ] . generate ( 1 )
self . sync_all ( )
@ -514,11 +512,11 @@ class RawTransactionsTest(BitcoinTestFramework):
@@ -514,11 +512,11 @@ class RawTransactionsTest(BitcoinTestFramework):
fundedTx = self . nodes [ 1 ] . fundrawtransaction ( rawTx )
#create same transaction over sendtoaddress
txId = self . nodes [ 1 ] . sendmany ( " " , outputs ) ;
txId = self . nodes [ 1 ] . sendmany ( " " , outputs )
signedFee = self . nodes [ 1 ] . getrawmempool ( True ) [ txId ] [ ' fee ' ]
#compare fee
feeDelta = Decimal ( fundedTx [ ' fee ' ] ) - Decimal ( signedFee ) ;
feeDelta = Decimal ( fundedTx [ ' fee ' ] ) - Decimal ( signedFee )
assert ( feeDelta > = 0 and feeDelta < = feeTolerance * 19 ) #~19 inputs
@ -527,13 +525,13 @@ class RawTransactionsTest(BitcoinTestFramework):
@@ -527,13 +525,13 @@ class RawTransactionsTest(BitcoinTestFramework):
#############################################
#again, empty node1, send some small coins from node0 to node1
self . nodes [ 1 ] . sendtoaddress ( self . nodes [ 0 ] . getnewaddress ( ) , self . nodes [ 1 ] . getbalance ( ) , " " , " " , True ) ;
self . nodes [ 1 ] . sendtoaddress ( self . nodes [ 0 ] . getnewaddress ( ) , self . nodes [ 1 ] . getbalance ( ) , " " , " " , True )
self . sync_all ( )
self . nodes [ 0 ] . generate ( 1 )
self . sync_all ( )
for i in range ( 0 , 20 ) :
self . nodes [ 0 ] . sendtoaddress ( self . nodes [ 1 ] . getnewaddress ( ) , 0.01 ) ;
self . nodes [ 0 ] . sendtoaddress ( self . nodes [ 1 ] . getnewaddress ( ) , 0.01 )
self . sync_all ( )
self . nodes [ 0 ] . generate ( 1 )
self . sync_all ( )