mirror of
https://github.com/Cuprate/cuprate.git
synced 2025-01-25 03:55:52 +00:00
handle miner txs when calculating fee
This commit is contained in:
parent
6337441711
commit
e0fc620363
1 changed files with 5 additions and 2 deletions
|
@ -122,10 +122,13 @@ pub fn tx_fee(tx: &Transaction) -> u64 {
|
||||||
match &tx {
|
match &tx {
|
||||||
Transaction::V1 { prefix, .. } => {
|
Transaction::V1 { prefix, .. } => {
|
||||||
for input in &prefix.inputs {
|
for input in &prefix.inputs {
|
||||||
if let Input::ToKey { amount, .. } = input {
|
match input {
|
||||||
|
Input::Gen(_) => return 0,
|
||||||
|
Input::ToKey { amount, .. } => {
|
||||||
fee = fee.checked_add(amount.unwrap_or(0)).unwrap();
|
fee = fee.checked_add(amount.unwrap_or(0)).unwrap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for output in &prefix.outputs {
|
for output in &prefix.outputs {
|
||||||
fee.checked_sub(output.amount.unwrap_or(0)).unwrap();
|
fee.checked_sub(output.amount.unwrap_or(0)).unwrap();
|
||||||
|
|
Loading…
Reference in a new issue