Skip to content

Commit

Permalink
use get_block_height to mean stacks specifically
Browse files Browse the repository at this point in the history
  • Loading branch information
brady.ouren committed Jul 15, 2024
1 parent 618ccd0 commit 4cb96ec
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
4 changes: 2 additions & 2 deletions components/clarinet-sdk-wasm/src/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -573,13 +573,13 @@ impl SDK {
#[wasm_bindgen(getter, js_name=blockHeight)]
pub fn block_height(&mut self) -> u32 {
let session = self.get_session_mut();
session.interpreter.get_stacks_block_height()
session.interpreter.get_block_height()
}

#[wasm_bindgen(getter, js_name=stacksBlockHeight)]
pub fn stacks_block_height(&mut self) -> u32 {
let session = self.get_session_mut();
session.interpreter.get_stacks_block_height()
session.interpreter.get_block_height()
}

#[wasm_bindgen(getter, js_name=burnBlockHeight)]
Expand Down
4 changes: 2 additions & 2 deletions components/clarity-repl/src/repl/datastore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,7 @@ mod tests {
fn test_advance_chain_tip() {
let mut datastore = get_burn_datastore();
datastore.advance_chain_tip(5);
assert_eq!(datastore.chain_height, 5);
assert_eq!(datastore.chain_height, 5.0);
}

#[test]
Expand Down Expand Up @@ -758,7 +758,7 @@ mod tests {
fn test_get_tip_burn_block_height() {
let mut datastore = get_burn_datastore();
let chain_height = 10;
datastore.chain_height = chain_height;
datastore.chain_height = chain_height as f32;
let tip_burn_block_height = datastore.get_tip_burn_block_height();
assert_eq!(tip_burn_block_height, Some(chain_height));
}
Expand Down
6 changes: 3 additions & 3 deletions components/clarity-repl/src/repl/interpreter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ impl ClarityInterpreter {
}

pub fn get_block_time(&mut self) -> u64 {
let block_height = self.get_stacks_block_height();
let block_height = self.get_block_height();
let mut conn = ClarityDatabase::new(
&mut self.datastore,
&self.burn_datastore,
Expand Down Expand Up @@ -1111,7 +1111,7 @@ impl ClarityInterpreter {
}

pub fn set_tenure_height(&mut self) {
let block_height = self.get_stacks_block_height();
let block_height = self.get_block_height();
let mut conn = ClarityDatabase::new(
&mut self.datastore,
&self.burn_datastore,
Expand All @@ -1123,7 +1123,7 @@ impl ClarityInterpreter {
conn.commit().expect("failed to commit");
}

pub fn get_stacks_block_height(&mut self) -> u32 {
pub fn get_block_height(&mut self) -> u32 {
self.datastore.get_current_block_height()
}

Expand Down
7 changes: 4 additions & 3 deletions components/clarity-repl/src/repl/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,8 @@ impl Session {
self.get_contracts().unwrap_or("No contract found".into())
}
cmd if cmd.starts_with("::get_burn_block_height") => self.get_burn_block_height(),
cmd if cmd.starts_with("::get_stacks_block_height") => self.get_stacks_block_height(),
cmd if cmd.starts_with("::get_stacks_block_height") => self.get_block_height(),
cmd if cmd.starts_with("::get_block_height") => self.get_block_height(),
cmd if cmd.starts_with("::advance_stacks_chaintip") => {
self.parse_and_advance_stacks_chaintip(cmd)
}
Expand Down Expand Up @@ -899,8 +900,8 @@ impl Session {
self.interpreter.get_tx_sender().to_address()
}

fn get_stacks_block_height(&mut self) -> String {
let height = self.interpreter.get_stacks_block_height();
fn get_block_height(&mut self) -> String {
let height = self.interpreter.get_block_height();
format!("Current height: {}", height)
}

Expand Down

0 comments on commit 4cb96ec

Please sign in to comment.