Skip to content

Commit

Permalink
Added flag arg to run_clvm
Browse files Browse the repository at this point in the history
  • Loading branch information
ChiaMineJP committed Apr 3, 2024
1 parent 62aadff commit b84b537
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions wasm/src/run_program.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,22 @@ impl Flag {
}

#[wasm_bindgen]
pub fn run_clvm(program: &[u8], args: &[u8]) -> Vec<u8> {
pub fn run_clvm(program: &[u8], args: &[u8], flag: u32) -> Vec<u8> {
let max_cost: Cost = 1_000_000_000_000_000;

let mut allocator = Allocator::new();
let program = node_from_bytes(&mut allocator, program).unwrap();
let args = node_from_bytes(&mut allocator, args).unwrap();
let deserializer = if (flag & ALLOW_BACKREFS) != 0 {
node_from_bytes_backrefs
} else {
node_from_bytes
};
let program = deserializer(&mut allocator, program).unwrap();
let args = deserializer(&mut allocator, args).unwrap();
let dialect = ChiaDialect::new(flag);

let r = run_program(
&mut allocator,
&ChiaDialect::new(0),
&dialect,
program,
args,
max_cost,
Expand Down

0 comments on commit b84b537

Please sign in to comment.