aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl-Johan Alm <karljohan-alm@garage.co.jp>2018-06-28 07:50:45 +0900
committerKarl-Johan Alm <karljohan-alm@garage.co.jp>2019-03-06 09:47:40 +0900
commite5efacb941f78645462da1237ed04c75082d3aed (patch)
treefdb89045963eabb9552fddd3f7d9cb5f7e19294c
parent4952a953585e99477a89989b009749e40c173013 (diff)
test: Refactor vout fetches in rpc_rawtransaction
-rwxr-xr-xtest/functional/rpc_rawtransaction.py12
1 files changed, 2 insertions, 10 deletions
diff --git a/test/functional/rpc_rawtransaction.py b/test/functional/rpc_rawtransaction.py
index fba9e75268..df7c894827 100755
--- a/test/functional/rpc_rawtransaction.py
+++ b/test/functional/rpc_rawtransaction.py
@@ -285,11 +285,7 @@ class RawTransactionsTest(BitcoinTestFramework):
txDetails = self.nodes[0].gettransaction(txId, True)
rawTx = self.nodes[0].decoderawtransaction(txDetails['hex'])
- vout = False
- for outpoint in rawTx['vout']:
- if outpoint['value'] == Decimal('2.20000000'):
- vout = outpoint
- break
+ vout = next(o for o in rawTx['vout'] if o['value'] == Decimal('2.20000000'))
bal = self.nodes[0].getbalance()
inputs = [{ "txid" : txId, "vout" : vout['n'], "scriptPubKey" : vout['scriptPubKey']['hex'], "amount" : vout['value']}]
@@ -330,11 +326,7 @@ class RawTransactionsTest(BitcoinTestFramework):
txDetails = self.nodes[0].gettransaction(txId, True)
rawTx2 = self.nodes[0].decoderawtransaction(txDetails['hex'])
- vout = False
- for outpoint in rawTx2['vout']:
- if outpoint['value'] == Decimal('2.20000000'):
- vout = outpoint
- break
+ vout = next(o for o in rawTx2['vout'] if o['value'] == Decimal('2.20000000'))
bal = self.nodes[0].getbalance()
inputs = [{ "txid" : txId, "vout" : vout['n'], "scriptPubKey" : vout['scriptPubKey']['hex'], "redeemScript" : mSigObjValid['hex'], "amount" : vout['value']}]