pub fn award_block_to_wallet<C, K>(
	chain: &Chain,
	txs: Vec<&Transaction>,
	wallet: Arc<Mutex<dyn WalletInst<C, K>>>,
) -> Result<(), libwallet::Error>
where
	C: NodeClient,
	K: keychain::Keychain,
{
	// build block fees
	let prev = chain.head_header().unwrap();
	let fee_amt = txs.iter().map(|tx| tx.fee()).sum();
	let block_fees = BlockFees {
		fees: fee_amt,
		key_id: None,
		height: prev.height + 1,
	};
	// build coinbase (via api) and add block
	controller::foreign_single_use(wallet.clone(), |api| {
		let coinbase_tx = api.build_coinbase(&block_fees)?;
		add_block_with_reward(chain, txs, coinbase_tx.clone());
		Ok(())
	})?;
	Ok(())
}
/// adds a reward output to a wallet, includes that reward in a block, mines
/// the block and adds it to the chain, with option transactions included.
/// Helpful for building up precise wallet balances for testing.
adds a reward output to a wallet, includes that reward in a block, mines
the block and adds it to the chain, with option transactions included.
Helpful for building up precise wallet balances for testing.
adds a reward output to a wallet includes that reward in a block mines the block and adds it to the chain with option transactions included . Helpful for building up precise wallet balances for testing .
pub fn award_block_to_wallet<C, K>(
	chain: &Chain,
	txs: Vec<&Transaction>,
	wallet: Arc<Mutex<dyn WalletInst<C, K>>>,
) -> Result<(), libwallet::Error>
where
	C: NodeClient,
	K: keychain::Keychain,
{
	// build block fees
	let prev = chain.head_header().unwrap();
	let fee_amt = txs.iter().map(|tx| tx.fee()).sum();
	let block_fees = BlockFees {
		fees: fee_amt,
		key_id: None,
		height: prev.height + 1,
	};
	// build coinbase (via api) and add block
	controller::foreign_single_use(wallet.clone(), |api| {
		let coinbase_tx = api.build_coinbase(&block_fees)?;
		add_block_with_reward(chain, txs, coinbase_tx.clone());
		Ok(())
	})?;
	Ok(())
}
pub fn award_block_to_wallet < C , K > ( chain : & Chain , txs : Vec < & Transaction > , wallet : Arc < Mutex < dyn WalletInst < C , K > > > , ) -> Result < ( ) , libwallet :: Error > where C : NodeClient , K : keychain :: Keychain , { // build block fees let prev = chain . head_header ( ) . unwrap ( ) ; let fee_amt = txs . iter ( ) . map ( | tx | tx . fee ( ) ) . sum ( ) ; let block_fees = BlockFees { fees : fee_amt , key_id : None , height : prev . height + 1 , } ; // build coinbase (via api) and add block controller :: foreign_single_use ( wallet . clone ( ) , | api | { let coinbase_tx = api . build_coinbase ( & block_fees ) ? ; add_block_with_reward ( chain , txs , coinbase_tx . clone ( ) ) ; Ok ( ( ) ) } ) ? ; Ok ( ( ) ) }
adds a reward output to a wallet, includes that reward in a block, mines
the block and adds it to the chain, with option transactions included.
adds a reward output to a wallet includes that reward in a block mines the block and adds it to the chain with option transactions included .
chain
&Chain
txs
Vec<&Transaction>
wallet
Arc<Mutex<dyn WalletInst<C, K>>>