Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
remove unnecessary async
Browse files Browse the repository at this point in the history
  • Loading branch information
irnb committed Aug 11, 2024
1 parent ea3fd31 commit 4970707
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
33 changes: 16 additions & 17 deletions core/lib/via_btc_client/src/inscriber/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,16 +132,13 @@ impl Inscriber {
.prepare_commit_tx_output(
&commit_tx_input_info,
inscription_data.script_pubkey.clone(),
)
.await?;
).await?;

let final_commit_tx = self
.sign_commit_tx(&commit_tx_input_info, &commit_tx_output_info)
.await?;
.sign_commit_tx(&commit_tx_input_info, &commit_tx_output_info)?;

let reveal_tx_input_info = self
.prepare_reveal_tx_input(&commit_tx_output_info, &final_commit_tx, &inscription_data)
.await?;
.prepare_reveal_tx_input(&commit_tx_output_info, &final_commit_tx, &inscription_data)?;

let reveal_tx_output_info = self
.prepare_reveal_tx_output(&reveal_tx_input_info, &inscription_data)
Expand All @@ -152,8 +149,7 @@ impl Inscriber {
&reveal_tx_input_info,
&reveal_tx_output_info,
&inscription_data,
)
.await?;
)?;

let broadcast_status = self
.broadcast_inscription(&final_commit_tx, &final_reveal_tx)
Expand All @@ -170,7 +166,7 @@ impl Inscriber {
commit_tx_output_info,
reveal_tx_output_info,
commit_tx_input_info,
).await?;
)?;

Ok(())
}
Expand Down Expand Up @@ -377,7 +373,7 @@ impl Inscriber {
Ok(res)
}

async fn sign_commit_tx(
fn sign_commit_tx(
&self,
input: &CommitTxInputRes,
output: &CommitTxOutputRes,
Expand Down Expand Up @@ -446,7 +442,7 @@ impl Inscriber {
Ok(res)
}

async fn prepare_reveal_tx_input(
fn prepare_reveal_tx_input(
&self,
commit_output: &CommitTxOutputRes,
commit_tx: &FinalTx,
Expand Down Expand Up @@ -582,7 +578,7 @@ impl Inscriber {
Ok(res)
}

async fn sign_reveal_tx(
fn sign_reveal_tx(
&self,
input: &RevealTxInputRes,
output: &RevealTxOutputRes,
Expand Down Expand Up @@ -722,7 +718,7 @@ impl Inscriber {
Ok(commit_broadcasted && reveal_broadcasted)
}

async fn insert_inscription_to_context(
fn insert_inscription_to_context(
&mut self,
req: types::InscriberInput,
commit: FinalTx,
Expand Down Expand Up @@ -757,11 +753,14 @@ impl Inscriber {
Ok(())
}

pub async fn get_context_snapshot(&self) {
todo!();
pub fn get_context_snapshot(&self) -> Result<types::InscriberContext> {
Ok(self.context.clone())
}

pub async fn recreate_context_from_snapshot() {
todo!();
pub fn recreate_context_from_snapshot(&mut self, snapshot: types::InscriberContext) -> Result<()> {

self.context = snapshot;

Ok(())
}
}
1 change: 1 addition & 0 deletions core/lib/via_btc_client/src/inscriber/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ pub struct InscriptionRequest {
// the inscribe method first calls update context method before inscribing the message
// the upper layer after calling inscribe method should persist the context in the database

#[derive(Clone)]
pub struct InscriberContext {
pub fifo_queue: VecDeque<InscriptionRequest>,
}
Expand Down

0 comments on commit 4970707

Please sign in to comment.