Skip to content

Commit d5f6323

Browse files
committed
fix tests
1 parent c41a5f6 commit d5f6323

File tree

3 files changed

+7
-13
lines changed

3 files changed

+7
-13
lines changed

chia/wallet/util/tx_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def autofill(
8888

8989
@classmethod
9090
def from_json_dict(cls, json_dict: dict[str, Any]) -> Self:
91-
if "excluded_coins" in json_dict:
91+
if "excluded_coins" in json_dict and json_dict["excluded_coins"] is not None:
9292
excluded_coins: list[Coin] = [Coin.from_json_dict(c) for c in json_dict["excluded_coins"]]
9393
excluded_coin_ids: list[str] = [c.name().hex() for c in excluded_coins]
9494
if "excluded_coin_ids" in json_dict:

chia/wallet/wallet_request_types.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -485,16 +485,13 @@ class DeleteUnconfirmedTransactions(Streamable):
485485
class SelectCoins(CoinSelectionConfigLoader):
486486
wallet_id: uint32 = field(default_factory=default_raise)
487487
amount: uint64 = field(default_factory=default_raise)
488-
excluded_coins: Optional[list[Coin]] = None
489-
exclude_coins: Optional[list[Coin]] = None
488+
exclude_coins: Optional[list[Coin]] = None # for backwards compatibility
490489

491490
def __post_init__(self) -> None:
492-
if self.excluded_coin_ids is not None and (self.excluded_coins is not None or self.exclude_coins is not None):
491+
if self.excluded_coin_ids is not None and self.exclude_coins is not None:
493492
raise ValueError(
494-
"Cannot specify both excluded_coin_ids and exclude(d)_coins (the latter arguments are deprecated)"
493+
"Cannot specify both excluded_coin_ids/excluded_coins and exclude_coins (the latter is deprecated)"
495494
)
496-
elif self.excluded_coins is not None and self.exclude_coins is not None:
497-
raise ValueError("Cannot specify both excluded_coins and exclude_coins (both are deprecated)")
498495
super().__post_init__()
499496

500497
@classmethod

chia/wallet/wallet_rpc_api.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1739,13 +1739,10 @@ async def select_coins(
17391739

17401740
# Some backwards compat fill-ins
17411741
if request.excluded_coin_ids is None:
1742-
if request.excluded_coins is not None:
1743-
request = request.override(
1744-
excluded_coin_ids=[c.name() for c in request.excluded_coins],
1745-
)
1746-
elif request.exclude_coins is not None:
1742+
if request.exclude_coins is not None:
17471743
request = request.override(
17481744
excluded_coin_ids=[c.name() for c in request.exclude_coins],
1745+
exclude_coins=None,
17491746
)
17501747

17511748
# don't love this snippet of code
@@ -1754,7 +1751,7 @@ async def select_coins(
17541751
tx_config = DEFAULT_TX_CONFIG.override(
17551752
**request.autofill(
17561753
constants=self.service.wallet_state_manager.constants,
1757-
).to_json_dict()
1754+
).__dict__
17581755
)
17591756

17601757
if await self.service.wallet_state_manager.synced() is False:

0 commit comments

Comments
 (0)