Changeset View
Changeset View
Standalone View
Standalone View
test/functional/data/invalid_txs.py
Show All 15 Lines | Invalid tx cases not covered here can be found by running: | ||||
$ diff \ | $ diff \ | ||||
<(grep -IREho "bad-txns[a-zA-Z-]+" src | sort -u) \ | <(grep -IREho "bad-txns[a-zA-Z-]+" src | sort -u) \ | ||||
<(grep -IEho "bad-txns[a-zA-Z-]+" test/functional/data/invalid_txs.py | sort -u) | <(grep -IEho "bad-txns[a-zA-Z-]+" test/functional/data/invalid_txs.py | sort -u) | ||||
""" | """ | ||||
import abc | import abc | ||||
from typing import Optional | |||||
from test_framework.messages import ( | from test_framework.messages import ( | ||||
COutPoint, | COutPoint, | ||||
CTransaction, | CTransaction, | ||||
CTxIn, | CTxIn, | ||||
CTxOut, | CTxOut, | ||||
MAX_MONEY, | MAX_MONEY, | ||||
) | ) | ||||
from test_framework import script as sc | from test_framework import script as sc | ||||
Show All 15 Lines | basic_p2sh = sc.CScript( | ||||
[sc.OP_HASH160, sc.hash160(sc.CScript([sc.OP_0])), sc.OP_EQUAL]) | [sc.OP_HASH160, sc.hash160(sc.CScript([sc.OP_0])), sc.OP_EQUAL]) | ||||
class BadTxTemplate: | class BadTxTemplate: | ||||
"""Allows simple construction of a certain kind of invalid tx. Base class to be subclassed.""" | """Allows simple construction of a certain kind of invalid tx. Base class to be subclassed.""" | ||||
__metaclass__ = abc.ABCMeta | __metaclass__ = abc.ABCMeta | ||||
# The expected error code given by bitcoind upon submission of the tx. | # The expected error code given by bitcoind upon submission of the tx. | ||||
reject_reason = "" | reject_reason: Optional[str] = "" | ||||
# Only specified if it differs from mempool acceptance error. | # Only specified if it differs from mempool acceptance error. | ||||
block_reject_reason = "" | block_reject_reason = "" | ||||
# Do we expect to be disconnected after submitting this tx? | # Do we expect to be disconnected after submitting this tx? | ||||
expect_disconnect = False | expect_disconnect = False | ||||
# Is this tx considered valid when included in a block, but not for acceptance into | # Is this tx considered valid when included in a block, but not for acceptance into | ||||
▲ Show 20 Lines • Show All 193 Lines • Show Last 20 Lines |