Skip to content

Commit d9dcdd5

Browse files
MarcoFalkejanus
authored andcommitted
test: Remove unused, undocumented and misleading CScript.__add__
1 parent 035f211 commit d9dcdd5

File tree

3 files changed

+5
-11
lines changed

3 files changed

+5
-11
lines changed

test/functional/feature_rbf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from test_framework.script import CScript, OP_DROP
1111
from test_framework.test_framework import BGLTestFramework
1212
from test_framework.util import assert_equal, assert_raises_rpc_error, satoshi_round
13-
from test_framework.script_util import DUMMY_P2WPKH_SCRIPT
13+
from test_framework.script_util import DUMMY_P2WPKH_SCRIPT, DUMMY_2_P2WPKH_SCRIPT
1414

1515
MAX_REPLACEMENT_LIMIT = 100
1616

@@ -142,7 +142,7 @@ def test_simple_doublespend(self):
142142
# Should fail because we haven't changed the fee
143143
tx1b = CTransaction()
144144
tx1b.vin = [CTxIn(tx0_outpoint, nSequence=0)]
145-
tx1b.vout = [CTxOut(1 * COIN, DUMMY_P2WPKH_SCRIPT + b'a')]
145+
tx1b.vout = [CTxOut(1 * COIN, DUMMY_2_P2WPKH_SCRIPT)]
146146
tx1b_hex = txToHex(tx1b)
147147

148148
# This will raise an exception due to insufficient fee

test/functional/test_framework/script.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -445,15 +445,8 @@ def __coerce_instance(cls, other):
445445
return other
446446

447447
def __add__(self, other):
448-
# Do the coercion outside of the try block so that errors in it are
449-
# noticed.
450-
other = self.__coerce_instance(other)
451-
452-
try:
453-
# bytes.__add__ always returns bytes instances unfortunately
454-
return CScript(super(CScript, self).__add__(other))
455-
except TypeError:
456-
raise TypeError('Can not add a %r instance to a CScript' % other.__class__)
448+
# add makes no sense for a CScript()
449+
raise NotImplementedError
457450

458451
def join(self, iterable):
459452
# join makes no sense for a CScript()

test/functional/test_framework/script_util.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,4 @@
2323
# scriptPubKeys are needed, to guarantee that the minimum transaction size is
2424
# met.
2525
DUMMY_P2WPKH_SCRIPT = CScript([b'a' * 21])
26+
DUMMY_2_P2WPKH_SCRIPT = CScript([b'b' * 21])

0 commit comments

Comments
 (0)