Skip to content

Commit

Permalink
chore: update strata-p2p dep
Browse files Browse the repository at this point in the history
  • Loading branch information
storopoli committed Mar 5, 2025
1 parent fbd37af commit d5996d4
Show file tree
Hide file tree
Showing 5 changed files with 159 additions and 136 deletions.
21 changes: 10 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 23 additions & 10 deletions crates/p2p-impl/src/message_handler.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
//! Message handler for the Strata Bridge P2P.
use bitcoin::{OutPoint, XOnlyPublicKey};
use bitcoin::{hashes::sha256, Txid, XOnlyPublicKey};
use libp2p::identity::secp256k1::Keypair as Libp2pSecpKeypair;
use musig2::{PartialSignature, PubNonce};
use strata_p2p::{
commands::{Command, UnsignedPublishMessage},
events::Event,
swarm::handle::P2PHandle,
};
use strata_p2p_types::{OperatorPubKey, Scope, SessionId, StakeChainId, StakeData, WotsPublicKeys};
use strata_p2p_types::{OperatorPubKey, Scope, SessionId, StakeChainId, WotsPublicKeys};
use strata_p2p_wire::p2p::v1::GetMessageRequest;
use tracing::{error, info, trace};

Expand Down Expand Up @@ -62,24 +62,37 @@ impl MessageHandler {
}

/// Sends a deposit setup message to the network.
pub async fn send_deposit_setup(&self, scope: Scope, wots_pks: WotsPublicKeys) {
let msg = UnsignedPublishMessage::DepositSetup { scope, wots_pks };
pub async fn send_deposit_setup(
&self,
scope: Scope,
hash: sha256::Hash,
funding_txid: Txid,
funding_vout: u32,
operator_pk: XOnlyPublicKey,
wots_pks: WotsPublicKeys,
) {
let msg = UnsignedPublishMessage::DepositSetup {
scope,
hash,
funding_txid,
funding_vout,
operator_pk,
wots_pks,
};
self.dispatch(msg, "deposit setup message").await;
}

/// Sends a stake chain exchange message to the network.
pub async fn send_stake_chain_exchange(
&self,
stake_chain_id: StakeChainId,
pre_stake_outpoint: OutPoint,
checkpoint_pubkeys: Vec<XOnlyPublicKey>,
stake_data: Vec<StakeData>,
pre_stake_txid: Txid,
pre_stake_vout: u32,
) {
let msg = UnsignedPublishMessage::StakeChainExchange {
stake_chain_id,
pre_stake_outpoint,
checkpoint_pubkeys,
stake_data,
pre_stake_txid,
pre_stake_vout,
};
self.dispatch(msg, "stake chain exchange message").await;
}
Expand Down
Loading

0 comments on commit d5996d4

Please sign in to comment.