TestRpcServer

Trait TestRpcServer 

Source
pub trait TestRpcServer:
    Sized
    + Send
    + Sync
    + 'static {
Show 38 methods // Required methods fn say_hello(&self) -> RpcResult<String>; fn get_block_count(&self) -> RpcResult<u64>; fn get_goodput(&self) -> RpcResult<String>; fn generate_empty_blocks(&self, num_blocks: usize) -> RpcResult<Vec<H256>>; fn generate_fixed_block( &self, parent_hash: H256, referee: Vec<H256>, num_txs: usize, adaptive: bool, difficulty: Option<u64>, pos_reference: Option<H256>, ) -> RpcResult<H256>; fn add_peer(&self, id: NodeId, addr: SocketAddr) -> RpcResult<()>; fn drop_peer(&self, id: NodeId, addr: SocketAddr) -> RpcResult<()>; fn get_peer_info(&self) -> RpcResult<Vec<PeerInfo>>; fn chain(&self) -> RpcResult<Vec<Block>>; fn stop(&self) -> RpcResult<()>; fn get_nodeid(&self, challenge: Vec<u8>) -> RpcResult<Vec<u8>>; fn add_latency(&self, id: NodeId, latency_ms: f64) -> RpcResult<()>; fn generate_one_block( &self, num_txs: usize, block_size_limit: usize, ) -> RpcResult<H256>; fn generate_one_block_with_direct_txgen( &self, num_txs: usize, block_size_limit: usize, num_txs_simple: usize, num_txs_erc20: usize, ) -> RpcResult<H256>; fn generate_custom_block( &self, parent: H256, referees: Vec<H256>, raw: Bytes, adaptive: Option<bool>, custom: Option<Vec<Bytes>>, ) -> RpcResult<H256>; fn generate_block_with_fake_txs( &self, raw: Bytes, adaptive: Option<bool>, tx_data_len: Option<usize>, ) -> RpcResult<H256>; fn generate_block_with_blame_info( &self, num_txs: usize, block_size_limit: usize, blame_info: BlameInfo, ) -> RpcResult<H256>; fn generate_block_with_nonce_and_timestamp( &self, parent: H256, referees: Vec<H256>, raw: Bytes, nonce: U256, timestamp: u64, adaptive: bool, ) -> RpcResult<H256>; fn get_block_status(&self, block_hash: H256) -> RpcResult<(u8, bool)>; fn expire_block_gc(&self, timeout: u64) -> RpcResult<()>; fn get_pivot_chain_and_weight( &self, height_range: Option<(u64, u64)>, ) -> RpcResult<Vec<(H256, U256)>>; fn get_executed_info(&self, block_hash: H256) -> RpcResult<(H256, H256)>; fn send_usable_genesis_accounts( &self, account_start_index: usize, ) -> RpcResult<Bytes>; fn set_db_crash( &self, crash_probability: f64, crash_exit_code: i32, ) -> RpcResult<()>; fn save_node_db(&self) -> RpcResult<()>; fn pos_register( &self, voting_power: U64, version: Option<u8>, ) -> RpcResult<(Bytes, AccountAddress)>; fn pos_update_voting_power( &self, pos_account: AccountAddress, increased_voting_power: U64, ) -> RpcResult<()>; fn pos_stop_election(&self) -> RpcResult<Option<u64>>; fn pos_start_voting(&self, initialize: bool) -> RpcResult<()>; fn pos_stop_voting(&self) -> RpcResult<()>; fn pos_voting_status(&self) -> RpcResult<bool>; fn pos_start(&self) -> RpcResult<()>; fn pos_force_vote_proposal(&self, block_id: H256) -> RpcResult<()>; fn pos_force_propose( &self, round: U64, parent_block_id: H256, payload: Vec<TransactionPayload>, ) -> RpcResult<()>; fn pos_trigger_timeout(&self, timeout_type: String) -> RpcResult<()>; fn pos_force_sign_pivot_decision( &self, block_hash: H256, height: U64, ) -> RpcResult<()>; fn pos_get_chosen_proposal(&self) -> RpcResult<Option<PosBlock>>; // Provided method fn into_rpc(self) -> RpcModule<Self> { ... }
}
Expand description

Server trait implementation for the TestRpc RPC API.

Required Methods§

Source

fn say_hello(&self) -> RpcResult<String>

Source

fn get_block_count(&self) -> RpcResult<u64>

Source

fn get_goodput(&self) -> RpcResult<String>

Source

fn generate_empty_blocks(&self, num_blocks: usize) -> RpcResult<Vec<H256>>

Source

fn generate_fixed_block( &self, parent_hash: H256, referee: Vec<H256>, num_txs: usize, adaptive: bool, difficulty: Option<u64>, pos_reference: Option<H256>, ) -> RpcResult<H256>

Source

fn add_peer(&self, id: NodeId, addr: SocketAddr) -> RpcResult<()>

Source

fn drop_peer(&self, id: NodeId, addr: SocketAddr) -> RpcResult<()>

Source

fn get_peer_info(&self) -> RpcResult<Vec<PeerInfo>>

Source

fn chain(&self) -> RpcResult<Vec<Block>>

Returns the JSON of whole chain

Source

fn stop(&self) -> RpcResult<()>

Source

fn get_nodeid(&self, challenge: Vec<u8>) -> RpcResult<Vec<u8>>

Source

fn add_latency(&self, id: NodeId, latency_ms: f64) -> RpcResult<()>

Source

fn generate_one_block( &self, num_txs: usize, block_size_limit: usize, ) -> RpcResult<H256>

Source

fn generate_one_block_with_direct_txgen( &self, num_txs: usize, block_size_limit: usize, num_txs_simple: usize, num_txs_erc20: usize, ) -> RpcResult<H256>

Source

fn generate_custom_block( &self, parent: H256, referees: Vec<H256>, raw: Bytes, adaptive: Option<bool>, custom: Option<Vec<Bytes>>, ) -> RpcResult<H256>

Source

fn generate_block_with_fake_txs( &self, raw: Bytes, adaptive: Option<bool>, tx_data_len: Option<usize>, ) -> RpcResult<H256>

Source

fn generate_block_with_blame_info( &self, num_txs: usize, block_size_limit: usize, blame_info: BlameInfo, ) -> RpcResult<H256>

Source

fn generate_block_with_nonce_and_timestamp( &self, parent: H256, referees: Vec<H256>, raw: Bytes, nonce: U256, timestamp: u64, adaptive: bool, ) -> RpcResult<H256>

Source

fn get_block_status(&self, block_hash: H256) -> RpcResult<(u8, bool)>

Source

fn expire_block_gc(&self, timeout: u64) -> RpcResult<()>

Source

fn get_pivot_chain_and_weight( &self, height_range: Option<(u64, u64)>, ) -> RpcResult<Vec<(H256, U256)>>

Source

fn get_executed_info(&self, block_hash: H256) -> RpcResult<(H256, H256)>

Source

fn send_usable_genesis_accounts( &self, account_start_index: usize, ) -> RpcResult<Bytes>

Source

fn set_db_crash( &self, crash_probability: f64, crash_exit_code: i32, ) -> RpcResult<()>

Source

fn save_node_db(&self) -> RpcResult<()>

Source

fn pos_register( &self, voting_power: U64, version: Option<u8>, ) -> RpcResult<(Bytes, AccountAddress)>

Source

fn pos_update_voting_power( &self, pos_account: AccountAddress, increased_voting_power: U64, ) -> RpcResult<()>

Source

fn pos_stop_election(&self) -> RpcResult<Option<u64>>

Source

fn pos_start_voting(&self, initialize: bool) -> RpcResult<()>

Source

fn pos_stop_voting(&self) -> RpcResult<()>

Source

fn pos_voting_status(&self) -> RpcResult<bool>

Source

fn pos_start(&self) -> RpcResult<()>

Source

fn pos_force_vote_proposal(&self, block_id: H256) -> RpcResult<()>

Source

fn pos_force_propose( &self, round: U64, parent_block_id: H256, payload: Vec<TransactionPayload>, ) -> RpcResult<()>

Source

fn pos_trigger_timeout(&self, timeout_type: String) -> RpcResult<()>

Source

fn pos_force_sign_pivot_decision( &self, block_hash: H256, height: U64, ) -> RpcResult<()>

Source

fn pos_get_chosen_proposal(&self) -> RpcResult<Option<PosBlock>>

Provided Methods§

Source

fn into_rpc(self) -> RpcModule<Self>

Collects all the methods and subscriptions defined in the trait and adds them into a single RpcModule.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§