Skip to content

Commit be2edf3

Browse files
committed
program: add logging for wrong perp market mutability
1 parent 10247eb commit be2edf3

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

programs/drift/src/state/perp_market_map.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ impl<'a> PerpMarketMap<'a> {
123123

124124
let is_writable = account_info.is_writable;
125125
if writable_markets.contains(&market_index) && !is_writable {
126+
msg!("Market {} is not writable", market_index);
126127
return Err(ErrorCode::MarketWrongMutability);
127128
}
128129

@@ -167,6 +168,7 @@ impl<'a> PerpMarketMap<'a> {
167168
AccountLoader::try_from(account_info).or(Err(ErrorCode::InvalidMarketAccount))?;
168169

169170
if must_be_writable && !is_writable {
171+
msg!("Market {} is not writable", market_index);
170172
return Err(ErrorCode::MarketWrongMutability);
171173
}
172174

@@ -209,6 +211,7 @@ impl<'a> PerpMarketMap<'a> {
209211
AccountLoader::try_from(account_info).or(Err(ErrorCode::InvalidMarketAccount))?;
210212

211213
if must_be_writable && !is_writable {
214+
msg!("Market {} is not writable", market_index);
212215
return Err(ErrorCode::MarketWrongMutability);
213216
}
214217

0 commit comments

Comments
 (0)