Skip to content

Commit

Permalink
Merge commit '111b0e57d5995d760cac877c45ef8822506800b6' into catchup/…
Browse files Browse the repository at this point in the history
…long_lived_vault_from_main_111b0e57d5995d760cac877c45ef8822506800b6
  • Loading branch information
Quexington committed Sep 23, 2024
2 parents 4cb5948 + 111b0e5 commit 155bebf
Show file tree
Hide file tree
Showing 8 changed files with 735 additions and 261 deletions.
13 changes: 10 additions & 3 deletions chia/_tests/environments/wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,9 @@ class WalletTestFramework:
environments: List[WalletEnvironment]
tx_config: TXConfig = DEFAULT_TX_CONFIG

async def process_pending_states(self, state_transitions: List[WalletStateTransition]) -> None:
async def process_pending_states(
self, state_transitions: List[WalletStateTransition], invalid_transactions: List[bytes32] = []
) -> None:
"""
This is the main entry point for processing state in wallet tests. It does the following things:
Expand Down Expand Up @@ -314,7 +316,11 @@ async def process_pending_states(self, state_transitions: List[WalletStateTransi
for i, env in enumerate(self.environments):
await self.full_node.wait_for_wallet_synced(wallet_node=env.node, timeout=20)
try:
pending_txs.append(await env.wait_for_transactions_to_settle(self.full_node))
pending_txs.append(
await env.wait_for_transactions_to_settle(
self.full_node, _exclude_from_mempool_check=invalid_transactions
)
)
except TimeoutError: # pragma: no cover
raise TimeoutError(f"All TXs for env-{i} were not found in mempool or marked as in mempool")
for i, (env, transition) in enumerate(zip(self.environments, state_transitions)):
Expand All @@ -340,7 +346,8 @@ async def process_pending_states(self, state_transitions: List[WalletStateTransi
)
try:
await env.wait_for_transactions_to_settle(
self.full_node, _exclude_from_mempool_check=[tx.name for tx in local_pending_txs]
self.full_node,
_exclude_from_mempool_check=invalid_transactions + [tx.name for tx in local_pending_txs],
)
except TimeoutError: # pragma: no cover
raise TimeoutError(f"All TXs for env-{i} were not found in mempool or marked as in mempool")
Expand Down
941 changes: 706 additions & 235 deletions chia/_tests/wallet/cat_wallet/test_trades.py

Large diffs are not rendered by default.

7 changes: 1 addition & 6 deletions chia/full_node/full_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -2444,12 +2444,7 @@ async def add_end_of_sub_slot(
return None, False

async def add_transaction(
self,
transaction: SpendBundle,
spend_name: bytes32,
peer: Optional[WSChiaConnection] = None,
test: bool = False,
tx_bytes: Optional[bytes] = None,
self, transaction: SpendBundle, spend_name: bytes32, peer: Optional[WSChiaConnection] = None, test: bool = False
) -> Tuple[MempoolInclusionStatus, Optional[Err]]:
if self.sync_store.get_sync_mode():
return MempoolInclusionStatus.FAILED, Err.NO_TRANSACTIONS_WHILE_SYNCING
Expand Down
3 changes: 1 addition & 2 deletions chia/full_node/mempool.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,8 +494,7 @@ async def create_bundle_from_mempool_items(
sigs: List[G2Element] = []
log.info(f"Starting to make block, max cost: {self.mempool_info.max_block_clvm_cost}")
bundle_creation_start = monotonic()
with self._db_conn:
cursor = self._db_conn.execute("SELECT name, fee FROM tx ORDER BY fee_per_cost DESC, seq ASC")
cursor = self._db_conn.execute("SELECT name, fee FROM tx ORDER BY fee_per_cost DESC, seq ASC")
skipped_items = 0
for row in cursor:
name = bytes32(row[0])
Expand Down
6 changes: 4 additions & 2 deletions chia/util/chia_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import colorlog
from concurrent_log_handler import ConcurrentRotatingFileHandler

from chia import __version__
from chia.util.chia_version import chia_short_version
from chia.util.default_root import DEFAULT_ROOT_PATH
from chia.util.path import path_from_root
Expand Down Expand Up @@ -52,15 +53,16 @@ def initialize_logging(
file_name_length = 33 - len(service_name)
log_date_format = "%Y-%m-%dT%H:%M:%S"
file_log_formatter = logging.Formatter(
fmt=f"%(asctime)s.%(msecs)03d {service_name} %(name)-{file_name_length}s: %(levelname)-8s %(message)s",
fmt=f"%(asctime)s.%(msecs)03d {__version__} {service_name} %(name)-{file_name_length}s: "
f"%(levelname)-8s %(message)s",
datefmt=log_date_format,
)
handlers: List[logging.Handler] = []
if logging_config["log_stdout"]:
stdout_handler = colorlog.StreamHandler()
stdout_handler.setFormatter(
colorlog.ColoredFormatter(
f"%(asctime)s.%(msecs)03d {service_name} %(name)-{file_name_length}s: "
f"%(asctime)s.%(msecs)03d {__version__} {service_name} %(name)-{file_name_length}s: "
f"%(log_color)s%(levelname)-8s%(reset)s %(message)s",
datefmt=log_date_format,
reset=True,
Expand Down
2 changes: 1 addition & 1 deletion chia/wallet/trade_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ async def cancel_pending_offers(
confirmed=False,
sent=uint32(10),
spend_bundle=None,
additions=cancellation_additions,
additions=[],
removals=[coin],
wallet_id=wallet.id(),
sent_to=[],
Expand Down
20 changes: 10 additions & 10 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ isort = { version = "5.13.2", optional = true }
"keyrings.cryptfile" = { version = "1.3.9", optional = true }
mypy = { version = "1.11.1", optional = true }
pre-commit = [ { version = "3.5.0", python = "<3.9", optional = true }, { version = "3.7.1", python = ">=3.9", optional = true } ]
py3createtorrent = { version = "1.1.0", optional = true }
py3createtorrent = { version = "1.2.1", optional = true }
pyinstaller = { version = "6.9.0", optional = true }
pylint = { version = "3.2.6", optional = true }
pytest = { version = "8.1.1", optional = true }
pytest = { version = "8.3.3", optional = true }
pytest-cov = { version = "5.0.0", optional = true }
pytest-mock = { version = "3.14.0", optional = true }
pytest-monitor = { version = "1.6.6", platform = "linux", optional = true }
Expand Down

0 comments on commit 155bebf

Please sign in to comment.