Skip to content

Commit a5b3cc6

Browse files
committed
chore: migration: use Scalar in key multiplication
see rust-bitcoin/rust-secp256k1#445
1 parent c3508e2 commit a5b3cc6

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

bitcoin/src/addr.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
use bitcoincore_rpc::bitcoin::secp256k1::Scalar;
2+
13
use crate::{secp256k1::SecretKey, Error};
24

35
pub fn calculate_deposit_secret_key(vault_key: SecretKey, issue_key: SecretKey) -> Result<SecretKey, Error> {
46
let mut deposit_key = vault_key;
5-
deposit_key.mul_assign(&issue_key[..])?;
7+
deposit_key.mul_assign(&Scalar::from(issue_key))?;
68
Ok(deposit_key)
79
}
810

bitcoin/src/light/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ mod error;
22
mod wallet;
33

44
pub use crate::{Error as BitcoinError, *};
5-
use bitcoincore_rpc::bitcoin::blockdata::constants::WITNESS_SCALE_FACTOR;
5+
use bitcoincore_rpc::bitcoin::{blockdata::constants::WITNESS_SCALE_FACTOR, secp256k1::Scalar};
66
pub use error::Error;
77

88
use async_trait::async_trait;
@@ -158,7 +158,7 @@ impl BitcoinCoreApi for BitcoinLight {
158158
async fn add_new_deposit_key(&self, _public_key: PublicKey, secret_key: Vec<u8>) -> Result<(), BitcoinError> {
159159
fn mul_secret_key(vault_key: SecretKey, issue_key: SecretKey) -> Result<SecretKey, BitcoinError> {
160160
let mut deposit_key = vault_key;
161-
deposit_key.mul_assign(&issue_key[..])?;
161+
deposit_key.mul_assign(&Scalar::from(issue_key))?;
162162
Ok(deposit_key)
163163
}
164164

0 commit comments

Comments
 (0)