more test fixs
This commit is contained in:
parent
2d94ae765d
commit
b71466f427
|
@ -646,8 +646,6 @@ class CATWallet:
|
|||
uint64(starting_amount),
|
||||
tx_config.coin_selection_config,
|
||||
)
|
||||
elif tx_config.coin_selection_config.excluded_coin_ids != []:
|
||||
raise ValueError("Can't exclude coins when also specifically including coins")
|
||||
else:
|
||||
cat_coins = coins
|
||||
|
||||
|
|
|
@ -351,11 +351,6 @@ class Wallet:
|
|||
uint64(total_amount),
|
||||
tx_config.coin_selection_config,
|
||||
)
|
||||
elif (
|
||||
len(tx_config.coin_selection_config.excluded_coin_ids) > 0
|
||||
or len(tx_config.coin_selection_config.excluded_coin_amounts) > 0
|
||||
):
|
||||
raise ValueError("Can't exclude coins when also specifically including coins")
|
||||
|
||||
assert len(coins) > 0
|
||||
self.log.info(f"coins is not None {coins}")
|
||||
|
|
|
@ -894,7 +894,7 @@ class TestCATWallet:
|
|||
await time_out_assert(30, cat_wallet_2.get_unconfirmed_balance, 70)
|
||||
|
||||
cat_hash = await cat_wallet.get_new_inner_hash()
|
||||
tx_records = await cat_wallet_2.generate_signed_transaction([uint64(5)], DEFAULT_TX_CONFIG, [cat_hash])
|
||||
tx_records = await cat_wallet_2.generate_signed_transaction([uint64(5)], [cat_hash], DEFAULT_TX_CONFIG)
|
||||
for tx_record in tx_records:
|
||||
await wallet.wallet_state_manager.add_pending_transaction(tx_record)
|
||||
|
||||
|
|
|
@ -897,14 +897,14 @@ class TestDIDWallet:
|
|||
assert response["metadata"]["twitter"] == "twitter"
|
||||
assert (
|
||||
response["latest_coin"]
|
||||
== (await did_wallet_1.select_coins(uint64(1, DEFAULT_COIN_SELECTION_CONFIG))).pop().name().hex()
|
||||
== (await did_wallet_1.select_coins(uint64(1), DEFAULT_COIN_SELECTION_CONFIG)).pop().name().hex()
|
||||
)
|
||||
assert response["num_verification"] == 0
|
||||
assert response["recovery_list_hash"] == Program(Program.to([])).get_tree_hash().hex()
|
||||
assert decode_puzzle_hash(response["p2_address"]).hex() == response["hints"][0]
|
||||
|
||||
# Test non-singleton coin
|
||||
coin = (await wallet.select_coins(uint64(1, DEFAULT_COIN_SELECTION_CONFIG))).pop()
|
||||
coin = (await wallet.select_coins(uint64(1), DEFAULT_COIN_SELECTION_CONFIG)).pop()
|
||||
assert coin.amount % 2 == 1
|
||||
response = await api_0.did_get_info({"coin_id": coin.name().hex()})
|
||||
assert not response["success"]
|
||||
|
@ -920,8 +920,13 @@ class TestDIDWallet:
|
|||
tx = await wallet.generate_signed_transaction(
|
||||
odd_amount,
|
||||
ph1,
|
||||
dataclasses.replace(
|
||||
DEFAULT_TX_CONFIG,
|
||||
coin_selection_config=dataclasses.replace(
|
||||
DEFAULT_COIN_SELECTION_CONFIG, excluded_coin_ids=[coin.name()]
|
||||
),
|
||||
),
|
||||
fee,
|
||||
excluded_coins=set([coin]),
|
||||
)
|
||||
await wallet.push_transaction(tx)
|
||||
await full_node_api.process_transaction_records(records=[tx])
|
||||
|
|
|
@ -1014,7 +1014,7 @@ async def test_cat_endpoints(wallet_rpc_environment: WalletRpcTestEnvironment):
|
|||
coin_selection_config=dataclasses.replace(
|
||||
DEFAULT_COIN_SELECTION_CONFIG,
|
||||
excluded_coin_amounts=[uint64(20)],
|
||||
excluded_coin_ids=[bytes32([0] * 32).hex()],
|
||||
excluded_coin_ids=[bytes32([0] * 32)],
|
||||
),
|
||||
),
|
||||
uint64(4),
|
||||
|
@ -1656,12 +1656,16 @@ async def test_select_coins_rpc(wallet_rpc_environment: WalletRpcTestEnvironment
|
|||
await client_2.select_coins(
|
||||
amount=5000,
|
||||
wallet_id=1,
|
||||
coin_selection_config=dataclasses.replace(DEFAULT_COIN_SELECTION_CONFIG, excluded_coins=min_coins),
|
||||
coin_selection_config=dataclasses.replace(
|
||||
DEFAULT_COIN_SELECTION_CONFIG, excluded_coin_ids=[c.name() for c in min_coins]
|
||||
),
|
||||
)
|
||||
excluded_test = await client_2.select_coins(
|
||||
amount=1300,
|
||||
wallet_id=1,
|
||||
coin_selection_config=dataclasses.replace(DEFAULT_COIN_SELECTION_CONFIG, excluded_coins=coin_300),
|
||||
coin_selection_config=dataclasses.replace(
|
||||
DEFAULT_COIN_SELECTION_CONFIG, excluded_coin_ids=[c.name() for c in coin_300]
|
||||
),
|
||||
)
|
||||
assert len(excluded_test) == 2
|
||||
for coin in excluded_test:
|
||||
|
@ -1671,7 +1675,7 @@ async def test_select_coins_rpc(wallet_rpc_environment: WalletRpcTestEnvironment
|
|||
all_coins, _, _ = await client_2.get_spendable_coins(
|
||||
wallet_id=1,
|
||||
coin_selection_config=dataclasses.replace(
|
||||
DEFAULT_COIN_SELECTION_CONFIG, excluded_coin_ids=[c.name().hex() for c in excluded_amt_coins]
|
||||
DEFAULT_COIN_SELECTION_CONFIG, excluded_coin_ids=[c.name() for c in excluded_amt_coins]
|
||||
),
|
||||
)
|
||||
assert excluded_amt_coins not in all_coins
|
||||
|
@ -1688,7 +1692,7 @@ async def test_select_coins_rpc(wallet_rpc_environment: WalletRpcTestEnvironment
|
|||
with pytest.raises(ValueError): # validate fail on invalid coin id.
|
||||
await client_2.get_spendable_coins(
|
||||
wallet_id=1,
|
||||
coin_selection_config=dataclasses.replace(DEFAULT_COIN_SELECTION_CONFIG, excluded_coin_ids=["a"]),
|
||||
coin_selection_config=dataclasses.replace(DEFAULT_COIN_SELECTION_CONFIG, excluded_coin_ids=[b"a"]),
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -270,7 +270,9 @@ class TestSimpleSyncProtocol:
|
|||
|
||||
coins = set()
|
||||
coins.add(coin_to_spend)
|
||||
tx_record = await standard_wallet.generate_signed_transaction(uint64(10), puzzle_hash, uint64(0), coins=coins)
|
||||
tx_record = await standard_wallet.generate_signed_transaction(
|
||||
uint64(10), puzzle_hash, DEFAULT_TX_CONFIG, uint64(0), coins=coins
|
||||
)
|
||||
await standard_wallet.push_transaction(tx_record)
|
||||
|
||||
await full_node_api.process_transaction_records(records=[tx_record])
|
||||
|
@ -290,7 +292,9 @@ class TestSimpleSyncProtocol:
|
|||
# Test getting notification for coin that is about to be created
|
||||
await full_node_api.wait_for_wallet_synced(wallet_node=wallet_node, timeout=20)
|
||||
|
||||
tx_record = await standard_wallet.generate_signed_transaction(uint64(10), puzzle_hash, uint64(0))
|
||||
tx_record = await standard_wallet.generate_signed_transaction(
|
||||
uint64(10), puzzle_hash, DEFAULT_TX_CONFIG, uint64(0)
|
||||
)
|
||||
|
||||
tx_record.spend_bundle.additions()
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ from chia.wallet.nft_wallet.nft_wallet import NFTWallet
|
|||
from chia.wallet.payment import Payment
|
||||
from chia.wallet.transaction_record import TransactionRecord
|
||||
from chia.wallet.util.compute_memos import compute_memos
|
||||
from chia.wallet.util.tx_config import DEFAULT_TX_CONFIG
|
||||
from chia.wallet.util.wallet_sync_utils import PeerRequestException
|
||||
from chia.wallet.wallet_coin_record import WalletCoinRecord
|
||||
from chia.wallet.wallet_weight_proof_handler import get_wp_fork_point
|
||||
|
@ -513,7 +514,9 @@ class TestWalletSync:
|
|||
payees.append(Payment(payee_ph, uint64(i + 100)))
|
||||
payees.append(Payment(payee_ph, uint64(i + 200)))
|
||||
|
||||
tx: TransactionRecord = await wallet.generate_signed_transaction(uint64(0), ph, primaries=payees)
|
||||
tx: TransactionRecord = await wallet.generate_signed_transaction(
|
||||
uint64(0), ph, DEFAULT_TX_CONFIG, primaries=payees
|
||||
)
|
||||
await full_node_api.send_transaction(SendTransaction(tx.spend_bundle))
|
||||
|
||||
await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(ph))
|
||||
|
@ -724,7 +727,9 @@ class TestWalletSync:
|
|||
payees.append(Payment(payee_ph, uint64(dust_value)))
|
||||
|
||||
# construct and send tx
|
||||
tx: TransactionRecord = await farm_wallet.generate_signed_transaction(uint64(0), ph, primaries=payees)
|
||||
tx: TransactionRecord = await farm_wallet.generate_signed_transaction(
|
||||
uint64(0), ph, DEFAULT_TX_CONFIG, primaries=payees
|
||||
)
|
||||
await full_node_api.send_transaction(SendTransaction(tx.spend_bundle))
|
||||
|
||||
# advance the chain and sync both wallets
|
||||
|
@ -784,7 +789,9 @@ class TestWalletSync:
|
|||
# This greatly speeds up the overall process
|
||||
if dust_remaining % 100 == 0 and dust_remaining != new_dust:
|
||||
# construct and send tx
|
||||
tx: TransactionRecord = await farm_wallet.generate_signed_transaction(uint64(0), ph, primaries=payees)
|
||||
tx: TransactionRecord = await farm_wallet.generate_signed_transaction(
|
||||
uint64(0), ph, DEFAULT_TX_CONFIG, primaries=payees
|
||||
)
|
||||
await full_node_api.send_transaction(SendTransaction(tx.spend_bundle))
|
||||
await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(ph))
|
||||
last_block: Optional[BlockRecord] = full_node_api.full_node.blockchain.get_peak()
|
||||
|
@ -797,7 +804,9 @@ class TestWalletSync:
|
|||
# Only need to create tx if there was new dust to be added
|
||||
if new_dust >= 1:
|
||||
# construct and send tx
|
||||
tx: TransactionRecord = await farm_wallet.generate_signed_transaction(uint64(0), ph, primaries=payees)
|
||||
tx: TransactionRecord = await farm_wallet.generate_signed_transaction(
|
||||
uint64(0), ph, DEFAULT_TX_CONFIG, primaries=payees
|
||||
)
|
||||
await full_node_api.send_transaction(SendTransaction(tx.spend_bundle))
|
||||
|
||||
# advance the chain and sync both wallets
|
||||
|
@ -844,7 +853,9 @@ class TestWalletSync:
|
|||
payees.append(Payment(payee_ph, uint64(xch_spam_amount)))
|
||||
|
||||
# construct and send tx
|
||||
tx: TransactionRecord = await farm_wallet.generate_signed_transaction(uint64(0), ph, primaries=payees)
|
||||
tx: TransactionRecord = await farm_wallet.generate_signed_transaction(
|
||||
uint64(0), ph, DEFAULT_TX_CONFIG, primaries=payees
|
||||
)
|
||||
await full_node_api.send_transaction(SendTransaction(tx.spend_bundle))
|
||||
|
||||
# advance the chain and sync both wallets
|
||||
|
@ -883,7 +894,9 @@ class TestWalletSync:
|
|||
payees.append(Payment(payee_ph, uint64(dust_value)))
|
||||
|
||||
# construct and send tx
|
||||
tx: TransactionRecord = await farm_wallet.generate_signed_transaction(uint64(0), ph, primaries=payees)
|
||||
tx: TransactionRecord = await farm_wallet.generate_signed_transaction(
|
||||
uint64(0), ph, DEFAULT_TX_CONFIG, primaries=payees
|
||||
)
|
||||
await full_node_api.send_transaction(SendTransaction(tx.spend_bundle))
|
||||
|
||||
# advance the chain and sync both wallets
|
||||
|
@ -942,7 +955,9 @@ class TestWalletSync:
|
|||
large_dust_balance += dust_value
|
||||
|
||||
# construct and send tx
|
||||
tx: TransactionRecord = await farm_wallet.generate_signed_transaction(uint64(0), ph, primaries=payees)
|
||||
tx: TransactionRecord = await farm_wallet.generate_signed_transaction(
|
||||
uint64(0), ph, DEFAULT_TX_CONFIG, primaries=payees
|
||||
)
|
||||
await full_node_api.send_transaction(SendTransaction(tx.spend_bundle))
|
||||
|
||||
# advance the chain and sync both wallets
|
||||
|
@ -978,7 +993,9 @@ class TestWalletSync:
|
|||
payees = [Payment(payee_ph, uint64(balance))]
|
||||
|
||||
# construct and send tx
|
||||
tx: TransactionRecord = await dust_wallet.generate_signed_transaction(uint64(0), ph, primaries=payees)
|
||||
tx: TransactionRecord = await dust_wallet.generate_signed_transaction(
|
||||
uint64(0), ph, DEFAULT_TX_CONFIG, primaries=payees
|
||||
)
|
||||
await full_node_api.send_transaction(SendTransaction(tx.spend_bundle))
|
||||
|
||||
# advance the chain and sync both wallets
|
||||
|
@ -1021,7 +1038,9 @@ class TestWalletSync:
|
|||
# This greatly speeds up the overall process
|
||||
if coins_remaining % 100 == 0 and coins_remaining != spam_filter_after_n_txs:
|
||||
# construct and send tx
|
||||
tx: TransactionRecord = await farm_wallet.generate_signed_transaction(uint64(0), ph, primaries=payees)
|
||||
tx: TransactionRecord = await farm_wallet.generate_signed_transaction(
|
||||
uint64(0), ph, DEFAULT_TX_CONFIG, primaries=payees
|
||||
)
|
||||
await full_node_api.send_transaction(SendTransaction(tx.spend_bundle))
|
||||
await full_node_api.farm_new_transaction_block(FarmNewBlockProtocol(ph))
|
||||
last_block: Optional[BlockRecord] = full_node_api.full_node.blockchain.get_peak()
|
||||
|
@ -1032,7 +1051,9 @@ class TestWalletSync:
|
|||
coins_remaining -= 1
|
||||
|
||||
# construct and send tx
|
||||
tx: TransactionRecord = await farm_wallet.generate_signed_transaction(uint64(0), ph, primaries=payees)
|
||||
tx: TransactionRecord = await farm_wallet.generate_signed_transaction(
|
||||
uint64(0), ph, DEFAULT_TX_CONFIG, primaries=payees
|
||||
)
|
||||
await full_node_api.send_transaction(SendTransaction(tx.spend_bundle))
|
||||
|
||||
# advance the chain and sync both wallets
|
||||
|
@ -1061,7 +1082,9 @@ class TestWalletSync:
|
|||
payees = [Payment(payee_ph, uint64(1))]
|
||||
|
||||
# construct and send tx
|
||||
tx: TransactionRecord = await dust_wallet.generate_signed_transaction(uint64(0), ph, primaries=payees)
|
||||
tx: TransactionRecord = await dust_wallet.generate_signed_transaction(
|
||||
uint64(0), ph, DEFAULT_TX_CONFIG, primaries=payees
|
||||
)
|
||||
await full_node_api.send_transaction(SendTransaction(tx.spend_bundle))
|
||||
|
||||
# advance the chain and sync both wallets
|
||||
|
@ -1137,6 +1160,7 @@ class TestWalletSync:
|
|||
txs = await farm_nft_wallet.generate_signed_transaction(
|
||||
[uint64(nft_coins[0].coin.amount)],
|
||||
[dust_ph],
|
||||
DEFAULT_TX_CONFIG,
|
||||
coins={nft_coins[0].coin},
|
||||
)
|
||||
assert len(txs) == 1
|
||||
|
@ -1273,7 +1297,9 @@ class TestWalletSync:
|
|||
|
||||
await time_out_assert(30, wallet.get_confirmed_balance, 2_000_000_000_000)
|
||||
|
||||
tx = await wallet.generate_signed_transaction(1_000_000_000_000, bytes32([0] * 32), memos=[ph])
|
||||
tx = await wallet.generate_signed_transaction(
|
||||
1_000_000_000_000, bytes32([0] * 32), DEFAULT_TX_CONFIG, memos=[ph]
|
||||
)
|
||||
await wallet_node.wallet_state_manager.add_pending_transaction(tx)
|
||||
|
||||
async def tx_in_mempool():
|
||||
|
|
Loading…
Reference in New Issue