From bf4b89de1bacb88bb3d1ddc89c2195fdf3047d47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Kami=C5=84ski=20=40=20StarkWare?= Date: Tue, 5 Nov 2024 13:47:56 +0100 Subject: [PATCH] fix: skip coinbase (#294) --- packages/consensus/src/types/chain_state.cairo | 2 +- packages/consensus/src/validation/script.cairo | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/consensus/src/types/chain_state.cairo b/packages/consensus/src/types/chain_state.cairo index a8ad0d31..a2fc4222 100644 --- a/packages/consensus/src/types/chain_state.cairo +++ b/packages/consensus/src/types/chain_state.cairo @@ -79,7 +79,7 @@ pub impl BlockValidatorImpl of BlockValidator { )?; validate_coinbase(txs[0], total_fees, block_height, wtxid_root)?; if execute_script { - validate_scripts(@block.header, txs)?; + validate_scripts(@block.header, txs.slice(1, txs.len() - 1))?; } txid_root } diff --git a/packages/consensus/src/validation/script.cairo b/packages/consensus/src/validation/script.cairo index 0b3b804f..9b1b0f33 100644 --- a/packages/consensus/src/validation/script.cairo +++ b/packages/consensus/src/validation/script.cairo @@ -174,7 +174,7 @@ fn validate_script(header: @Header, tx: @Transaction, tx_idx: u32) -> Result<(), pub fn validate_scripts(header: @Header, txs: Span) -> Result<(), ByteArray> { let mut r = Result::Ok(()); - let mut i = 0; + let mut i = 1; for tx in txs { r = validate_script(header, tx, i); if r.is_err() {