Skip to content

Commit e141f44

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 66d405b commit e141f44

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
@@ -169,7 +169,6 @@ def test_simple(self):
169169
inputs = [ ]
170170
outputs = { self.nodes[0].getnewaddress() : 10 }
171171
rawtx = self.nodes[2].createrawtransaction(inputs, outputs)
172-
dec_tx = self.nodes[2].decoderawtransaction(rawtx)
173172
rawtxfund = self.nodes[2].fundrawtransaction(rawtx)
174173
dec_tx = self.nodes[2].decoderawtransaction(rawtxfund['hex'])
175174
assert len(dec_tx['vin']) > 0 #test that we have enough inputs
@@ -179,8 +178,6 @@ def test_simple_two_coins(self):
179178
inputs = [ ]
180179
outputs = { self.nodes[0].getnewaddress() : 22 }
181180
rawtx = self.nodes[2].createrawtransaction(inputs, outputs)
182-
dec_tx = self.nodes[2].decoderawtransaction(rawtx)
183-
184181
rawtxfund = self.nodes[2].fundrawtransaction(rawtx)
185182
dec_tx = self.nodes[2].decoderawtransaction(rawtxfund['hex'])
186183
assert len(dec_tx['vin']) > 0 #test if we have enough inputs
@@ -192,13 +189,10 @@ def test_simple_two_outputs(self):
192189
inputs = [ ]
193190
outputs = { self.nodes[0].getnewaddress() : 26, self.nodes[1].getnewaddress() : 25 }
194191
rawtx = self.nodes[2].createrawtransaction(inputs, outputs)
195-
dec_tx = self.nodes[2].decoderawtransaction(rawtx)
196192

197193
rawtxfund = self.nodes[2].fundrawtransaction(rawtx)
198194
dec_tx = self.nodes[2].decoderawtransaction(rawtxfund['hex'])
199-
totalOut = 0
200195
for out in dec_tx['vout']:
201-
totalOut += out['value']
202196
address = out['scriptPubKey']['address']
203197
if address in outputs.keys():
204198
assert_equal(satoshi_round(outputs[address]), out['value'])
@@ -311,10 +305,8 @@ def test_coin_selection(self):
311305
rawtxfund = self.nodes[2].fundrawtransaction(rawtx)
312306

313307
dec_tx = self.nodes[2].decoderawtransaction(rawtxfund['hex'])
314-
totalOut = 0
315308
matchingOuts = 0
316309
for i, out in enumerate(dec_tx['vout']):
317-
totalOut += out['value']
318310
if out['scriptPubKey']['address'] in outputs:
319311
matchingOuts+=1
320312
else:
@@ -342,10 +334,8 @@ def test_two_vin(self):
342334
rawtxfund = self.nodes[2].fundrawtransaction(rawtx, {"add_inputs": True})
343335

344336
dec_tx = self.nodes[2].decoderawtransaction(rawtxfund['hex'])
345-
totalOut = 0
346337
matchingOuts = 0
347338
for out in dec_tx['vout']:
348-
totalOut += out['value']
349339
if out['scriptPubKey']['address'] in outputs:
350340
matchingOuts+=1
351341

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

378368
dec_tx = self.nodes[2].decoderawtransaction(rawtxfund['hex'])
379-
totalOut = 0
380369
matchingOuts = 0
381370
for out in dec_tx['vout']:
382-
totalOut += out['value']
383371
if out['scriptPubKey']['address'] in outputs:
384372
matchingOuts+=1
385373

0 commit comments

Comments
 (0)