Skip to content

Commit

Permalink
TEMPORARY: lazy doubling of fee subtraction
Browse files Browse the repository at this point in the history
Feels haunted. Adds logging.
  • Loading branch information
conorsch committed Aug 29, 2024
1 parent 8a219f0 commit ff6783c
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion crates/bin/pcli/src/command/migrate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,15 @@ impl MigrateCmd {
if value.asset_id == fee.0.asset_id {
note_values_2.push(penumbra_asset::Value {
asset_id: value.asset_id,
amount: value.amount - fee.0.amount,
// HACK: we are doubling the subtraction of the estimated fee,
// as a temporary workaround for the fee estimation being inaccurate,
// oddly by about 1.9x.
amount: value
.amount
.checked_sub(&fee.0.amount)
.expect("estimated fee is higher than remaining balance 1/2")
.checked_sub(&fee.0.amount)
.expect("estimated fee is higher than remaining balance 2/2"),
});
} else {
note_values_2.push(penumbra_asset::Value {
Expand All @@ -128,6 +136,15 @@ impl MigrateCmd {
// and spending fees from that account
let address_index = AddressIndex::new(0);

let fee2 = planner_2.compute_fee_estimate(
&gas_prices,
&FeeTier::default(),
&source_address,
);
println!(
"Estimated fee 2/2 for sending total balance: {:?}",
fee2.0.format(&asset_cache)
);
let plan = planner_2
.memo(memo)
.plan(
Expand Down

0 comments on commit ff6783c

Please sign in to comment.