fixed lint and unit test

This commit is contained in:
jonesmarvin8 2026-02-26 19:07:04 -05:00
parent bbb9613e06
commit 8dd2b238a5
4 changed files with 8 additions and 10 deletions

View File

@ -345,8 +345,8 @@ mod tests {
assert!(tree.key_map.contains_key(&ChainIndex::root())); assert!(tree.key_map.contains_key(&ChainIndex::root()));
assert!(tree.account_id_map.contains_key(&AccountId::new([ assert!(tree.account_id_map.contains_key(&AccountId::new([
172, 82, 222, 249, 164, 16, 148, 184, 219, 56, 92, 145, 203, 220, 251, 89, 214, 178, 10, 231, 159, 65, 236, 46, 205, 5, 172, 89, 250, 29, 123, 195, 212, 137, 155, 111, 40,
38, 30, 108, 202, 251, 241, 148, 200, 125, 185, 93, 227, 189, 247 120, 53, 28, 124, 54, 224, 170, 119, 208, 2, 72, 75, 50
]))); ])));
} }

View File

@ -47,13 +47,11 @@ impl PrivateKey {
bytes.extend_from_slice(&secp256k1::PublicKey::serialize(&pk)); bytes.extend_from_slice(&secp256k1::PublicKey::serialize(&pk));
let hashed: [u8; 32] = Impl::hash_bytes(&bytes).as_bytes().try_into().unwrap(); let hashed: [u8; 32] = Impl::hash_bytes(&bytes).as_bytes().try_into().unwrap();
let tweaked_sk = PrivateKey::try_new( PrivateKey::try_new(
sk.add_tweak(&secp256k1::Scalar::from_be_bytes(hashed).unwrap()) sk.add_tweak(&secp256k1::Scalar::from_be_bytes(hashed).unwrap())
.expect("Expect a valid Scalar") .expect("Expect a valid Scalar")
.secret_bytes(), .secret_bytes(),
); )
tweaked_sk
} }
} }

View File

@ -8,7 +8,7 @@
"initial_accounts": [ "initial_accounts": [
{ {
"Public": { "Public": {
"account_id": "KfDnqyHg5VVyhxnZyA9q3nCaJnuCscFogSDDC473Aqh", "account_id": "GLuGnLWZahxEEMPWKhu2r2LYhdBzTB2EFPsNPUpg7KKc",
"pub_sign_key": [ "pub_sign_key": [
188, 163, 203, 45, 151, 154, 230, 254, 123, 114, 158, 130, 19, 182, 164, 143, 150, 131, 176, 7, 27, 58, 204, 116, 5, 247, 0, 255, 111, 160, 52, 201 188, 163, 203, 45, 151, 154, 230, 254, 123, 114, 158, 130, 19, 182, 164, 143, 150, 131, 176, 7, 27, 58, 204, 116, 5, 247, 0, 255, 111, 160, 52, 201
] ]
@ -16,7 +16,7 @@
}, },
{ {
"Public": { "Public": {
"account_id": "HcHYYUFwwyGyRQKincqNbpPHf3XYoMthq4LkfNymoZF3", "account_id": "8wbZV1W1b6P2ShtsgJTh9p2uwjZ6KR6P6qc5u3uRvKPH",
"pub_sign_key": [ "pub_sign_key": [
210, 59, 119, 137, 21, 153, 82, 22, 195, 82, 12, 16, 80, 156, 125, 199, 19, 173, 46, 224, 213, 144, 165, 126, 70, 129, 171, 141, 77, 212, 108, 233 210, 59, 119, 137, 21, 153, 82, 22, 195, 82, 12, 16, 80, 156, 125, 199, 19, 173, 46, 224, 213, 144, 165, 126, 70, 129, 171, 141, 77, 212, 108, 233
] ]

View File

@ -170,7 +170,7 @@ mod tests {
let initial_acc1 = serde_json::from_str( let initial_acc1 = serde_json::from_str(
r#"{ r#"{
"Public": { "Public": {
"account_id": "KfDnqyHg5VVyhxnZyA9q3nCaJnuCscFogSDDC473Aqh", "account_id": "GLuGnLWZahxEEMPWKhu2r2LYhdBzTB2EFPsNPUpg7KKc",
"pub_sign_key": [ "pub_sign_key": [
188, 188,
163, 163,
@ -213,7 +213,7 @@ mod tests {
let initial_acc2 = serde_json::from_str( let initial_acc2 = serde_json::from_str(
r#"{ r#"{
"Public": { "Public": {
"account_id": "HcHYYUFwwyGyRQKincqNbpPHf3XYoMthq4LkfNymoZF3", "account_id": "8wbZV1W1b6P2ShtsgJTh9p2uwjZ6KR6P6qc5u3uRvKPH",
"pub_sign_key": [ "pub_sign_key": [
210, 210,
59, 59,