mirror of
https://github.com/serai-dex/serai.git
synced 2024-11-17 09:27:36 +00:00
Correct Monero's extra length calculation for fee calculation
This commit is contained in:
parent
b6ea654823
commit
9d817a00b2
1 changed files with 4 additions and 1 deletions
|
@ -220,8 +220,11 @@ impl SignableTransaction {
|
||||||
}
|
}
|
||||||
let mut outputs = payments.len() + (if change { 1 } else { 0 });
|
let mut outputs = payments.len() + (if change { 1 } else { 0 });
|
||||||
|
|
||||||
|
// Calculate the extra length.
|
||||||
|
// Type, length, value, with 1 field for the first key and 1 field for the rest
|
||||||
|
let extra = (outputs * (2 + 32)) - (outputs.saturating_sub(2) * 2);
|
||||||
|
|
||||||
// Calculate the fee.
|
// Calculate the fee.
|
||||||
let extra = 0;
|
|
||||||
let mut fee = fee_rate.calculate(Transaction::fee_weight(inputs.len(), outputs, extra));
|
let mut fee = fee_rate.calculate(Transaction::fee_weight(inputs.len(), outputs, extra));
|
||||||
|
|
||||||
// Make sure we have enough funds
|
// Make sure we have enough funds
|
||||||
|
|
Loading…
Reference in a new issue