Ms.fix cc spend (#312)
Fix netspace calculation (mult time 256) Fix cc spend Fix cc units display in send and offer creation Fix cc spendable balance
This commit is contained in:
parent
b9ff2d57f2
commit
2282ad2345
|
@ -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") ||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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))}
|
||||
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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))
|
||||
|
|
Loading…
Reference in New Issue