Move sighash to crypto module

There is never any use for the `sighash` module unless one is signing,
which requires the `crypto` module. The `sighash` module should
therefore live in the `crypto` module. This is not an API breaking
change because we reexport it at the crate root.
This commit is contained in:
Tobin C. Harding 2023-02-01 08:49:17 +11:00
parent ad50fd728f
commit c5fe315a93
No known key found for this signature in database
GPG Key ID: 40BF9E4C269D6607
3 changed files with 4 additions and 4 deletions

View File

@ -9,3 +9,4 @@
pub mod ecdsa; pub mod ecdsa;
pub mod key; pub mod key;
pub mod schnorr; pub mod schnorr;
pub mod sighash;

View File

@ -1126,7 +1126,7 @@ mod tests {
// These test vectors were stolen from libbtc, which is Copyright 2014 Jonas Schnelli MIT // These test vectors were stolen from libbtc, which is Copyright 2014 Jonas Schnelli MIT
// They were transformed by replacing {...} with run_test_sighash(...), then the ones containing // They were transformed by replacing {...} with run_test_sighash(...), then the ones containing
// OP_CODESEPARATOR in their pubkeys were removed // OP_CODESEPARATOR in their pubkeys were removed
let data = include_str!("../tests/data/legacy_sighash.json"); let data = include_str!("../../tests/data/legacy_sighash.json");
let testdata = serde_json::from_str::<Value>(data).unwrap().as_array().unwrap().clone(); let testdata = serde_json::from_str::<Value>(data).unwrap().as_array().unwrap().clone();
for t in testdata.iter().skip(1) { for t in testdata.iter().skip(1) {
@ -1494,7 +1494,7 @@ mod tests {
//script_pubkey: Vec<ScriptPubKey>, // unused //script_pubkey: Vec<ScriptPubKey>, // unused
} }
let json_str = include_str!("../tests/data/bip341_tests.json"); let json_str = include_str!("../../tests/data/bip341_tests.json");
let mut data = let mut data =
serde_json::from_str::<TestData>(json_str).expect("JSON was not well-formatted"); serde_json::from_str::<TestData>(json_str).expect("JSON was not well-formatted");

View File

@ -99,7 +99,6 @@ pub mod merkle_tree;
pub mod policy; pub mod policy;
pub mod pow; pub mod pow;
pub mod psbt; pub mod psbt;
pub mod sighash;
pub mod sign_message; pub mod sign_message;
pub mod string; pub mod string;
pub mod taproot; pub mod taproot;
@ -128,7 +127,7 @@ pub use crate::blockdata::witness::{self, Witness};
pub use crate::blockdata::{constants, opcodes}; pub use crate::blockdata::{constants, opcodes};
pub use crate::consensus::encode::VarInt; pub use crate::consensus::encode::VarInt;
pub use crate::crypto::key::{self, PrivateKey, PublicKey}; pub use crate::crypto::key::{self, PrivateKey, PublicKey};
pub use crate::crypto::{ecdsa, schnorr}; pub use crate::crypto::{ecdsa, schnorr, sighash};
pub use crate::error::Error; pub use crate::error::Error;
pub use crate::hash_types::{Txid, Wtxid, BlockHash, PubkeyHash, ScriptHash, WPubkeyHash, WScriptHash}; pub use crate::hash_types::{Txid, Wtxid, BlockHash, PubkeyHash, ScriptHash, WPubkeyHash, WScriptHash};
pub use crate::merkle_tree::MerkleBlock; pub use crate::merkle_tree::MerkleBlock;