Skip to content

Commit

Permalink
fix: warn when not able to query mock_proposals
Browse files Browse the repository at this point in the history
  • Loading branch information
csgui committed Nov 6, 2024
1 parent 5ac1b45 commit 0126739
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions components/chainhook-cli/src/storage/signers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ pub fn initialize_signers_db(base_dir: &PathBuf, ctx: &Context) -> Result<Connec
conn.execute(
"CREATE TABLE IF NOT EXISTS mock_proposals (
id INTEGER PRIMARY KEY AUTOINCREMENT,
message_id INTEGER NOT NULL,
message_id INTEGER,
burn_block_height INTEGER NOT NULL,
stacks_tip_consensus_hash TEXT NOT NULL,
stacks_tip TEXT NOT NULL,
Expand Down Expand Up @@ -143,7 +143,7 @@ pub fn initialize_signers_db(base_dir: &PathBuf, ctx: &Context) -> Result<Connec
"CREATE TABLE IF NOT EXISTS mock_signatures (
id INTEGER PRIMARY KEY AUTOINCREMENT,
mock_proposal_id INTEGER NOT NULL,
message_id INTEGER NOT NULL,
message_id INTEGER,
mock_block_id INTEGER,
server_version TEXT NOT NULL,
signature TEXT NOT NULL,
Expand Down Expand Up @@ -699,8 +699,13 @@ pub fn get_signer_db_messages_received_at_block(
index_block_hash: proposal_row.get(7).unwrap(),
}))
},
)
.map_err(|e| format!("unable to query mock proposal: {e}"))?,
).unwrap_or_else(|e| {
warn!(
ctx.expect_logger(),
"unable to query mock_proposals table for message_id {}: {}", message_id, e
);
return vec![];
}),
"mock_block" => db_tx
.query_row(
"SELECT b.id, p.burn_block_height, p.stacks_tip_consensus_hash, p.stacks_tip, p.stacks_tip_height,
Expand Down

0 comments on commit 0126739

Please sign in to comment.