remove old mine fn introspect_transaction

This commit is contained in:
Kriptikz
2024-07-24 23:08:07 -05:00
parent ae6b98253a
commit e890e9c312

View File

@@ -186,41 +186,3 @@ pub fn process_mine<'a, 'info>(
Ok(())
}
fn introspect_transaction(msg: &[u8]) -> Result<bool, SanitizeError> {
#[allow(deprecated)]
let idx = load_current_index(msg);
let mut c = 0;
let num_instructions = read_u16(&mut c, msg)?;
let pc = c;
for i in 0..num_instructions as usize {
c = pc + i * 2;
c = read_u16(&mut c, msg)? as usize;
let num_accounts = read_u16(&mut c, msg)? as usize;
c += num_accounts * 33;
let program_id = read_pubkey(&mut c, msg)?;
if i.eq(&(idx as usize)) {
// Require top-level instruction at current index is a `mine`
if program_id.ne(&ore_api::ID) {
return Ok(false);
}
c += 2;
if let Ok(ix) = OreInstruction::try_from(read_u8(&mut c, msg)?) {
if ix.ne(&OreInstruction::Mine) {
return Ok(false);
}
}
} else {
// Require no other instructions in the transaction are a `mine`
if program_id.eq(&ore_api::ID) {
c += 2;
if let Ok(ix) = OreInstruction::try_from(read_u8(&mut c, msg)?) {
if ix.eq(&OreInstruction::Mine) {
return Ok(false);
}
}
}
}
}
Ok(true)
}