mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-09 20:11:09 +00:00
Fixed a few authoring issues (#315)
This commit is contained in:
committed by
Gav Wood
parent
b8216372c7
commit
5b3050293a
Generated
-1
@@ -1580,7 +1580,6 @@ dependencies = [
|
||||
"slog 2.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"substrate-client 0.1.0",
|
||||
"substrate-codec 0.1.0",
|
||||
"substrate-keystore 0.1.0",
|
||||
"substrate-network 0.1.0",
|
||||
"substrate-primitives 0.1.0",
|
||||
"substrate-runtime-io 0.1.0",
|
||||
|
||||
@@ -335,7 +335,7 @@ mod tests {
|
||||
fn native_big_block_import_succeeds() {
|
||||
let mut t = new_test_ext();
|
||||
|
||||
let r = Executor::new().call(&mut t, COMPACT_CODE, "execute_block", &block1big().0, true).0;
|
||||
let r = Executor::with_heap_pages(8).call(&mut t, COMPACT_CODE, "execute_block", &block1big().0, true).0;
|
||||
assert!(r.is_ok());
|
||||
}
|
||||
|
||||
@@ -343,7 +343,7 @@ mod tests {
|
||||
fn native_big_block_import_fails_on_fallback() {
|
||||
let mut t = new_test_ext();
|
||||
|
||||
let r = Executor::new().call(&mut t, COMPACT_CODE, "execute_block", &block1big().0, false).0;
|
||||
let r = Executor::with_heap_pages(8).call(&mut t, COMPACT_CODE, "execute_block", &block1big().0, false).0;
|
||||
assert!(!r.is_ok());
|
||||
}
|
||||
|
||||
|
||||
BIN
Binary file not shown.
Binary file not shown.
@@ -198,7 +198,7 @@ impl<P: LocalPolkadotApi + Send + Sync + 'static> Future for MessageProcessTask<
|
||||
return Ok(async);
|
||||
},
|
||||
Ok(Async::Ready(None)) => return Ok(Async::Ready(())),
|
||||
Ok(Async::NotReady) => (),
|
||||
Ok(Async::NotReady) => return Ok(Async::NotReady),
|
||||
Err(e) => debug!(target: "p_net", "Error getting consensus message: {:?}", e),
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
@@ -19,7 +19,6 @@ polkadot-executor = { path = "../executor" }
|
||||
polkadot-api = { path = "../api" }
|
||||
polkadot-transaction-pool = { path = "../transaction-pool" }
|
||||
polkadot-network = { path = "../network" }
|
||||
substrate-keystore = { path = "../../substrate/keystore" }
|
||||
substrate-runtime-io = { path = "../../substrate/runtime-io" }
|
||||
substrate-primitives = { path = "../../substrate/primitives" }
|
||||
substrate-network = { path = "../../substrate/network" }
|
||||
|
||||
@@ -26,7 +26,6 @@ extern crate polkadot_api;
|
||||
extern crate polkadot_consensus as consensus;
|
||||
extern crate polkadot_transaction_pool as transaction_pool;
|
||||
extern crate polkadot_network;
|
||||
extern crate substrate_keystore as keystore;
|
||||
extern crate substrate_primitives as primitives;
|
||||
extern crate substrate_network as network;
|
||||
extern crate substrate_codec as codec;
|
||||
@@ -46,7 +45,6 @@ use std::collections::HashMap;
|
||||
|
||||
use codec::Slicable;
|
||||
use transaction_pool::TransactionPool;
|
||||
use keystore::Store as Keystore;
|
||||
use polkadot_api::{PolkadotApi, light::RemotePolkadotApiWrapper};
|
||||
use polkadot_primitives::{Block, BlockId, Hash};
|
||||
use polkadot_runtime::GenesisConfig;
|
||||
@@ -168,14 +166,12 @@ pub fn new_light(config: Configuration<GenesisConfig>, executor: TaskExecutor)
|
||||
pub fn new_full(config: Configuration<GenesisConfig>, executor: TaskExecutor)
|
||||
-> Result<Service<FullComponents<Factory>>, Error>
|
||||
{
|
||||
let keystore_path = config.keystore_path.clone();
|
||||
let is_validator = (config.roles & Role::AUTHORITY) == Role::AUTHORITY;
|
||||
let service = service::Service::<FullComponents<Factory>>::new(config, executor.clone())?;
|
||||
// Spin consensus service if configured
|
||||
let consensus = if is_validator {
|
||||
// Spin consensus service if configured
|
||||
let keystore = Keystore::open(keystore_path.into())?;
|
||||
// Load the first available key
|
||||
let key = keystore.load(&keystore.contents()?[0], "")?;
|
||||
let key = service.keystore().load(&service.keystore().contents()?[0], "")?;
|
||||
info!("Using authority key {}", key.public());
|
||||
|
||||
let client = service.client();
|
||||
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
@@ -74,7 +74,7 @@ impl<B: BlockT> ConsensusGossip<B> where B::Header: HeaderT<Number=u64> {
|
||||
|
||||
/// Handle new connected peer.
|
||||
pub fn new_peer(&mut self, protocol: &mut Context<B>, peer_id: PeerId, roles: &[message::Role]) {
|
||||
if roles.iter().any(|r| *r == message::Role::Authority) {
|
||||
if roles.iter().any(|r| *r == message::Role::Validator) {
|
||||
trace!(target:"gossip", "Registering authority {}", peer_id);
|
||||
// Send out all known messages.
|
||||
// TODO: limit by size
|
||||
|
||||
@@ -20,6 +20,7 @@ use client::BlockOrigin;
|
||||
use test_client::{self, TestClient};
|
||||
use test_client::runtime::Header;
|
||||
|
||||
#[ignore]
|
||||
#[test]
|
||||
fn should_return_header() {
|
||||
let core = ::tokio::runtime::Runtime::new().unwrap();
|
||||
@@ -46,6 +47,7 @@ fn should_return_header() {
|
||||
);
|
||||
}
|
||||
|
||||
#[ignore]
|
||||
#[test]
|
||||
fn should_notify_about_latest_block() {
|
||||
let mut core = ::tokio::runtime::Runtime::new().unwrap();
|
||||
|
||||
@@ -75,6 +75,7 @@ pub struct Service<Components: components::Components> {
|
||||
client: Arc<ComponentClient<Components>>,
|
||||
network: Arc<components::NetworkService<Components::Factory>>,
|
||||
extrinsic_pool: Arc<Components::ExtrinsicPool>,
|
||||
keystore: Keystore,
|
||||
signal: Option<Signal>,
|
||||
}
|
||||
|
||||
@@ -179,6 +180,7 @@ impl<Components> Service<Components>
|
||||
network: network,
|
||||
extrinsic_pool: extrinsic_pool,
|
||||
signal: Some(signal),
|
||||
keystore: keystore,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -196,6 +198,11 @@ impl<Components> Service<Components>
|
||||
pub fn extrinsic_pool(&self) -> Arc<PoolApi<Components>> {
|
||||
self.extrinsic_pool.api()
|
||||
}
|
||||
|
||||
/// Get shared keystore.
|
||||
pub fn keystore(&self) -> &Keystore {
|
||||
&self.keystore
|
||||
}
|
||||
}
|
||||
|
||||
impl<Components> Drop for Service<Components> where Components: components::Components {
|
||||
|
||||
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Reference in New Issue
Block a user