diff options
author | Sebastian Falbesoner <sebastian.falbesoner@gmail.com> | 2021-05-31 19:44:02 +0200 |
---|---|---|
committer | Sebastian Falbesoner <sebastian.falbesoner@gmail.com> | 2021-05-31 19:47:30 +0200 |
commit | 7e32fde912b3924fdb27ec1f658ac11fcf160b3e (patch) | |
tree | 681d5496c5338034dadf83e692391792b55c42b7 /test | |
parent | 9ab2ce0a6673acc7ee0f85158fc087fce0fc7dd8 (diff) |
test: feature_cltv.py: don't return tx copies in modification functions
The functions cltv_modify_tx(), cltv_invalidate() and cltv_validate()
all modify the passed transaction in-place, i.e. there is no need
to return a copy.
Diffstat (limited to 'test')
-rwxr-xr-x | test/functional/feature_cltv.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/test/functional/feature_cltv.py b/test/functional/feature_cltv.py index b1adb37bc4..10d2072dba 100755 --- a/test/functional/feature_cltv.py +++ b/test/functional/feature_cltv.py @@ -45,7 +45,6 @@ def cltv_modify_tx(tx, prepend_scriptsig, nsequence=None, nlocktime=None): tx.vin[0].scriptSig = CScript(prepend_scriptsig + list(CScript(tx.vin[0].scriptSig))) tx.rehash() - return tx def cltv_invalidate(tx, failure_reason): @@ -69,14 +68,14 @@ def cltv_invalidate(tx, failure_reason): [[CScriptNum(500), OP_CHECKLOCKTIMEVERIFY, OP_DROP], 0xffffffff, 500], ][failure_reason] - return cltv_modify_tx(tx, prepend_scriptsig=scheme[0], nsequence=scheme[1], nlocktime=scheme[2]) + cltv_modify_tx(tx, prepend_scriptsig=scheme[0], nsequence=scheme[1], nlocktime=scheme[2]) def cltv_validate(tx, height): # Modify the signature in vin 0 and nSequence/nLockTime of the tx to pass CLTV scheme = [[CScriptNum(height), OP_CHECKLOCKTIMEVERIFY, OP_DROP], 0, height] - return cltv_modify_tx(tx, prepend_scriptsig=scheme[0], nsequence=scheme[1], nlocktime=scheme[2]) + cltv_modify_tx(tx, prepend_scriptsig=scheme[0], nsequence=scheme[1], nlocktime=scheme[2]) class BIP65Test(BitcoinTestFramework): @@ -114,7 +113,7 @@ class BIP65Test(BitcoinTestFramework): invalid_cltv_txs = [] for i in range(5): spendtx = wallet.create_self_transfer(from_node=self.nodes[0])['tx'] - spendtx = cltv_invalidate(spendtx, i) + cltv_invalidate(spendtx, i) invalid_cltv_txs.append(spendtx) tip = self.nodes[0].getbestblockhash() @@ -149,7 +148,7 @@ class BIP65Test(BitcoinTestFramework): # create and test one invalid tx per CLTV failure reason (5 in total) for i in range(5): spendtx = wallet.create_self_transfer(from_node=self.nodes[0])['tx'] - spendtx = cltv_invalidate(spendtx, i) + cltv_invalidate(spendtx, i) expected_cltv_reject_reason = [ "non-mandatory-script-verify-flag (Operation not valid with the current stack size)", @@ -182,7 +181,7 @@ class BIP65Test(BitcoinTestFramework): peer.sync_with_ping() self.log.info("Test that a version 4 block with a valid-according-to-CLTV transaction is accepted") - spendtx = cltv_validate(spendtx, CLTV_HEIGHT - 1) + cltv_validate(spendtx, CLTV_HEIGHT - 1) block.vtx.pop(1) block.vtx.append(spendtx) |