Skip to content

Commit

Permalink
Use real withdraw value for sigrecord (#619)
Browse files Browse the repository at this point in the history
  • Loading branch information
hacpy authored Mar 15, 2022
1 parent b8e125e commit 3a9a4af
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions xpallets/gateway/bitcoin/src/tx/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,17 +251,18 @@ fn withdraw<T: Config>(tx: Transaction) -> BtcTxResult {
}
}

let btc_withdrawal_fee = Pallet::<T>::btc_withdrawal_fee();
// real withdraw value would reduce withdraw_fee
total -=
(proposal.withdrawal_id_list.len() as u64 * btc_withdrawal_fee).saturated_into();

// Record trustee signature
T::TrusteeInfoUpdate::update_trustee_sig_record(
Pallet::<T>::chain(),
input.script_witness[1].as_slice(),
tx.outputs.iter().map(|info| info.value).sum(),
total.saturated_into(),
);

let btc_withdrawal_fee = Pallet::<T>::btc_withdrawal_fee();
// real withdraw value would reduce withdraw_fee
total -=
(proposal.withdrawal_id_list.len() as u64 * btc_withdrawal_fee).saturated_into();
Pallet::<T>::deposit_event(Event::<T>::Withdrawn(
tx_hash,
proposal.withdrawal_id_list,
Expand Down

0 comments on commit 3a9a4af

Please sign in to comment.