Skip to content

Commit

Permalink
sighash: Add network to create_nofn_sighash_stream.
Browse files Browse the repository at this point in the history
  • Loading branch information
ceyhunsen committed Dec 17, 2024
1 parent 6a8cba4 commit 8820baf
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
3 changes: 2 additions & 1 deletion core/src/builder/sighash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ pub fn create_nofn_sighash_stream(
recovery_taproot_address: Address<NetworkUnchecked>,
user_takes_after: u64,
nofn_xonly_pk: secp256k1::XOnlyPublicKey,
network: bitcoin::Network,
) -> impl Stream<Item = Result<TapSighash, BridgeError>> {
try_stream! {
for i in 0..10 {
Expand All @@ -20,7 +21,7 @@ pub fn create_nofn_sighash_stream(
evm_address,
&recovery_taproot_address,
nofn_xonly_pk,
bitcoin::Network::Regtest,
network,
user_takes_after as u32,
Amount::from_sat(i as u64 + 1000000),
);
Expand Down
10 changes: 5 additions & 5 deletions core/src/builder/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ pub fn create_timeout_tx_handler(
}
}

/// Creates the move_tx to move the deposit.
/// Creates the move_tx.
pub fn create_move_tx(
deposit_outpoint: OutPoint,
nofn_xonly_pk: XOnlyPublicKey,
Expand All @@ -200,10 +200,10 @@ pub fn create_move_tx(
create_btc_tx(tx_ins, vec![move_txout, anyone_can_spend_txout])
}

/// Creates an [`TxHandler`] that includes move_tx to move the deposit.
/// Creates a [`TxHandler`] for the move_tx.
pub fn create_move_tx_handler(
deposit_outpoint: OutPoint,
evm_address: EVMAddress,
user_evm_address: EVMAddress,
recovery_taproot_address: &Address<NetworkUnchecked>,
nofn_xonly_pk: XOnlyPublicKey,
network: bitcoin::Network,
Expand All @@ -215,7 +215,7 @@ pub fn create_move_tx_handler(
let (deposit_address, deposit_taproot_spend_info) = builder::address::generate_deposit_address(
nofn_xonly_pk,
recovery_taproot_address,
evm_address,
user_evm_address,
bridge_amount_sats,
network,
user_takes_after,
Expand All @@ -228,7 +228,7 @@ pub fn create_move_tx_handler(

let deposit_script = vec![builder::script::create_deposit_script(
nofn_xonly_pk,
evm_address,
user_evm_address,
bridge_amount_sats,
)];

Expand Down
1 change: 1 addition & 0 deletions core/src/rpc/aggregator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ impl ClementineAggregator for Aggregator {
recovery_taproot_address,
user_takes_after,
nofn_xonly_pk,
self.config.network
));

for _ in 0..NUM_REQUIRED_SIGS {
Expand Down
2 changes: 2 additions & 0 deletions core/src/rpc/verifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@ impl ClementineVerifier for Verifier {
recovery_taproot_address,
user_takes_after,
verifier.nofn_xonly_pk,
verifier.config.network
));

while let Some(result) = in_stream.message().await.unwrap() {
Expand Down Expand Up @@ -442,6 +443,7 @@ impl ClementineVerifier for Verifier {
recovery_taproot_address,
user_takes_after,
self.nofn_xonly_pk,
self.config.network
));

let mut nonce_idx: usize = 0;
Expand Down

0 comments on commit 8820baf

Please sign in to comment.