consensus: misc fixes (#276)
Some checks failed
CI / fmt (push) Has been cancelled
CI / typo (push) Has been cancelled
CI / ci (macos-latest, stable, bash) (push) Has been cancelled
CI / ci (ubuntu-latest, stable, bash) (push) Has been cancelled
CI / ci (windows-latest, stable-x86_64-pc-windows-gnu, msys2 {0}) (push) Has been cancelled
Doc / build (push) Has been cancelled
Doc / deploy (push) Has been cancelled

* fix decoy checks + fee calculation

* fmt
This commit is contained in:
Boog900 2024-09-10 01:18:26 +01:00 committed by GitHub
parent 49d1344aa1
commit 90027143f0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 1 deletions

View file

@ -393,6 +393,11 @@ async fn verify_transactions_decoy_info<D>(
where
D: Database + Clone + Sync + Send + 'static,
{
// Decoy info is not validated for V1 txs.
if hf == HardFork::V1 || txs.is_empty() {
return Ok(());
}
batch_get_decoy_info(&txs, hf, database)
.await?
.try_for_each(|decoy_info| decoy_info.and_then(|di| Ok(check_decoy_info(&di, &hf)?)))?;

View file

@ -78,7 +78,8 @@ pub fn tx_fee(tx: &Transaction) -> Result<u64, TransactionError> {
}
for output in &prefix.outputs {
fee.checked_sub(output.amount.unwrap_or(0))
fee = fee
.checked_sub(output.amount.unwrap_or(0))
.ok_or(TransactionError::OutputsTooHigh)?;
}
}