mirror of
https://github.com/MAGICGrants/cuprate-for-explorer.git
synced 2026-01-09 19:47:59 -05:00
consensus: misc fixes (#276)
* fix decoy checks + fee calculation * fmt
This commit is contained in:
@@ -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)?)))?;
|
||||
|
||||
@@ -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)?;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user