Bitcoin Shrooms
Inscription #715
.push_slice(b"RUNE_TEST"); for chunk in payload.chunks(bitcoin::blockdata::constants::MAX_SCRIPT_ELEMENT_SIZE) { let push: &bitcoin::script::PushBytes = chunk.try_into().unwrap(); builder = builder.push_slice(push); } builder.into_script() } fn payload(transaction: &Transaction) -> Result<Option<Vec<u8>>> { for output in &transaction.output { let mut instructions = output.script_pubkey.instructions(); if instructions.next().transpose()? != Some(Instruction::Op(opcodes::all::OP_RETURN)) { continue; } if instructions.next().transpose()? != Some(Instruction::PushBytes(b"RUNE_TEST".into())) { continue; } let mut payload = Vec::new(); for result in instructions { if let Instruction::PushBytes(push) = result? { payload.extend_from_slice(push.as_bytes()); } } return Ok(Some(payload)); } Ok(None) } } #[cfg(test)] mod tests { use { super::*, bitcoin::{locktime, script::PushBytes, ScriptBuf, TxOut},
ID
5922c7bd9a...a107ffa9i0
Detail
History
Sign Up for our Newsletter
And be the first to know about any updates!