mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 19:21:13 +00:00
Pass transaction source to validate_transaction (#5366)
* WiP * Support source in the runtime API. * Finish implementation in txpool. * Fix warning. * Fix tests. * Apply suggestions from code review Co-Authored-By: Kian Paimani <5588131+kianenigma@users.noreply.github.com> Co-Authored-By: Nikolay Volf <nikvolf@gmail.com> * Extra changes. * Fix test and benches. * fix test * Fix test & benches again. * Fix tests. * Update bumpalo * Fix doc test. * Fix doctest. * Fix doctest. Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> Co-authored-by: Nikolay Volf <nikvolf@gmail.com>
This commit is contained in:
@@ -78,7 +78,7 @@ async fn batch_revalidate<Api: ChainApi>(
|
||||
None => continue,
|
||||
};
|
||||
|
||||
match api.validate_transaction(&BlockId::Number(at), ext.data.clone()).await {
|
||||
match api.validate_transaction(&BlockId::Number(at), ext.source, ext.data.clone()).await {
|
||||
Ok(Err(TransactionValidityError::Invalid(err))) => {
|
||||
log::debug!(target: "txpool", "[{:?}]: Revalidation: invalid {:?}", ext_hash, err);
|
||||
invalid_hashes.push(ext_hash);
|
||||
@@ -94,6 +94,7 @@ async fn batch_revalidate<Api: ChainApi>(
|
||||
ValidatedTransaction::valid_at(
|
||||
at.saturated_into::<u64>(),
|
||||
ext_hash,
|
||||
ext.source,
|
||||
ext.data.clone(),
|
||||
api.hash_and_length(&ext.data).1,
|
||||
validity,
|
||||
@@ -312,9 +313,9 @@ where
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
|
||||
use super::*;
|
||||
use sc_transaction_graph::Pool;
|
||||
use sp_transaction_pool::TransactionSource;
|
||||
use substrate_test_runtime_transaction_pool::{TestApi, uxt};
|
||||
use futures::executor::block_on;
|
||||
use substrate_test_runtime_client::{
|
||||
@@ -334,7 +335,9 @@ mod tests {
|
||||
let queue = Arc::new(RevalidationQueue::new(api.clone(), pool.clone()));
|
||||
|
||||
let uxt = uxt(Alice, 0);
|
||||
let uxt_hash = block_on(pool.submit_one(&BlockId::number(0), uxt.clone())).expect("Should be valid");
|
||||
let uxt_hash = block_on(
|
||||
pool.submit_one(&BlockId::number(0), TransactionSource::External, uxt.clone())
|
||||
).expect("Should be valid");
|
||||
|
||||
block_on(queue.revalidate_later(0, vec![uxt_hash]));
|
||||
|
||||
@@ -343,4 +346,4 @@ mod tests {
|
||||
// number of ready
|
||||
assert_eq!(pool.validated_pool().status().ready, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user