Skip to content

Commit

Permalink
Merge pull request #6417
Browse files Browse the repository at this point in the history
9da8fc8 [QA] remove rawtransactions.py from the extended test list (Jonas Schnelli)
6ed38b0 [QA] fix possible reorg issue in rawtransaction.py/fundrawtransaction.py RPC test (Jonas Schnelli)
  • Loading branch information
laanwj committed Jul 13, 2015
2 parents 7cdefb9 + 9da8fc8 commit 44fa82d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 33 deletions.
1 change: 0 additions & 1 deletion qa/pull-tester/rpc-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ testScriptsExt=(
'smartfees.py'
'maxblocksinflight.py'
'invalidblockrequest.py'
'rawtransactions.py'
# 'forknotify.py'
'p2p-acceptblock.py'
);
Expand Down
37 changes: 5 additions & 32 deletions qa/rpc-tests/fundrawtransaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def run_test(self):
feeTolerance = Decimal(0.00000002) #if the fee's positive delta is higher than this value tests will fail, neg. delta always fail the tests

self.nodes[2].generate(1)
self.sync_all()
self.nodes[0].generate(101)
self.sync_all()
self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(),1.5);
Expand All @@ -46,17 +47,10 @@ def run_test(self):
outputs = { self.nodes[0].getnewaddress() : 1.0 }
rawtx = self.nodes[2].createrawtransaction(inputs, outputs)
dec_tx = self.nodes[2].decoderawtransaction(rawtx)

rawtxfund = self.nodes[2].fundrawtransaction(rawtx)
fee = rawtxfund['fee']
dec_tx = self.nodes[2].decoderawtransaction(rawtxfund['hex'])
totalOut = 0
for out in dec_tx['vout']:
totalOut += out['value']

assert_equal(len(dec_tx['vin']), 1) #one vin coin
assert_equal(dec_tx['vin'][0]['scriptSig']['hex'], '')
assert_equal(fee + totalOut, 1.5) #the 1.5BTC coin must be taken
assert_equal(len(dec_tx['vin']) > 0, True) #test if we have enought inputs

##############################
# simple test with two coins #
Expand All @@ -69,14 +63,7 @@ def run_test(self):
rawtxfund = self.nodes[2].fundrawtransaction(rawtx)
fee = rawtxfund['fee']
dec_tx = self.nodes[2].decoderawtransaction(rawtxfund['hex'])
totalOut = 0
for out in dec_tx['vout']:
totalOut += out['value']

assert_equal(len(dec_tx['vin']), 2) #one vin coin
assert_equal(dec_tx['vin'][0]['scriptSig']['hex'], '')
assert_equal(dec_tx['vin'][1]['scriptSig']['hex'], '')
assert_equal(fee + totalOut, 2.5) #the 1.5BTC+1.0BTC coins must have be taken
assert_equal(len(dec_tx['vin']) > 0, True) #test if we have enough inputs

##############################
# simple test with two coins #
Expand All @@ -89,13 +76,8 @@ def run_test(self):
rawtxfund = self.nodes[2].fundrawtransaction(rawtx)
fee = rawtxfund['fee']
dec_tx = self.nodes[2].decoderawtransaction(rawtxfund['hex'])
totalOut = 0
for out in dec_tx['vout']:
totalOut += out['value']

assert_equal(len(dec_tx['vin']), 1) #one vin coin
assert_equal(len(dec_tx['vin']) > 0, True)
assert_equal(dec_tx['vin'][0]['scriptSig']['hex'], '')
assert_equal(fee + totalOut, 5.0) #the 5.0BTC coin must have be taken


################################
Expand All @@ -113,11 +95,8 @@ def run_test(self):
for out in dec_tx['vout']:
totalOut += out['value']

assert_equal(len(dec_tx['vin']), 2) #one vin coin
assert_equal(len(dec_tx['vin']) > 0, True)
assert_equal(dec_tx['vin'][0]['scriptSig']['hex'], '')
assert_equal(dec_tx['vin'][1]['scriptSig']['hex'], '')
assert_equal(fee + totalOut, 6.0) #the 5.0BTC + 1.0BTC coins must have be taken



#########################################################################
Expand Down Expand Up @@ -220,8 +199,6 @@ def run_test(self):
assert_equal(matchingOuts, 1)
assert_equal(len(dec_tx['vout']), 2)

assert_equal(fee + totalOut, 2.5) #this tx must use the 1.0BTC and the 1.5BTC coin


###########################################
# test a fundrawtransaction with two VINs #
Expand Down Expand Up @@ -264,8 +241,6 @@ def run_test(self):
matchingIns+=1

assert_equal(matchingIns, 2) #we now must see two vins identical to vins given as params
assert_equal(fee + totalOut, 7.5) #this tx must use the 1.0BTC and the 1.5BTC coin


#########################################################
# test a fundrawtransaction with two VINs and two vOUTs #
Expand Down Expand Up @@ -300,8 +275,6 @@ def run_test(self):

assert_equal(matchingOuts, 2)
assert_equal(len(dec_tx['vout']), 3)
assert_equal(fee + totalOut, 7.5) #this tx must use the 1.0BTC and the 1.5BTC coin


##############################################
# test a fundrawtransaction with invalid vin #
Expand Down
1 change: 1 addition & 0 deletions qa/rpc-tests/rawtransactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def run_test(self):

#prepare some coins for multiple *rawtransaction commands
self.nodes[2].generate(1)
self.sync_all()
self.nodes[0].generate(101)
self.sync_all()
self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(),1.5);
Expand Down

0 comments on commit 44fa82d

Please sign in to comment.