mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-11 05:03:16 +01:00
test: refactor: deduplicate DEFAULT_{ANCESTOR,DESCENDANT}_LIMIT constants
This commit is contained in:
@@ -7,6 +7,9 @@
|
|||||||
size.
|
size.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from test_framework.messages import (
|
||||||
|
DEFAULT_ANCESTOR_LIMIT,
|
||||||
|
)
|
||||||
from test_framework.test_framework import BitcoinTestFramework
|
from test_framework.test_framework import BitcoinTestFramework
|
||||||
from test_framework.util import (
|
from test_framework.util import (
|
||||||
assert_equal,
|
assert_equal,
|
||||||
@@ -15,10 +18,6 @@ from test_framework.util import (
|
|||||||
from test_framework.wallet import MiniWallet
|
from test_framework.wallet import MiniWallet
|
||||||
|
|
||||||
|
|
||||||
DEFAULT_ANCESTOR_LIMIT = 25
|
|
||||||
DEFAULT_DESCENDANT_LIMIT = 25
|
|
||||||
|
|
||||||
|
|
||||||
class MempoolPackagesTest(BitcoinTestFramework):
|
class MempoolPackagesTest(BitcoinTestFramework):
|
||||||
def set_test_params(self):
|
def set_test_params(self):
|
||||||
self.num_nodes = 1
|
self.num_nodes = 1
|
||||||
|
|||||||
@@ -7,7 +7,11 @@
|
|||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
|
|
||||||
from test_framework.blocktools import COINBASE_MATURITY
|
from test_framework.blocktools import COINBASE_MATURITY
|
||||||
from test_framework.messages import COIN
|
from test_framework.messages import (
|
||||||
|
COIN,
|
||||||
|
DEFAULT_ANCESTOR_LIMIT,
|
||||||
|
DEFAULT_DESCENDANT_LIMIT,
|
||||||
|
)
|
||||||
from test_framework.p2p import P2PTxInvStore
|
from test_framework.p2p import P2PTxInvStore
|
||||||
from test_framework.test_framework import BitcoinTestFramework
|
from test_framework.test_framework import BitcoinTestFramework
|
||||||
from test_framework.util import (
|
from test_framework.util import (
|
||||||
@@ -16,14 +20,13 @@ from test_framework.util import (
|
|||||||
chain_transaction,
|
chain_transaction,
|
||||||
)
|
)
|
||||||
|
|
||||||
# default limits
|
|
||||||
DEFAULT_ANCESTOR_LIMIT = 25
|
|
||||||
DEFAULT_DESCENDANT_LIMIT = 25
|
|
||||||
# custom limits for node1
|
# custom limits for node1
|
||||||
CUSTOM_ANCESTOR_LIMIT = 5
|
CUSTOM_ANCESTOR_LIMIT = 5
|
||||||
CUSTOM_DESCENDANT_LIMIT = 10
|
CUSTOM_DESCENDANT_LIMIT = 10
|
||||||
assert CUSTOM_DESCENDANT_LIMIT >= CUSTOM_ANCESTOR_LIMIT
|
assert CUSTOM_DESCENDANT_LIMIT >= CUSTOM_ANCESTOR_LIMIT
|
||||||
|
|
||||||
|
|
||||||
class MempoolPackagesTest(BitcoinTestFramework):
|
class MempoolPackagesTest(BitcoinTestFramework):
|
||||||
def set_test_params(self):
|
def set_test_params(self):
|
||||||
self.num_nodes = 2
|
self.num_nodes = 2
|
||||||
|
|||||||
@@ -65,6 +65,9 @@ FILTER_TYPE_BASIC = 0
|
|||||||
|
|
||||||
WITNESS_SCALE_FACTOR = 4
|
WITNESS_SCALE_FACTOR = 4
|
||||||
|
|
||||||
|
DEFAULT_ANCESTOR_LIMIT = 25 # default max number of in-mempool ancestors
|
||||||
|
DEFAULT_DESCENDANT_LIMIT = 25 # default max number of in-mempool descendants
|
||||||
|
|
||||||
|
|
||||||
def sha256(s):
|
def sha256(s):
|
||||||
return hashlib.sha256(s).digest()
|
return hashlib.sha256(s).digest()
|
||||||
|
|||||||
Reference in New Issue
Block a user