Skip to content

Commit 9ab2ce0

Browse files
committed
test: drop unused node parameters in feature_cltv.py
The following functions had a parameter "node" that is unsused and hence can be removed: - cltv_modify_tx() - cltv_invalidate() - cltv_validate()
1 parent 0c2139a commit 9ab2ce0

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

test/functional/feature_cltv.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
# Helper function to modify a transaction by
3838
# 1) prepending a given script to the scriptSig of vin 0 and
3939
# 2) (optionally) modify the nSequence of vin 0 and the tx's nLockTime
40-
def cltv_modify_tx(node, tx, prepend_scriptsig, nsequence=None, nlocktime=None):
40+
def cltv_modify_tx(tx, prepend_scriptsig, nsequence=None, nlocktime=None):
4141
assert_equal(len(tx.vin), 1)
4242
if nsequence is not None:
4343
tx.vin[0].nSequence = nsequence
@@ -48,7 +48,7 @@ def cltv_modify_tx(node, tx, prepend_scriptsig, nsequence=None, nlocktime=None):
4848
return tx
4949

5050

51-
def cltv_invalidate(node, tx, failure_reason):
51+
def cltv_invalidate(tx, failure_reason):
5252
# Modify the signature in vin 0 and nSequence/nLockTime of the tx to fail CLTV
5353
#
5454
# According to BIP65, OP_CHECKLOCKTIMEVERIFY can fail due the following reasons:
@@ -69,14 +69,14 @@ def cltv_invalidate(node, tx, failure_reason):
6969
[[CScriptNum(500), OP_CHECKLOCKTIMEVERIFY, OP_DROP], 0xffffffff, 500],
7070
][failure_reason]
7171

72-
return cltv_modify_tx(node, tx, prepend_scriptsig=scheme[0], nsequence=scheme[1], nlocktime=scheme[2])
72+
return cltv_modify_tx(tx, prepend_scriptsig=scheme[0], nsequence=scheme[1], nlocktime=scheme[2])
7373

7474

75-
def cltv_validate(node, tx, height):
75+
def cltv_validate(tx, height):
7676
# Modify the signature in vin 0 and nSequence/nLockTime of the tx to pass CLTV
7777
scheme = [[CScriptNum(height), OP_CHECKLOCKTIMEVERIFY, OP_DROP], 0, height]
7878

79-
return cltv_modify_tx(node, tx, prepend_scriptsig=scheme[0], nsequence=scheme[1], nlocktime=scheme[2])
79+
return cltv_modify_tx(tx, prepend_scriptsig=scheme[0], nsequence=scheme[1], nlocktime=scheme[2])
8080

8181

8282
class BIP65Test(BitcoinTestFramework):
@@ -114,7 +114,7 @@ def run_test(self):
114114
invalid_cltv_txs = []
115115
for i in range(5):
116116
spendtx = wallet.create_self_transfer(from_node=self.nodes[0])['tx']
117-
spendtx = cltv_invalidate(self.nodes[0], spendtx, i)
117+
spendtx = cltv_invalidate(spendtx, i)
118118
invalid_cltv_txs.append(spendtx)
119119

120120
tip = self.nodes[0].getbestblockhash()
@@ -149,7 +149,7 @@ def run_test(self):
149149
# create and test one invalid tx per CLTV failure reason (5 in total)
150150
for i in range(5):
151151
spendtx = wallet.create_self_transfer(from_node=self.nodes[0])['tx']
152-
spendtx = cltv_invalidate(self.nodes[0], spendtx, i)
152+
spendtx = cltv_invalidate(spendtx, i)
153153

154154
expected_cltv_reject_reason = [
155155
"non-mandatory-script-verify-flag (Operation not valid with the current stack size)",
@@ -182,7 +182,7 @@ def run_test(self):
182182
peer.sync_with_ping()
183183

184184
self.log.info("Test that a version 4 block with a valid-according-to-CLTV transaction is accepted")
185-
spendtx = cltv_validate(self.nodes[0], spendtx, CLTV_HEIGHT - 1)
185+
spendtx = cltv_validate(spendtx, CLTV_HEIGHT - 1)
186186

187187
block.vtx.pop(1)
188188
block.vtx.append(spendtx)

0 commit comments

Comments
 (0)