diff --git a/base_layer/core/src/transactions/aggregated_body.rs b/base_layer/core/src/transactions/aggregated_body.rs index 0241cd7205..adce832932 100644 --- a/base_layer/core/src/transactions/aggregated_body.rs +++ b/base_layer/core/src/transactions/aggregated_body.rs @@ -263,19 +263,19 @@ impl AggregateBody { "{} coinbases found in body.", coinbase_counter, ); - let mut coinbase_counter = 0; // there should be exactly 1 coinbase kernel as well + let mut coinbase_kernel_counter = 0; // there should be exactly 1 coinbase kernel as well for kernel in self.kernels() { if kernel.features.contains(KernelFeatures::COINBASE_KERNEL) { coinbase_counter += 1; coinbase_kernel = Some(kernel); } } - if coinbase_kernel.is_none() || coinbase_counter != 1 { + if coinbase_kernel.is_none() || coinbase_kernel_counter != 1 { warn!( target: LOG_TARGET, "{} coinbase kernels found in body. Only a single coinbase kernel is permitted.", coinbase_counter, ); - return Err(TransactionError::MoreThanOneCoinbase); + return Err(TransactionError::MoreThanOneCoinbaseKernel); } let coinbase_kernel = coinbase_kernel.expect("coinbase_kernel: none checked"); diff --git a/base_layer/core/src/transactions/coinbase_builder.rs b/base_layer/core/src/transactions/coinbase_builder.rs index 257382719f..41430a1cad 100644 --- a/base_layer/core/src/transactions/coinbase_builder.rs +++ b/base_layer/core/src/transactions/coinbase_builder.rs @@ -633,7 +633,7 @@ mod test { &factories, 42 ), - Err(TransactionError::MoreThanOneCoinbase) + Err(TransactionError::MoreThanOneCoinbaseKernel) )); // testing that "block" is still valid let body_validator = AggregateBodyInternalConsistencyValidator::new(false, rules, factories); diff --git a/base_layer/core/src/transactions/transaction_components/error.rs b/base_layer/core/src/transactions/transaction_components/error.rs index e1cbf3c14d..f7bf4d72a4 100644 --- a/base_layer/core/src/transactions/transaction_components/error.rs +++ b/base_layer/core/src/transactions/transaction_components/error.rs @@ -51,8 +51,8 @@ pub enum TransactionError { InvalidCoinbase, #[error("Invalid coinbase maturity in body")] InvalidCoinbaseMaturity, - #[error("More than one coinbase in body")] - MoreThanOneCoinbase, + #[error("More than one coinbase kernel in body")] + MoreThanOneCoinbaseKernel, #[error("No coinbase in body")] NoCoinbase, #[error("Input maturity not reached")] diff --git a/base_layer/core/src/validation/block_body/test.rs b/base_layer/core/src/validation/block_body/test.rs index d4dbcc7ff9..d2feef8c70 100644 --- a/base_layer/core/src/validation/block_body/test.rs +++ b/base_layer/core/src/validation/block_body/test.rs @@ -191,7 +191,7 @@ async fn it_checks_the_coinbase_reward() { } #[tokio::test] -async fn it_checks_exactly_one_coinbase() { +async fn it_allows_multiple_coinbases() { let (blockchain, validator) = setup(true); let (mut block, coinbase) = blockchain.create_unmined_block(block_spec!("A1", parent: "GB")).await;