Skip to content

Commit dfe2dc1

Browse files
committed
Merge bitcoin/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/bitcoin@108c625) MarcoFalke: lgtm ACK 108c625 Tree-SHA512: c352524f3633146117534c79bd1a24523a7068f13a17d0b8a425cc3c85d62cb769a79ea60db8b075b137da2a0cc43142c43a23ca5af89246ff86cd824e37cf17
2 parents 04f66ce + 108c625 commit dfe2dc1

File tree

1 file changed

+0
-14
lines changed

1 file changed

+0
-14
lines changed

test/functional/wallet_fundrawtransaction.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,6 @@ def test_simple(self):
183183
inputs = [ ]
184184
outputs = { self.nodes[0].getnewaddress() : 1.0 }
185185
rawtx = self.nodes[2].createrawtransaction(inputs, outputs)
186-
dec_tx = self.nodes[2].decoderawtransaction(rawtx)
187186
rawtxfund = self.nodes[2].fundrawtransaction(rawtx)
188187
dec_tx = self.nodes[2].decoderawtransaction(rawtxfund['hex'])
189188
assert len(dec_tx['vin']) > 0 #test that we have enough inputs
@@ -193,8 +192,6 @@ def test_simple_two_coins(self):
193192
inputs = [ ]
194193
outputs = { self.nodes[0].getnewaddress() : 2.2 }
195194
rawtx = self.nodes[2].createrawtransaction(inputs, outputs)
196-
dec_tx = self.nodes[2].decoderawtransaction(rawtx)
197-
198195
rawtxfund = self.nodes[2].fundrawtransaction(rawtx)
199196
dec_tx = self.nodes[2].decoderawtransaction(rawtxfund['hex'])
200197
assert len(dec_tx['vin']) > 0 #test if we have enough inputs
@@ -206,13 +203,9 @@ def test_simple_two_outputs(self):
206203
inputs = [ ]
207204
outputs = { self.nodes[0].getnewaddress() : 2.6, self.nodes[1].getnewaddress() : 2.5 }
208205
rawtx = self.nodes[2].createrawtransaction(inputs, outputs)
209-
dec_tx = self.nodes[2].decoderawtransaction(rawtx)
210206

211207
rawtxfund = self.nodes[2].fundrawtransaction(rawtx)
212208
dec_tx = self.nodes[2].decoderawtransaction(rawtxfund['hex'])
213-
totalOut = 0
214-
for out in dec_tx['vout']:
215-
totalOut += out['value']
216209

217210
assert len(dec_tx['vin']) > 0
218211
assert_equal(dec_tx['vin'][0]['scriptSig']['hex'], '')
@@ -335,10 +328,8 @@ def test_coin_selection(self):
335328
rawtxfund = self.nodes[2].fundrawtransaction(rawtx)
336329

337330
dec_tx = self.nodes[2].decoderawtransaction(rawtxfund['hex'])
338-
totalOut = 0
339331
matchingOuts = 0
340332
for i, out in enumerate(dec_tx['vout']):
341-
totalOut += out['value']
342333
if out['scriptPubKey']['address'] in outputs:
343334
matchingOuts+=1
344335
else:
@@ -364,12 +355,9 @@ def test_two_vin(self):
364355
# Should fail without add_inputs:
365356
assert_raises_rpc_error(-4, ERR_NOT_ENOUGH_PRESET_INPUTS, self.nodes[2].fundrawtransaction, rawtx, add_inputs=False)
366357
rawtxfund = self.nodes[2].fundrawtransaction(rawtx, add_inputs=True)
367-
368358
dec_tx = self.nodes[2].decoderawtransaction(rawtxfund['hex'])
369-
totalOut = 0
370359
matchingOuts = 0
371360
for out in dec_tx['vout']:
372-
totalOut += out['value']
373361
if out['scriptPubKey']['address'] in outputs:
374362
matchingOuts+=1
375363

@@ -400,10 +388,8 @@ def test_two_vin_two_vout(self):
400388
rawtxfund = self.nodes[2].fundrawtransaction(rawtx, add_inputs=True)
401389

402390
dec_tx = self.nodes[2].decoderawtransaction(rawtxfund['hex'])
403-
totalOut = 0
404391
matchingOuts = 0
405392
for out in dec_tx['vout']:
406-
totalOut += out['value']
407393
if out['scriptPubKey']['address'] in outputs:
408394
matchingOuts+=1
409395

0 commit comments

Comments
 (0)