Sunce86/fix tx pool locals for 1559 (#431)
* fixed handling of local txs after 1559 activation
This commit is contained in:
parent
b928380b64
commit
5dec58ba9f
@ -131,8 +131,12 @@ where
|
|||||||
super::Priority::Retracted => 10,
|
super::Priority::Retracted => 10,
|
||||||
super::Priority::Regular => 0,
|
super::Priority::Regular => 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//boost local and retracted only if they are currently includable (base fee criteria)
|
||||||
|
if self.block_base_fee.is_none() || scores[i] >= self.block_base_fee.unwrap() {
|
||||||
scores[i] = scores[i] << boost;
|
scores[i] = scores[i] << boost;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// We are only sending an event in case of penalization.
|
// We are only sending an event in case of penalization.
|
||||||
// So just lower the priority of all non-local transactions.
|
// So just lower the priority of all non-local transactions.
|
||||||
Change::Event(event) => {
|
Change::Event(event) => {
|
||||||
@ -148,6 +152,18 @@ where
|
|||||||
ScoringEvent::BlockBaseFeeChanged => {
|
ScoringEvent::BlockBaseFeeChanged => {
|
||||||
for i in 0..txs.len() {
|
for i in 0..txs.len() {
|
||||||
scores[i] = txs[i].transaction.effective_gas_price(self.block_base_fee);
|
scores[i] = txs[i].transaction.effective_gas_price(self.block_base_fee);
|
||||||
|
let boost = match txs[i].priority() {
|
||||||
|
super::Priority::Local => 15,
|
||||||
|
super::Priority::Retracted => 10,
|
||||||
|
super::Priority::Regular => 0,
|
||||||
|
};
|
||||||
|
|
||||||
|
//boost local and retracted only if they are currently includable (base fee criteria)
|
||||||
|
if self.block_base_fee.is_none()
|
||||||
|
|| scores[i] >= self.block_base_fee.unwrap()
|
||||||
|
{
|
||||||
|
scores[i] = scores[i] << boost;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1169,7 +1169,7 @@ impl miner::MinerService for Miner {
|
|||||||
ordering: miner::PendingOrdering,
|
ordering: miner::PendingOrdering,
|
||||||
) -> Vec<Arc<VerifiedTransaction>>
|
) -> Vec<Arc<VerifiedTransaction>>
|
||||||
where
|
where
|
||||||
C: ChainInfo + Nonce + Sync,
|
C: BlockChain + Nonce + Sync,
|
||||||
{
|
{
|
||||||
let chain_info = chain.chain_info();
|
let chain_info = chain.chain_info();
|
||||||
|
|
||||||
@ -1186,7 +1186,10 @@ impl miner::MinerService for Miner {
|
|||||||
nonce_cap,
|
nonce_cap,
|
||||||
max_len,
|
max_len,
|
||||||
ordering,
|
ordering,
|
||||||
includable_boundary: Default::default(),
|
includable_boundary: self
|
||||||
|
.engine
|
||||||
|
.calculate_base_fee(&chain.best_block_header())
|
||||||
|
.unwrap_or_default(),
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Some(ref f) = filter {
|
if let Some(ref f) = filter {
|
||||||
|
@ -226,7 +226,7 @@ pub trait MinerService: Send + Sync {
|
|||||||
ordering: PendingOrdering,
|
ordering: PendingOrdering,
|
||||||
) -> Vec<Arc<VerifiedTransaction>>
|
) -> Vec<Arc<VerifiedTransaction>>
|
||||||
where
|
where
|
||||||
C: ChainInfo + Nonce + Sync;
|
C: BlockChain + Nonce + Sync;
|
||||||
|
|
||||||
/// Get an unfiltered list of all ready transactions.
|
/// Get an unfiltered list of all ready transactions.
|
||||||
fn ready_transactions<C>(
|
fn ready_transactions<C>(
|
||||||
@ -236,7 +236,7 @@ pub trait MinerService: Send + Sync {
|
|||||||
ordering: PendingOrdering,
|
ordering: PendingOrdering,
|
||||||
) -> Vec<Arc<VerifiedTransaction>>
|
) -> Vec<Arc<VerifiedTransaction>>
|
||||||
where
|
where
|
||||||
C: ChainInfo + Nonce + Sync,
|
C: BlockChain + Nonce + Sync,
|
||||||
{
|
{
|
||||||
self.ready_transactions_filtered(chain, max_len, None, ordering)
|
self.ready_transactions_filtered(chain, max_len, None, ordering)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user