mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-07 00:40:41 +01:00
test: Remove unused, undocumented and misleading CScript.__add__
This commit is contained in:
parent
9e8e813df5
commit
faff9e4bb4
3 changed files with 5 additions and 11 deletions
|
@ -10,7 +10,7 @@ from test_framework.messages import COIN, COutPoint, CTransaction, CTxIn, CTxOut
|
||||||
from test_framework.script import CScript, OP_DROP
|
from test_framework.script import CScript, OP_DROP
|
||||||
from test_framework.test_framework import BitcoinTestFramework
|
from test_framework.test_framework import BitcoinTestFramework
|
||||||
from test_framework.util import assert_equal, assert_raises_rpc_error, satoshi_round
|
from test_framework.util import assert_equal, assert_raises_rpc_error, satoshi_round
|
||||||
from test_framework.script_util import DUMMY_P2WPKH_SCRIPT
|
from test_framework.script_util import DUMMY_P2WPKH_SCRIPT, DUMMY_2_P2WPKH_SCRIPT
|
||||||
|
|
||||||
MAX_REPLACEMENT_LIMIT = 100
|
MAX_REPLACEMENT_LIMIT = 100
|
||||||
|
|
||||||
|
@ -142,7 +142,7 @@ class ReplaceByFeeTest(BitcoinTestFramework):
|
||||||
# Should fail because we haven't changed the fee
|
# Should fail because we haven't changed the fee
|
||||||
tx1b = CTransaction()
|
tx1b = CTransaction()
|
||||||
tx1b.vin = [CTxIn(tx0_outpoint, nSequence=0)]
|
tx1b.vin = [CTxIn(tx0_outpoint, nSequence=0)]
|
||||||
tx1b.vout = [CTxOut(1 * COIN, DUMMY_P2WPKH_SCRIPT + b'a')]
|
tx1b.vout = [CTxOut(1 * COIN, DUMMY_2_P2WPKH_SCRIPT)]
|
||||||
tx1b_hex = txToHex(tx1b)
|
tx1b_hex = txToHex(tx1b)
|
||||||
|
|
||||||
# This will raise an exception due to insufficient fee
|
# This will raise an exception due to insufficient fee
|
||||||
|
|
|
@ -449,15 +449,8 @@ class CScript(bytes):
|
||||||
return other
|
return other
|
||||||
|
|
||||||
def __add__(self, other):
|
def __add__(self, other):
|
||||||
# Do the coercion outside of the try block so that errors in it are
|
# add makes no sense for a CScript()
|
||||||
# noticed.
|
raise NotImplementedError
|
||||||
other = self.__coerce_instance(other)
|
|
||||||
|
|
||||||
try:
|
|
||||||
# bytes.__add__ always returns bytes instances unfortunately
|
|
||||||
return CScript(super(CScript, self).__add__(other))
|
|
||||||
except TypeError:
|
|
||||||
raise TypeError('Can not add a %r instance to a CScript' % other.__class__)
|
|
||||||
|
|
||||||
def join(self, iterable):
|
def join(self, iterable):
|
||||||
# join makes no sense for a CScript()
|
# join makes no sense for a CScript()
|
||||||
|
|
|
@ -23,3 +23,4 @@ from test_framework.script import CScript
|
||||||
# scriptPubKeys are needed, to guarantee that the minimum transaction size is
|
# scriptPubKeys are needed, to guarantee that the minimum transaction size is
|
||||||
# met.
|
# met.
|
||||||
DUMMY_P2WPKH_SCRIPT = CScript([b'a' * 21])
|
DUMMY_P2WPKH_SCRIPT = CScript([b'a' * 21])
|
||||||
|
DUMMY_2_P2WPKH_SCRIPT = CScript([b'b' * 21])
|
||||||
|
|
Loading…
Add table
Reference in a new issue