pub fn generate_blocks_at<F>(&self, at: BlockId<Block>, count: usize, origin: BlockOrigin, mut edit_block: F) -> H256
		where F: FnMut(BlockBuilder<Block, PeersClient>) -> Block
	{
		let mut at = self.client.header(&at).unwrap().unwrap().hash();
		for _  in 0..count {
			let builder = self.client.new_block_at(&BlockId::Hash(at)).unwrap();
			let block = edit_block(builder);
			let hash = block.header.hash();
			trace!(
				"Generating {}, (#{}, parent={})",
				hash,
				block.header.number,
				block.header.parent_hash
			);
			let header = block.header.clone();
			at = hash;
			self.import_queue.import_blocks(
				origin,
				vec![IncomingBlock {
					origin: None,
					hash,
					header: Some(header),
					body: Some(block.extrinsics),
					justification: None,
				}],
			);

			// make sure block import has completed
			self.import_queue_sync();
		}

		at
	}
/// Add blocks to the peer -- edit the block before adding. The chain will
/// start at the given block iD.
Add blocks to the peer -- edit the block before adding. The chain will
start at the given block iD.
Add blocks to the peer -- edit the block before adding . The chain will start at the given block iD .
pub fn generate_blocks_at<F>(&self, at: BlockId<Block>, count: usize, origin: BlockOrigin, mut edit_block: F) -> H256
		where F: FnMut(BlockBuilder<Block, PeersClient>) -> Block
	{
		let mut at = self.client.header(&at).unwrap().unwrap().hash();
		for _  in 0..count {
			let builder = self.client.new_block_at(&BlockId::Hash(at)).unwrap();
			let block = edit_block(builder);
			let hash = block.header.hash();
			trace!(
				"Generating {}, (#{}, parent={})",
				hash,
				block.header.number,
				block.header.parent_hash
			);
			let header = block.header.clone();
			at = hash;
			self.import_queue.import_blocks(
				origin,
				vec![IncomingBlock {
					origin: None,
					hash,
					header: Some(header),
					body: Some(block.extrinsics),
					justification: None,
				}],
			);
			// make sure block import has completed
			self.import_queue_sync();
		}
		at
	}
pub fn generate_blocks_at < F > ( & self , at : BlockId < Block > , count : usize , origin : BlockOrigin , mut edit_block : F ) -> H256 where F : FnMut ( BlockBuilder < Block , PeersClient > ) -> Block { let mut at = self . client . header ( & at ) . unwrap ( ) . unwrap ( ) . hash ( ) ; for _ in 0 .. count { let builder = self . client . new_block_at ( & BlockId :: Hash ( at ) ) . unwrap ( ) ; let block = edit_block ( builder ) ; let hash = block . header . hash ( ) ; trace ! ( " " hash block header number block header parent_hash ) ; let header = block . header . clone ( ) ; at = hash ; self . import_queue . import_blocks ( origin , vec ! [ IncomingBlock { origin None hash header Some ( header ) body Some ( block extrinsics ) justification None } ] , ) ; // make sure block import has completed self . import_queue_sync ( ) ; } at }
Add blocks to the peer -- edit the block before adding.
Add blocks to the peer -- edit the block before adding .
&self
at
BlockId<Block>
count
usize
origin
BlockOrigin
edit_block
F
&self
at
BlockId<Block>
count
usize
origin
BlockOrigin
edit_block
F