mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-15 17:15:42 +00:00
Offchain execution extensions (#4145)
* Pass Extensions instead of individual objects. * Move TransactionPool to a separate ExternalitiesExtension. * Fix compilation.? * Clean up. * Refactor testing utilities. * Add docs, fix tests. * Fix doctest. * Fix formatting and add some logs. * Add some docs. * Remove unused files.
This commit is contained in:
committed by
Gavin Wood
parent
f000392cc0
commit
86b6ac5571
@@ -35,7 +35,10 @@ use rstd::ops::Deref;
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
use primitives::{
|
||||
crypto::Pair, traits::KeystoreExt, offchain::OffchainExt, hexdisplay::HexDisplay,
|
||||
crypto::Pair,
|
||||
traits::KeystoreExt,
|
||||
offchain::{OffchainExt, TransactionPoolExt},
|
||||
hexdisplay::HexDisplay,
|
||||
storage::ChildStorageKey,
|
||||
};
|
||||
|
||||
@@ -424,8 +427,9 @@ pub trait Offchain {
|
||||
///
|
||||
/// The transaction will end up in the pool.
|
||||
fn submit_transaction(&mut self, data: Vec<u8>) -> Result<(), ()> {
|
||||
self.extension::<OffchainExt>()
|
||||
.expect("submit_transaction can be called only in the offchain worker context")
|
||||
self.extension::<TransactionPoolExt>()
|
||||
.expect("submit_transaction can be called only in the offchain call context with
|
||||
TransactionPool capabilities enabled")
|
||||
.submit_transaction(data)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user