// Copyright 2018 Parity Technologies (UK) Ltd.
// This file is part of Substrate.
// Substrate is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Substrate is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Substrate. If not, see .
extern crate substrate_client as client;
extern crate parity_codec as codec;
extern crate substrate_transaction_pool as transaction_pool;
extern crate substrate_primitives;
extern crate sr_primitives;
extern crate node_runtime as runtime;
extern crate node_primitives as primitives;
#[cfg(test)]
extern crate substrate_keyring;
#[macro_use]
extern crate error_chain;
#[macro_use]
extern crate log;
mod error;
use std::{
cmp::Ordering,
collections::HashMap,
sync::Arc,
};
use codec::{Decode, Encode};
use client::{Client as SubstrateClient, CallExecutor};
use transaction_pool::{Readiness, scoring::{Change, Choice}, VerifiedFor, ExtrinsicFor};
use primitives::{AccountId, Hash, Index};
use runtime::{Address, UncheckedExtrinsic};
use substrate_primitives::{Blake2Hasher};
use sr_primitives::generic::BlockId;
use sr_primitives::traits::{
Bounded, Checkable, Block as BlockT, Hash as HashT, Header as HeaderT, BlakeTwo256, Lookup, CurrentHeight,
BlockNumberToHash
};
pub use transaction_pool::{Options, Status, LightStatus, VerifiedTransaction as VerifiedTransactionOps};
pub use error::{Error, ErrorKind, Result};
/// Maximal size of a single encoded extrinsic.
const MAX_TRANSACTION_SIZE: usize = 4 * 1024 * 1024;
/// Local client abstraction for the transaction-pool.
pub trait Client:
Send
+ Sync
+ CurrentHeight::Block as BlockT>::Header as HeaderT>::Number>
+ BlockNumberToHash::Block as BlockT>::Header as HeaderT>::Number, Hash=<::Block as BlockT>::Hash> {
/// The block used for this API type.
type Block: BlockT;
/// Get the nonce (né index) of an account at a block.
fn index(&self, at: &BlockId, account: AccountId) -> Result;
/// Get the account id of an address at a block.
fn lookup(&self, at: &BlockId, address: Address) -> Result