pub fn add_block_with_reward(chain: &Chain, txs: Vec<&Transaction>, reward: CbData) {
	let prev = chain.head_header().unwrap();
	let next_header_info = consensus::next_difficulty(1, chain.difficulty_iter());
	let out_bin = util::from_hex(reward.output).unwrap();
	let kern_bin = util::from_hex(reward.kernel).unwrap();
	let output = ser::deserialize(&mut &out_bin[..]).unwrap();
	let kernel = ser::deserialize(&mut &kern_bin[..]).unwrap();
	let mut b = core::core::Block::new(
		&prev,
		txs.into_iter().cloned().collect(),
		next_header_info.clone().difficulty,
		(output, kernel),
	)
	.unwrap();
	b.header.timestamp = prev.timestamp + Duration::seconds(60);
	b.header.pow.secondary_scaling = next_header_info.secondary_scaling;
	chain.set_txhashset_roots(&mut b).unwrap();
	pow::pow_size(
		&mut b.header,
		next_header_info.difficulty,
		global::proofsize(),
		global::min_edge_bits(),
	)
	.unwrap();
	chain.process_block(b, chain::Options::MINE).unwrap();
	chain.validate(false).unwrap();
}
/// Adds a block with a given reward to the chain and mines it
Adds a block with a given reward to the chain and mines it
Adds a block with a given reward to the chain and mines it
pub fn add_block_with_reward(chain: &Chain, txs: Vec<&Transaction>, reward: CbData) {
	let prev = chain.head_header().unwrap();
	let next_header_info = consensus::next_difficulty(1, chain.difficulty_iter());
	let out_bin = util::from_hex(reward.output).unwrap();
	let kern_bin = util::from_hex(reward.kernel).unwrap();
	let output = ser::deserialize(&mut &out_bin[..]).unwrap();
	let kernel = ser::deserialize(&mut &kern_bin[..]).unwrap();
	let mut b = core::core::Block::new(
		&prev,
		txs.into_iter().cloned().collect(),
		next_header_info.clone().difficulty,
		(output, kernel),
	)
	.unwrap();
	b.header.timestamp = prev.timestamp + Duration::seconds(60);
	b.header.pow.secondary_scaling = next_header_info.secondary_scaling;
	chain.set_txhashset_roots(&mut b).unwrap();
	pow::pow_size(
		&mut b.header,
		next_header_info.difficulty,
		global::proofsize(),
		global::min_edge_bits(),
	)
	.unwrap();
	chain.process_block(b, chain::Options::MINE).unwrap();
	chain.validate(false).unwrap();
}
pub fn add_block_with_reward ( chain : & Chain , txs : Vec < & Transaction > , reward : CbData ) { let prev = chain . head_header ( ) . unwrap ( ) ; let next_header_info = consensus :: next_difficulty ( 1 , chain . difficulty_iter ( ) ) ; let out_bin = util :: from_hex ( reward . output ) . unwrap ( ) ; let kern_bin = util :: from_hex ( reward . kernel ) . unwrap ( ) ; let output = ser :: deserialize ( & mut & out_bin [ .. ] ) . unwrap ( ) ; let kernel = ser :: deserialize ( & mut & kern_bin [ .. ] ) . unwrap ( ) ; let mut b = core :: core :: Block :: new ( & prev , txs . into_iter ( ) . cloned ( ) . collect ( ) , next_header_info . clone ( ) . difficulty , ( output , kernel ) , ) . unwrap ( ) ; b . header . timestamp = prev . timestamp + Duration :: seconds ( 60 ) ; b . header . pow . secondary_scaling = next_header_info . secondary_scaling ; chain . set_txhashset_roots ( & mut b ) . unwrap ( ) ; pow :: pow_size ( & mut b . header , next_header_info . difficulty , global :: proofsize ( ) , global :: min_edge_bits ( ) , ) . unwrap ( ) ; chain . process_block ( b , chain :: Options :: MINE ) . unwrap ( ) ; chain . validate ( false ) . unwrap ( ) ; }
Adds a block with a given reward to the chain and mines it
Adds a block with a given reward to the chain and mines it
chain
&Chain
txs
Vec<&Transaction>
reward
CbData