Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions ark-core/src/send.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,20 +211,22 @@ pub fn build_offchain_transactions(
let mut bytes = Vec::new();

let script = &checkpoint_output.vtxo_spend_script;
write_compact_size_uint(&mut bytes, script.len() as u64).map_err(Error::transaction)?;
let scripts = vec![script.clone(), checkpoint_script.clone()];

// Write the depth (always 1). TODO: Support more depth.
bytes.push(1);
for script in scripts.iter() {
// Write the depth (always 1). TODO: Support more depth.
bytes.push(1);

// TODO: Support future leaf versions.
bytes.push(LeafVersion::TapScript.to_consensus());
// TODO: Support future leaf versions.
bytes.push(LeafVersion::TapScript.to_consensus());

let mut script_bytes = script.to_bytes();
let mut script_bytes = script.to_bytes();

write_compact_size_uint(&mut bytes, script_bytes.len() as u64)
.map_err(Error::transaction)?;
write_compact_size_uint(&mut bytes, script_bytes.len() as u64)
.map_err(Error::transaction)?;

bytes.append(&mut script_bytes);
bytes.append(&mut script_bytes);
}

unsigned_ark_psbt.inputs[i].unknown.insert(
psbt::raw::Key {
Expand Down
Loading