mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 02:51:08 +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
@@ -516,8 +516,10 @@ impl<'a> HeadersIterator<'a> {
|
||||
mod tests {
|
||||
use super::*;
|
||||
use runtime_io::TestExternalities;
|
||||
use substrate_offchain::testing;
|
||||
use primitives::offchain::OffchainExt;
|
||||
use primitives::offchain::{
|
||||
OffchainExt,
|
||||
testing,
|
||||
};
|
||||
|
||||
#[test]
|
||||
fn should_send_a_basic_request_and_get_response() {
|
||||
|
||||
@@ -14,6 +14,29 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
//! A collection of higher lever helpers for offchain workers.
|
||||
//! A collection of higher lever helpers for offchain calls.
|
||||
|
||||
use crate::{
|
||||
traits,
|
||||
generic::BlockId,
|
||||
};
|
||||
|
||||
pub mod http;
|
||||
|
||||
/// An abstraction for transaction pool.
|
||||
///
|
||||
/// This trait is used by offchain calls to be able to submit transactions.
|
||||
/// The main use case is for offchain workers, to feed back the results of computations,
|
||||
/// but since the transaction pool access is a separate `ExternalitiesExtension` it can
|
||||
/// be also used in context of other offchain calls. For one may generate and submit
|
||||
/// a transaction for some misbehavior reports (say equivocation).
|
||||
pub trait TransactionPool<Block: traits::Block>: Send + Sync {
|
||||
/// Submit transaction.
|
||||
///
|
||||
/// The transaction will end up in the pool and be propagated to others.
|
||||
fn submit_at(
|
||||
&self,
|
||||
at: &BlockId<Block>,
|
||||
extrinsic: Block::Extrinsic,
|
||||
) -> Result<(), ()>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user