Skip to content

Commit 47b94a3

Browse files
author
MarcoFalke
committed
Merge #18732: test: Remove unused, undocumented and misleading CScript.__add__
faff9e4 test: Remove unused, undocumented and misleading CScript.__add__ (MarcoFalke) Pull request description: See the corresponding pull #18612 ACKs for top commit: laanwj: ACK faff9e4 provided it passes Travis Tree-SHA512: 5d9c4d5b6453c70b24a6960d3b42834e9b31f6dbb99ac47a6abfd85f2739d5372563e7188c22aceabeee1c37eb218bf580848356f4a77268d65f178a9419b269
2 parents fb89af2 + faff9e4 commit 47b94a3

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 BitcoinTestFramework
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
@@ -449,15 +449,8 @@ def __coerce_instance(cls, other):
449449
return other
450450

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

462455
def join(self, iterable):
463456
# 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)