@@ -6,7 +6,7 @@ use jsonrpc_core::{Error, ErrorCode, Result};
66use tower:: { Service , ServiceExt } ;
77
88use zebra_chain:: {
9- amount:: { self , Amount , NegativeOrZero , NonNegative , MAX_MONEY } ,
9+ amount:: { self , Amount , NegativeOrZero , NonNegative } ,
1010 block:: {
1111 self ,
1212 merkle:: { self , AuthDataRoot } ,
@@ -297,6 +297,7 @@ pub fn generate_coinbase_and_roots(
297297 history_tree : Arc < zebra_chain:: history_tree:: HistoryTree > ,
298298 like_zcashd : bool ,
299299 extra_coinbase_data : Vec < u8 > ,
300+ expected_block_subsidy : Amount < NonNegative > ,
300301 #[ cfg( zcash_unstable = "nsm" ) ] burn_amount : Option < Amount < NonNegative > > ,
301302) -> ( TransactionTemplate < NegativeOrZero > , DefaultRoots ) {
302303 // Generate the coinbase transaction
@@ -308,6 +309,7 @@ pub fn generate_coinbase_and_roots(
308309 miner_fee,
309310 like_zcashd,
310311 extra_coinbase_data,
312+ expected_block_subsidy,
311313 #[ cfg( zcash_unstable = "nsm" ) ]
312314 burn_amount,
313315 ) ;
@@ -336,16 +338,25 @@ pub fn generate_coinbase_and_roots(
336338///
337339/// If `like_zcashd` is true, try to match the coinbase transactions generated by `zcashd`
338340/// in the `getblocktemplate` RPC.
341+ #[ allow( clippy:: too_many_arguments) ]
339342pub fn generate_coinbase_transaction (
340343 network : & Network ,
341344 height : Height ,
342345 miner_address : & transparent:: Address ,
343346 miner_fee : Amount < NonNegative > ,
344347 like_zcashd : bool ,
345348 extra_coinbase_data : Vec < u8 > ,
349+ expected_block_subsidy : Amount < NonNegative > ,
346350 #[ cfg( zcash_unstable = "nsm" ) ] burn_amount : Option < Amount < NonNegative > > ,
347351) -> UnminedTx {
348- let outputs = standard_coinbase_outputs ( network, height, miner_address, miner_fee, like_zcashd) ;
352+ let outputs = standard_coinbase_outputs (
353+ network,
354+ height,
355+ miner_address,
356+ miner_fee,
357+ like_zcashd,
358+ expected_block_subsidy,
359+ ) ;
349360
350361 if like_zcashd {
351362 #[ cfg( zcash_unstable = "nsm" ) ]
@@ -424,17 +435,8 @@ pub fn standard_coinbase_outputs(
424435 miner_address : & transparent:: Address ,
425436 miner_fee : Amount < NonNegative > ,
426437 like_zcashd : bool ,
438+ expected_block_subsidy : Amount < NonNegative > ,
427439) -> Vec < ( Amount < NonNegative > , transparent:: Script ) > {
428- #[ cfg( zcash_unstable = "nsm" ) ]
429- let expected_block_subsidy = general:: block_subsidy (
430- height,
431- network,
432- MAX_MONEY . try_into ( ) . expect ( "MAX_MONEY is a valid amount" ) ,
433- )
434- . expect ( "valid block subsidy" ) ;
435- #[ cfg( not( zcash_unstable = "nsm" ) ) ]
436- let expected_block_subsidy =
437- general:: block_subsidy_pre_nsm ( height, network) . expect ( "valid block subsidy" ) ;
438440 let funding_streams =
439441 funding_streams:: funding_stream_values ( height, network, expected_block_subsidy)
440442 . expect ( "funding stream value calculations are valid for reasonable chain heights" ) ;
0 commit comments