Skip to content

Commit e5efacb

Browse files
committed
test: Refactor vout fetches in rpc_rawtransaction
1 parent 4952a95 commit e5efacb

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

test/functional/rpc_rawtransaction.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -285,11 +285,7 @@ def run_test(self):
285285

286286
txDetails = self.nodes[0].gettransaction(txId, True)
287287
rawTx = self.nodes[0].decoderawtransaction(txDetails['hex'])
288-
vout = False
289-
for outpoint in rawTx['vout']:
290-
if outpoint['value'] == Decimal('2.20000000'):
291-
vout = outpoint
292-
break
288+
vout = next(o for o in rawTx['vout'] if o['value'] == Decimal('2.20000000'))
293289

294290
bal = self.nodes[0].getbalance()
295291
inputs = [{ "txid" : txId, "vout" : vout['n'], "scriptPubKey" : vout['scriptPubKey']['hex'], "amount" : vout['value']}]
@@ -330,11 +326,7 @@ def run_test(self):
330326

331327
txDetails = self.nodes[0].gettransaction(txId, True)
332328
rawTx2 = self.nodes[0].decoderawtransaction(txDetails['hex'])
333-
vout = False
334-
for outpoint in rawTx2['vout']:
335-
if outpoint['value'] == Decimal('2.20000000'):
336-
vout = outpoint
337-
break
329+
vout = next(o for o in rawTx2['vout'] if o['value'] == Decimal('2.20000000'))
338330

339331
bal = self.nodes[0].getbalance()
340332
inputs = [{ "txid" : txId, "vout" : vout['n'], "scriptPubKey" : vout['scriptPubKey']['hex'], "redeemScript" : mSigObjValid['hex'], "amount" : vout['value']}]

0 commit comments

Comments
 (0)