mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 04:41:03 +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:
@@ -224,7 +224,7 @@ mod tests {
|
||||
txpool::Options,
|
||||
};
|
||||
use substrate_test_runtime_transaction_pool::{TestApi, uxt};
|
||||
use sp_transaction_pool::{TransactionPool, MaintainedTransactionPool};
|
||||
use sp_transaction_pool::{TransactionPool, MaintainedTransactionPool, TransactionSource};
|
||||
use sp_runtime::generic::BlockId;
|
||||
use sp_blockchain::HeaderBackend;
|
||||
use sp_consensus::ImportedAux;
|
||||
@@ -236,6 +236,8 @@ mod tests {
|
||||
Arc::new(TestApi::empty())
|
||||
}
|
||||
|
||||
const SOURCE: TransactionSource = TransactionSource::External;
|
||||
|
||||
#[tokio::test]
|
||||
async fn instant_seal() {
|
||||
let builder = TestClientBuilder::new();
|
||||
@@ -278,7 +280,7 @@ mod tests {
|
||||
rt.block_on(future);
|
||||
});
|
||||
// submit a transaction to pool.
|
||||
let result = pool.submit_one(&BlockId::Number(0), uxt(Alice, 0)).await;
|
||||
let result = pool.submit_one(&BlockId::Number(0), SOURCE, uxt(Alice, 0)).await;
|
||||
// assert that it was successfully imported
|
||||
assert!(result.is_ok());
|
||||
// assert that the background task returns ok
|
||||
@@ -330,7 +332,7 @@ mod tests {
|
||||
rt.block_on(future);
|
||||
});
|
||||
// submit a transaction to pool.
|
||||
let result = pool.submit_one(&BlockId::Number(0), uxt(Alice, 0)).await;
|
||||
let result = pool.submit_one(&BlockId::Number(0), SOURCE, uxt(Alice, 0)).await;
|
||||
// assert that it was successfully imported
|
||||
assert!(result.is_ok());
|
||||
let (tx, rx) = futures::channel::oneshot::channel();
|
||||
@@ -399,7 +401,7 @@ mod tests {
|
||||
rt.block_on(future);
|
||||
});
|
||||
// submit a transaction to pool.
|
||||
let result = pool.submit_one(&BlockId::Number(0), uxt(Alice, 0)).await;
|
||||
let result = pool.submit_one(&BlockId::Number(0), SOURCE, uxt(Alice, 0)).await;
|
||||
// assert that it was successfully imported
|
||||
assert!(result.is_ok());
|
||||
|
||||
@@ -430,7 +432,7 @@ mod tests {
|
||||
);
|
||||
// assert that there's a new block in the db.
|
||||
assert!(backend.blockchain().header(BlockId::Number(0)).unwrap().is_some());
|
||||
assert!(pool.submit_one(&BlockId::Number(1), uxt(Alice, 1)).await.is_ok());
|
||||
assert!(pool.submit_one(&BlockId::Number(1), SOURCE, uxt(Alice, 1)).await.is_ok());
|
||||
|
||||
pool.maintain(sp_transaction_pool::ChainEvent::NewBlock {
|
||||
id: BlockId::Number(1),
|
||||
@@ -453,7 +455,7 @@ mod tests {
|
||||
assert!(backend.blockchain().header(BlockId::Number(1)).unwrap().is_some());
|
||||
pool_api.increment_nonce(Alice.into());
|
||||
|
||||
assert!(pool.submit_one(&BlockId::Number(2), uxt(Alice, 2)).await.is_ok());
|
||||
assert!(pool.submit_one(&BlockId::Number(2), SOURCE, uxt(Alice, 2)).await.is_ok());
|
||||
let (tx2, rx2) = futures::channel::oneshot::channel();
|
||||
assert!(sink.send(EngineCommand::SealNewBlock {
|
||||
parent_hash: Some(created_block.hash),
|
||||
|
||||
Reference in New Issue
Block a user