Skip to content

Commit

Permalink
code review
Browse files Browse the repository at this point in the history
  • Loading branch information
SWvheerden committed Oct 30, 2023
1 parent e951ddf commit 8fb78fe
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions base_layer/core/src/transactions/aggregated_body.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
2 changes: 1 addition & 1 deletion base_layer/core/src/transactions/coinbase_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down
2 changes: 1 addition & 1 deletion base_layer/core/src/validation/block_body/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 8fb78fe

Please sign in to comment.