Skip to content

Commit

Permalink
non tx err
Browse files Browse the repository at this point in the history
  • Loading branch information
pr0n00gler committed Sep 30, 2024
1 parent 60bc161 commit 3ab8773
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
3 changes: 3 additions & 0 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,7 @@ pub enum ContractError {

#[error("Channel {channel} has been blocked for denom {denom}")]
ChannelBlocked { channel: String, denom: String },

#[error("A message is being executed not as a part of a transaction")]
NotTransation,
}
15 changes: 7 additions & 8 deletions src/message_queue.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use cosmwasm_std::{DepsMut, Env, MessageInfo, Response, Storage, TransactionInfo};
use cosmwasm_std::{DepsMut, Env, MessageInfo, Response, Storage};

use crate::{
error::ContractError,
Expand Down Expand Up @@ -71,14 +71,13 @@ pub fn queue_message(
msg: ExecuteMsg,
info: MessageInfo,
) -> Result<String, ContractError> {
if env.transaction.is_none() {
return Err(ContractError::NotTransation);
}

let timelock_delay = TIMELOCK_DELAY.load(deps.storage, info.sender.to_string())?;
let message_id = format!(
"{}_{}",
env.block.height,
env.transaction
.unwrap_or(TransactionInfo { index: 0 })
.index
);

let message_id = format!("{}_{}", env.block.height, env.transaction.unwrap().index);
MESSAGE_QUEUE.push_back(
deps.storage,
&QueuedMessage {
Expand Down

0 comments on commit 3ab8773

Please sign in to comment.