// add the coinbase to the NewBlockTemplate
add the coinbase to the NewBlockTemplate
add the coinbase to the NewBlockTemplate
fn add_coinbase(&self, block: &mut NewBlockTemplate) -> Result<UnblindedOutput, MinerError> {
        let fees = block.body.get_total_fee();
        let (key, r) = self.get_spending_key()?;
        let factories = CryptoFactories::default();
        let builder = CoinbaseBuilder::new(factories);
        let builder = builder
            .with_block_height(block.header.height)
            .with_fees(fees)
            .with_nonce(r)
            .with_spend_key(key);
        let (tx, unblinded_output) = builder
            .build(
                self.consensus.consensus_constants(block.header.height),
                self.consensus.emission_schedule(),
            )
            .expect("invalid constructed coinbase");
        block.body.add_output(tx.body.outputs()[0].clone());
        block.body.add_kernel(tx.body.kernels()[0].clone());
        Ok(unblinded_output)
    }
fn add_coinbase ( & self , block : & mut NewBlockTemplate ) -> Result < UnblindedOutput , MinerError > { let fees = block . body . get_total_fee ( ) ; let ( key , r ) = self . get_spending_key ( ) ? ; let factories = CryptoFactories :: default ( ) ; let builder = CoinbaseBuilder :: new ( factories ) ; let builder = builder . with_block_height ( block . header . height ) . with_fees ( fees ) . with_nonce ( r ) . with_spend_key ( key ) ; let ( tx , unblinded_output ) = builder . build ( self . consensus . consensus_constants ( block . header . height ) , self . consensus . emission_schedule ( ) , ) . expect ( " " ) ; block . body . add_output ( tx . body . outputs ( ) [ 0 ] . clone ( ) ) ; block . body . add_kernel ( tx . body . kernels ( ) [ 0 ] . clone ( ) ) ; Ok ( unblinded_output ) }
add the coinbase to the NewBlockTemplate
add the coinbase to the NewBlockTemplate
&self
block
&mut NewBlockTemplate