mirror of
https://github.com/Chia-Network/chia-blockchain.git
synced 2024-12-01 20:05:43 +03:00
flake
This commit is contained in:
parent
42fe7f7600
commit
e6688d407f
@ -439,7 +439,9 @@ class WalletRpcApi:
|
||||
success,
|
||||
discrepancies,
|
||||
error,
|
||||
) = await self.service.wallet_state_manager.trade_manager.get_discrepancies_for_offer(file_path)
|
||||
) = await self.service.wallet_state_manager.trade_manager.get_discrepancies_for_offer(
|
||||
file_path
|
||||
)
|
||||
|
||||
if success:
|
||||
response = {"success": True, "discrepancies": discrepancies}
|
||||
@ -455,7 +457,9 @@ class WalletRpcApi:
|
||||
success,
|
||||
spend_bundle,
|
||||
error,
|
||||
) = await self.service.wallet_state_manager.trade_manager.create_offer_for_ids(offer)
|
||||
) = await self.service.wallet_state_manager.trade_manager.create_offer_for_ids(
|
||||
offer
|
||||
)
|
||||
if success:
|
||||
self.service.wallet_state_manager.trade_manager.write_offer_to_disk(
|
||||
Path(file_name), spend_bundle
|
||||
@ -468,7 +472,13 @@ class WalletRpcApi:
|
||||
|
||||
async def respond_to_offer(self, request):
|
||||
file_path = Path(request["filename"])
|
||||
success, trade_record, reason = await self.service.wallet_state_manager.trade_manager.respond_to_offer(file_path)
|
||||
(
|
||||
success,
|
||||
trade_record,
|
||||
reason,
|
||||
) = await self.service.wallet_state_manager.trade_manager.respond_to_offer(
|
||||
file_path
|
||||
)
|
||||
if success:
|
||||
response = {"success": success}
|
||||
else:
|
||||
|
@ -137,6 +137,7 @@ class FullNodeSimulator(FullNode):
|
||||
dict_h[top_tip.height + 1] = (program, bundle.aggregated_signature)
|
||||
fees = bundle.fees()
|
||||
from tests.block_tools import BlockTools
|
||||
|
||||
bt = BlockTools()
|
||||
|
||||
more_blocks = bt.get_consecutive_blocks(
|
||||
@ -165,6 +166,7 @@ class FullNodeSimulator(FullNode):
|
||||
current_blocks = await self.get_current_blocks(top_tip)
|
||||
block_count = new_index - old_index
|
||||
from tests.block_tools import BlockTools
|
||||
|
||||
bt = BlockTools()
|
||||
|
||||
more_blocks = bt.get_consecutive_blocks(
|
||||
|
@ -421,7 +421,9 @@ class TradeManager:
|
||||
|
||||
return True
|
||||
|
||||
async def respond_to_offer(self, file_path: Path) -> Tuple[bool, Optional[TradeRecord], Optional[str]]:
|
||||
async def respond_to_offer(
|
||||
self, file_path: Path
|
||||
) -> Tuple[bool, Optional[TradeRecord], Optional[str]]:
|
||||
has_wallets = await self.maybe_create_wallets_for_offer(file_path)
|
||||
if not has_wallets:
|
||||
return False, None, "Unknown Error"
|
||||
@ -463,7 +465,7 @@ class TradeManager:
|
||||
wallets[colour].wallet_info.id
|
||||
)
|
||||
if coinsol.coin in [record.coin for record in unspent]:
|
||||
return False, "can't respond to own offer"
|
||||
return False, None, "can't respond to own offer"
|
||||
innerpuzzlereveal = solution.rest().rest().rest().first()
|
||||
innersol = solution.rest().rest().rest().rest().first()
|
||||
out_amount = cc_wallet_puzzles.get_output_amount_for_puzzle_and_solution(
|
||||
@ -544,7 +546,8 @@ class TradeManager:
|
||||
].generate_zero_val_coin(False, to_exclude)
|
||||
if zero_spend_bundle is None:
|
||||
return (
|
||||
False, None,
|
||||
False,
|
||||
None,
|
||||
"Unable to generate zero value coin. Confirm that you have chia available",
|
||||
)
|
||||
zero_spend_list.append(zero_spend_bundle)
|
||||
@ -744,7 +747,7 @@ class TradeManager:
|
||||
removals=chia_spend_bundle.removals(),
|
||||
wallet_id=uint32(1),
|
||||
sent_to=[],
|
||||
trade_id=std_hash(spend_bundle.name() + bytes(now))
|
||||
trade_id=std_hash(spend_bundle.name() + bytes(now)),
|
||||
)
|
||||
else:
|
||||
tx_record = TransactionRecord(
|
||||
|
@ -479,7 +479,9 @@ class WalletStateManager:
|
||||
info = await self.puzzle_store.wallet_info_for_puzzle_hash(coin.puzzle_hash)
|
||||
if info is not None:
|
||||
wallet_id, wallet_type = info
|
||||
await self.coin_added(coin, height, is_coinbase, uint32(wallet_id), wallet_type)
|
||||
await self.coin_added(
|
||||
coin, height, is_coinbase, uint32(wallet_id), wallet_type
|
||||
)
|
||||
|
||||
return trade_adds
|
||||
|
||||
|
@ -152,7 +152,6 @@ class TestCCTrades:
|
||||
trade: TradeStatus = await trade_manager_0.get_trade_by_id(trade_offer.trade_id)
|
||||
assert TradeStatus(trade.status) is TradeStatus.CONFIRMED
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_cc_trade_with_multiple_colours(self, wallets_prefarm):
|
||||
# This test start with CCWallet in both wallets. wall
|
||||
@ -164,7 +163,7 @@ class TestCCTrades:
|
||||
wallet_b = wallet_node_b.wallet_state_manager.main_wallet
|
||||
|
||||
# cc_a_2 = coloured coin, Alice, wallet id = 2
|
||||
cc_a_2 = wallet_node_a.wallet_state_manager.wallets[2]
|
||||
cc_a_2 = wallet_node_a.wallet_state_manager.wallets[2]
|
||||
cc_b_2 = wallet_node_b.wallet_state_manager.wallets[2]
|
||||
|
||||
cc_a_3: CCWallet = await CCWallet.create_new_cc(
|
||||
@ -271,8 +270,9 @@ class TestCCTrades:
|
||||
|
||||
colour = await cc_a_4.get_colour()
|
||||
|
||||
cc_b_4: CCWallet = await CCWallet.create_wallet_for_cc(wallet_node_b.wallet_state_manager, wallet_b, colour)
|
||||
|
||||
cc_b_4: CCWallet = await CCWallet.create_wallet_for_cc(
|
||||
wallet_node_b.wallet_state_manager, wallet_b, colour
|
||||
)
|
||||
|
||||
offer = {1: -30, 4: 60}
|
||||
file = "test_offer_file.offer"
|
||||
@ -318,9 +318,9 @@ class TestCCTrades:
|
||||
file_path.unlink()
|
||||
|
||||
spendable_chia = await wallet_a.get_spendable_balance()
|
||||
spendable_cc_2 = await cc_a_2.get_spendable_balance()
|
||||
spendable_cc_2 = await cc_a_2.get_spendable_balance()
|
||||
|
||||
offer_dict = {1: 10, 2: -30, 3:30}
|
||||
offer_dict = {1: 10, 2: -30, 3: 30}
|
||||
|
||||
success, trade_offer, error = await trade_manager_a.create_offer_for_ids(
|
||||
offer_dict, file
|
||||
|
Loading…
Reference in New Issue
Block a user