Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi building checkpoints #294

Open
wants to merge 21 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
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
43 changes: 23 additions & 20 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,8 @@ impl InnerApp {
let fee = coins.take(fee)?;
self.bitcoin.give_rewards(fee)?;

let building = &mut self.bitcoin.checkpoints.building_mut()?;
let dest = Dest::Ibc(dest);
let mut building = self.bitcoin.checkpoints.building_mut()?;
building.insert_pending(dest, coins)?;

Ok(())
Expand Down Expand Up @@ -245,20 +245,26 @@ impl InnerApp {
sigset_index: u32,
dest: Dest,
) -> Result<()> {
if let Dest::Ibc(dest) = dest.clone() {
dest.source_port()?;
dest.source_channel()?;
dest.sender_address()?;
}
#[cfg(target_arch = "wasm32")]
unimplemented!();

#[cfg(not(target_arch = "wasm32"))]
{
if let Dest::Ibc(dest) = dest.clone() {
dest.source_port()?;
dest.source_channel()?;
dest.sender_address()?;
}

Ok(self.bitcoin.relay_deposit(
btc_tx,
btc_height,
btc_proof,
btc_vout,
sigset_index,
dest,
)?)
Ok(self.bitcoin.relay_deposit(
btc_tx,
btc_height,
btc_proof,
btc_vout,
sigset_index,
dest,
)?)
}
}

#[call]
Expand Down Expand Up @@ -508,12 +514,9 @@ mod abci {
self.credit_transfer(dest, coins)?;
}

let external_outputs = if self.bitcoin.should_push_checkpoint()? {
self.cosmos
.build_outputs(&self.ibc, self.bitcoin.checkpoints.index)?
} else {
vec![]
};
let external_outputs = self
.cosmos
.build_outputs(&self.ibc, self.bitcoin.checkpoints.index)?;
let offline_signers = self
.bitcoin
.begin_block_step(external_outputs.into_iter().map(Ok), ctx.hash.clone())?;
Expand Down
Loading
Loading