diff --git a/electron-react/src/pages/ColouredWallet.js b/electron-react/src/pages/ColouredWallet.js index ad813390..a90d6d87 100644 --- a/electron-react/src/pages/ColouredWallet.js +++ b/electron-react/src/pages/ColouredWallet.js @@ -23,8 +23,8 @@ import { } from "../modules/message"; import { mojo_to_chia_string, - chia_to_mojo, - mojo_to_colouredcoin_string + mojo_to_colouredcoin_string, + colouredcoin_to_mojo } from "../util/chia"; import { unix_to_short_date } from "../util/utils"; import Accordion from "../components/Accordion"; @@ -468,8 +468,8 @@ const SendCard = props => { return; } - const amount = chia_to_mojo(amount_input.value); - const fee = chia_to_mojo(fee_input.value); + const amount = colouredcoin_to_mojo(amount_input.value); + const fee = colouredcoin_to_mojo(fee_input.value); if ( puzzle_hash.includes("chia_addr") || diff --git a/electron-react/src/pages/trading/CreateOffer.js b/electron-react/src/pages/trading/CreateOffer.js index b1b0f30f..425c71ed 100644 --- a/electron-react/src/pages/trading/CreateOffer.js +++ b/electron-react/src/pages/trading/CreateOffer.js @@ -19,7 +19,11 @@ import { addTrade, resetTrades } from "../../modules/TradeReducer"; -import { chia_to_mojo, mojo_to_chia_string } from "../../util/chia"; +import { + chia_to_mojo, + mojo_to_chia_string, + colouredcoin_to_mojo +} from "../../util/chia"; import { openDialog } from "../../modules/dialogReducer"; import isElectron from "is-electron"; import { create_trade_action } from "../../modules/trade_messages"; @@ -204,7 +208,10 @@ export const CreateOffer = () => { dispatch(openDialog("", "Please select buy or sell ")); return; } - const mojo = chia_to_mojo(amount_input.value); + let mojo = chia_to_mojo(amount_input.value); + if (wallets[wallet_id.value].type == "COLOURED_COIN") { + mojo = colouredcoin_to_mojo(amount_input.value); + } var trade = null; if (buy_or_sell.value === 1) { trade = newBuy(mojo, wallet_id.value); diff --git a/src/rpc/full_node_rpc_api.py b/src/rpc/full_node_rpc_api.py index 25304f80..04bfbfa3 100644 --- a/src/rpc/full_node_rpc_api.py +++ b/src/rpc/full_node_rpc_api.py @@ -328,8 +328,14 @@ class FullNodeRpcApi: weight_div_iters = delta_weight / delta_iters tips_adjustment_constant = 0.65 network_space_constant = 2 ** 32 # 2^32 + eligible_plots_filter_mult = ( + 2 ** self.service.constants["NUMBER_ZERO_BITS_CHALLENGE_SIG"] + ) network_space_bytes_estimate = ( - weight_div_iters * network_space_constant * tips_adjustment_constant + weight_div_iters + * network_space_constant + * tips_adjustment_constant + * eligible_plots_filter_mult ) return {"success": True, "space": uint128(int(network_space_bytes_estimate))} diff --git a/src/rpc/wallet_rpc_api.py b/src/rpc/wallet_rpc_api.py index 5089bcc0..30d25145 100644 --- a/src/rpc/wallet_rpc_api.py +++ b/src/rpc/wallet_rpc_api.py @@ -388,6 +388,14 @@ class WalletRpcApi: "reason": "Failed to generate signed transaction", } return data + try: + await wallet.wallet_state_manager.add_pending_transaction(tx) + except Exception as e: + data = { + "status": "FAILED", + "reason": f"Failed to push transaction {e}", + } + return data sent = False start = time.time() diff --git a/src/wallet/cc_wallet/cc_wallet.py b/src/wallet/cc_wallet/cc_wallet.py index e47ed6e1..11e76d37 100644 --- a/src/wallet/cc_wallet/cc_wallet.py +++ b/src/wallet/cc_wallet/cc_wallet.py @@ -505,22 +505,7 @@ class CCWallet: for record in coins: amount += record.coin.amount - unconfirmed_removals: Dict[ - bytes32, Coin - ] = await self.wallet_state_manager.unconfirmed_removals_for_wallet( - self.wallet_info.id - ) - removal_amount = 0 - for name, coin in unconfirmed_removals.items(): - if await self.wallet_state_manager.does_coin_belong_to_wallet( - coin, self.wallet_info.id - ): - # Ignores eve coin - if coin.parent_coin_info.hex() != await self.get_colour(): - removal_amount += coin.amount - result = amount - removal_amount - - return uint64(result) + return uint64(amount) async def get_pending_change_balance(self) -> uint64: unconfirmed_tx = await self.wallet_state_manager.tx_store.get_unconfirmed_for_wallet( diff --git a/src/wallet/wallet_state_manager.py b/src/wallet/wallet_state_manager.py index aff80bb9..fdfa4021 100644 --- a/src/wallet/wallet_state_manager.py +++ b/src/wallet/wallet_state_manager.py @@ -1416,7 +1416,6 @@ class WalletStateManager: ) -> List[Tuple[str, MempoolInclusionStatus, Optional[str]]]: tr: Optional[TransactionRecord] = await self.get_transaction(tx_id) ret_list = [] - self.log.warning(f"TR: {tr}") if tr is not None: for (name, ss, err) in tr.sent_to: ret_list.append((name, MempoolInclusionStatus(ss), err))