[bug] implement a from_merkle_root method for ValidationHash instead of from_byte_array
This commit is contained in:
parent
72a3230952
commit
e47059668d
@ -6,8 +6,6 @@ use sp_client::bitcoin::key::Secp256k1;
|
|||||||
use sp_client::bitcoin::secp256k1::schnorr::Signature;
|
use sp_client::bitcoin::secp256k1::schnorr::Signature;
|
||||||
use sp_client::bitcoin::secp256k1::{Keypair, Message, PublicKey, SecretKey};
|
use sp_client::bitcoin::secp256k1::{Keypair, Message, PublicKey, SecretKey};
|
||||||
|
|
||||||
use crate::pcd::AnkPcdHash;
|
|
||||||
|
|
||||||
sha256t_hash_newtype! {
|
sha256t_hash_newtype! {
|
||||||
pub struct AnkMessageTag = hash_str("4nk/Message");
|
pub struct AnkMessageTag = hash_str("4nk/Message");
|
||||||
|
|
||||||
@ -34,17 +32,17 @@ impl AnkMessageHash {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl AnkValidationYesHash {
|
impl AnkValidationYesHash {
|
||||||
pub fn from_commitment(commitment: AnkPcdHash) -> Self {
|
pub fn from_merkle_root(merkle_root: [u8; 32]) -> Self {
|
||||||
let mut eng = AnkValidationYesHash::engine();
|
let mut eng = AnkValidationYesHash::engine();
|
||||||
eng.input(&commitment.to_byte_array());
|
eng.input(&merkle_root);
|
||||||
AnkValidationYesHash::from_engine(eng)
|
AnkValidationYesHash::from_engine(eng)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AnkValidationNoHash {
|
impl AnkValidationNoHash {
|
||||||
pub fn from_commitment(commitment: AnkPcdHash) -> Self {
|
pub fn from_merkle_root(merkle_root: [u8; 32]) -> Self {
|
||||||
let mut eng = AnkValidationNoHash::engine();
|
let mut eng = AnkValidationNoHash::engine();
|
||||||
eng.input(&commitment.to_byte_array());
|
eng.input(&merkle_root);
|
||||||
AnkValidationNoHash::from_engine(eng)
|
AnkValidationNoHash::from_engine(eng)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user