Skip to content

Commit

Permalink
add warn
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelsutton committed Sep 16, 2024
1 parent 2438a72 commit 8e827b6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion mining/errors/src/mempool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ pub enum RuleError {
#[error("Rejected tx {0} from mempool due to incomputable storage mass")]
RejectStorageMassIncomputable(TransactionId),

#[error("Rejected RBF tx {0} from the mempool for having an unreasonably high fee of {1} sompi, indicating a possible user error. Use fee <= 50 KAS, or increase over previous feerate by 2x at most.")]
#[error("(PNN only) Rejected RBF tx {0} from the mempool for having an unreasonably high fee of {1} sompi, indicating a possible user error. Use fee <= 50 KAS, or increase over previous feerate by 2x at most.")]
RejectRbfUserError(TransactionId, u64),
}

Expand Down
5 changes: 4 additions & 1 deletion mining/src/mempool/replace_by_fee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use kaspa_consensus_core::{
constants::SOMPI_PER_KASPA,
tx::{MutableTransaction, Transaction},
};
use kaspa_core::warn;
use std::sync::Arc;

impl Mempool {
Expand Down Expand Up @@ -165,7 +166,9 @@ impl Mempool {
{
if transaction_feerate > double_spend_feerate {
if transaction.calculated_fee.unwrap() > SOMPI_PER_KASPA * 50 && transaction_feerate > double_spend_feerate * 2.0 {
return Err(RuleError::RejectRbfUserError(transaction.id(), transaction.calculated_fee.unwrap()));
let err = RuleError::RejectRbfUserError(transaction.id(), transaction.calculated_fee.unwrap());
warn!("Mempool RBF high fee guard: {err} ({}, {})", transaction_feerate, double_spend_feerate);
return Err(err);
}
return Ok(owner);
} else {
Expand Down

0 comments on commit 8e827b6

Please sign in to comment.