mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-21 02:51:02 +00:00
Adds --no-validator CLI flag (#3348)
* Implement `is_validator` for offchain-workers * Introduce `--no-validator` flag * Don't run babe/grandpa/im-online when `--no-validator` is given * Fixes compilation * Bump spec version * Improve error handling in executor * Add missing extern function * Revert making error public * Remove `--no-validator` CLI
This commit is contained in:
@@ -432,6 +432,12 @@ pub mod ext {
|
||||
// Offchain-worker Context
|
||||
//================================
|
||||
|
||||
/// Returns if the local node is a potential validator.
|
||||
///
|
||||
/// - `1` == `true`
|
||||
/// - `0` == `false`
|
||||
fn ext_is_validator() -> u32;
|
||||
|
||||
/// Submit transaction.
|
||||
///
|
||||
/// # Returns
|
||||
@@ -964,6 +970,10 @@ impl CryptoApi for () {
|
||||
}
|
||||
|
||||
impl OffchainApi for () {
|
||||
fn is_validator() -> bool {
|
||||
unsafe { ext_is_validator.get()() == 1 }
|
||||
}
|
||||
|
||||
fn submit_transaction<T: codec::Encode>(data: &T) -> Result<(), ()> {
|
||||
let encoded_data = codec::Encode::encode(data);
|
||||
let ret = unsafe {
|
||||
|
||||
Reference in New Issue
Block a user