diff options
| author | Karl-Johan Alm <[email protected]> | 2018-06-28 07:50:45 +0900 |
|---|---|---|
| committer | Karl-Johan Alm <[email protected]> | 2019-03-06 09:47:40 +0900 |
| commit | e5efacb941f78645462da1237ed04c75082d3aed (patch) | |
| tree | fdb89045963eabb9552fddd3f7d9cb5f7e19294c | |
| parent | Merge #15534: [test] lint-format-strings: open files sequentially (fix for OS X) (diff) | |
| download | discoin-e5efacb941f78645462da1237ed04c75082d3aed.tar.xz discoin-e5efacb941f78645462da1237ed04c75082d3aed.zip | |
test: Refactor vout fetches in rpc_rawtransaction
| -rwxr-xr-x | test/functional/rpc_rawtransaction.py | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/test/functional/rpc_rawtransaction.py b/test/functional/rpc_rawtransaction.py index fba9e7526..df7c89482 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']}] |