Skip to content

Commit ac37b63

Browse files
fanquakevijaydasmp
authored andcommitted
Merge bitcoin#28164: test: remove unused code in wallet_fundrawtransaction
108c625 test: remove unused `totalOut` code (brunoerg) 0fc3dee test: remove unecessary `decoderawtransaction` calls (brunoerg) Pull request description: This PR removes in `wallet_fundrawtransaction`: - unecessary variables/calls to `decoderawtransaction` - unused `totalOut` variable and its related code (`totalOut` is used in some functions to test change, in other ones its value is not used) ACKs for top commit: kevkevinpal: utACK [108c625](bitcoin@108c625) MarcoFalke: lgtm ACK 108c625 Tree-SHA512: c352524f3633146117534c79bd1a24523a7068f13a17d0b8a425cc3c85d62cb769a79ea60db8b075b137da2a0cc43142c43a23ca5af89246ff86cd824e37cf17
1 parent d02be80 commit ac37b63

File tree

1 file changed

+0
-12
lines changed

1 file changed

+0
-12
lines changed

test/functional/rpc_fundrawtransaction.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,6 @@ def test_simple(self):
168168
inputs = [ ]
169169
outputs = { self.nodes[0].getnewaddress() : 10 }
170170
rawtx = self.nodes[2].createrawtransaction(inputs, outputs)
171-
dec_tx = self.nodes[2].decoderawtransaction(rawtx)
172171
rawtxfund = self.nodes[2].fundrawtransaction(rawtx)
173172
dec_tx = self.nodes[2].decoderawtransaction(rawtxfund['hex'])
174173
assert len(dec_tx['vin']) > 0 #test that we have enough inputs
@@ -178,8 +177,6 @@ def test_simple_two_coins(self):
178177
inputs = [ ]
179178
outputs = { self.nodes[0].getnewaddress() : 22 }
180179
rawtx = self.nodes[2].createrawtransaction(inputs, outputs)
181-
dec_tx = self.nodes[2].decoderawtransaction(rawtx)
182-
183180
rawtxfund = self.nodes[2].fundrawtransaction(rawtx)
184181
dec_tx = self.nodes[2].decoderawtransaction(rawtxfund['hex'])
185182
assert len(dec_tx['vin']) > 0 #test if we have enough inputs
@@ -191,13 +188,10 @@ def test_simple_two_outputs(self):
191188
inputs = [ ]
192189
outputs = { self.nodes[0].getnewaddress() : 26, self.nodes[1].getnewaddress() : 25 }
193190
rawtx = self.nodes[2].createrawtransaction(inputs, outputs)
194-
dec_tx = self.nodes[2].decoderawtransaction(rawtx)
195191

196192
rawtxfund = self.nodes[2].fundrawtransaction(rawtx)
197193
dec_tx = self.nodes[2].decoderawtransaction(rawtxfund['hex'])
198-
totalOut = 0
199194
for out in dec_tx['vout']:
200-
totalOut += out['value']
201195
address = out['scriptPubKey']['address']
202196
if address in outputs.keys():
203197
assert_equal(satoshi_round(outputs[address]), out['value'])
@@ -310,10 +304,8 @@ def test_coin_selection(self):
310304
rawtxfund = self.nodes[2].fundrawtransaction(rawtx)
311305

312306
dec_tx = self.nodes[2].decoderawtransaction(rawtxfund['hex'])
313-
totalOut = 0
314307
matchingOuts = 0
315308
for i, out in enumerate(dec_tx['vout']):
316-
totalOut += out['value']
317309
if out['scriptPubKey']['address'] in outputs:
318310
matchingOuts+=1
319311
else:
@@ -341,10 +333,8 @@ def test_two_vin(self):
341333
rawtxfund = self.nodes[2].fundrawtransaction(rawtx, {"add_inputs": True})
342334

343335
dec_tx = self.nodes[2].decoderawtransaction(rawtxfund['hex'])
344-
totalOut = 0
345336
matchingOuts = 0
346337
for out in dec_tx['vout']:
347-
totalOut += out['value']
348338
if out['scriptPubKey']['address'] in outputs:
349339
matchingOuts+=1
350340

@@ -375,10 +365,8 @@ def test_two_vin_two_vout(self):
375365
rawtxfund = self.nodes[2].fundrawtransaction(rawtx, {"add_inputs": True})
376366

377367
dec_tx = self.nodes[2].decoderawtransaction(rawtxfund['hex'])
378-
totalOut = 0
379368
matchingOuts = 0
380369
for out in dec_tx['vout']:
381-
totalOut += out['value']
382370
if out['scriptPubKey']['address'] in outputs:
383371
matchingOuts+=1
384372

0 commit comments

Comments
 (0)