From a90e1fa4f77775cc0211e155f641f2574fed6971 Mon Sep 17 00:00:00 2001 From: Rafael Cardenas Date: Thu, 24 Oct 2024 13:30:40 -0600 Subject: [PATCH] chore: merge --- .../chainhook-cli/src/storage/signers.rs | 18 ++++++++---------- .../chainhook-sdk/src/indexer/stacks/tests.rs | 12 ++++++++---- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/components/chainhook-cli/src/storage/signers.rs b/components/chainhook-cli/src/storage/signers.rs index 635eda80..2a70ace5 100644 --- a/components/chainhook-cli/src/storage/signers.rs +++ b/components/chainhook-cli/src/storage/signers.rs @@ -74,12 +74,11 @@ pub fn initialize_signers_db(base_dir: &PathBuf, ctx: &Context) -> Result { let mut validation_code: Option<&str> = None; let reason_code = match &response.reason_code { - BlockRejectReasonCode::ValidationFailed(code) => { - validation_code = match code { + BlockRejectReasonCode::ValidationFailed{ validation_failed} => { + validation_code = match validation_failed { BlockValidationFailedCode::BadBlockHash => { Some("bad_block_hash") } @@ -259,19 +258,18 @@ pub fn store_signer_db_messages( }; let mut stmt = db_tx .prepare("INSERT INTO block_responses - (message_id, accepted, signer_signature_hash, rejected_reason, - rejected_reason_code, rejected_validation_failed_code, rejected_chain_id, - rejected_signature) + (message_id, accepted, signer_signature_hash, signature, rejected_reason, + rejected_reason_code, rejected_validation_failed_code, rejected_chain_id) VALUES (?,FALSE,?,?,?,?,?,?)") .map_err(|e| format!("unable to prepare statement: {e}"))?; stmt.execute(rusqlite::params![ &message_id, &response.signer_signature_hash, + &response.signature, &response.reason, &reason_code, &validation_code, &response.chain_id, - &response.signature, ]) .map_err(|e| format!("unable to write block pushed: {e}"))?; } diff --git a/components/chainhook-sdk/src/indexer/stacks/tests.rs b/components/chainhook-sdk/src/indexer/stacks/tests.rs index f4a005c9..bf775d59 100644 --- a/components/chainhook-sdk/src/indexer/stacks/tests.rs +++ b/components/chainhook-sdk/src/indexer/stacks/tests.rs @@ -404,9 +404,12 @@ fn into_chainhook_event_rejects_invalid_missing_event() { fn parses_block_response_signer_message() { use chainhook_types::{BlockResponseData, StacksSignerMessage}; - use crate::indexer::stacks::{ - NewSignerModifiedSlot, NewStackerDbChunkIssuerId, NewStackerDbChunkIssuerSlots, - NewStackerDbChunks, NewStackerDbChunksContractId, + use crate::{ + indexer::stacks::{ + NewSignerModifiedSlot, NewStackerDbChunkIssuerId, NewStackerDbChunkIssuerSlots, + NewStackerDbChunks, NewStackerDbChunksContractId, + }, + utils::Context, }; use super::standardize_stacks_stackerdb_chunks; @@ -426,7 +429,8 @@ fn parses_block_response_signer_message() { slot_version: 11, }], }; - let parsed_chunk = standardize_stacks_stackerdb_chunks(&new_chunks).unwrap(); + let ctx = &Context::empty(); + let parsed_chunk = standardize_stacks_stackerdb_chunks(&new_chunks, ctx).unwrap(); assert_eq!(parsed_chunk.len(), 1); let message = &parsed_chunk[0];