Use TAPROOT_ANNEX_PREFIX in sighash module
This commit is contained in:
parent
7010672569
commit
2405417432
|
@ -27,7 +27,7 @@ use core::fmt;
|
||||||
use core::ops::{Deref, DerefMut};
|
use core::ops::{Deref, DerefMut};
|
||||||
use hashes::{sha256, sha256d, Hash};
|
use hashes::{sha256, sha256d, Hash};
|
||||||
use io;
|
use io;
|
||||||
use util::taproot::{TapLeafHash, TapSighashHash};
|
use util::taproot::{TapLeafHash, TAPROOT_ANNEX_PREFIX, TapSighashHash};
|
||||||
use SigHash;
|
use SigHash;
|
||||||
use {Script, Transaction, TxOut};
|
use {Script, Transaction, TxOut};
|
||||||
|
|
||||||
|
@ -725,7 +725,7 @@ pub struct Annex<'a>(&'a [u8]);
|
||||||
impl<'a> Annex<'a> {
|
impl<'a> Annex<'a> {
|
||||||
/// Creates a new `Annex` struct checking the first byte is `0x50`
|
/// Creates a new `Annex` struct checking the first byte is `0x50`
|
||||||
pub fn new(annex_bytes: &'a [u8]) -> Result<Self, Error> {
|
pub fn new(annex_bytes: &'a [u8]) -> Result<Self, Error> {
|
||||||
if annex_bytes.first() == Some(&0x50) {
|
if annex_bytes.first() == Some(&TAPROOT_ANNEX_PREFIX) {
|
||||||
Ok(Annex(annex_bytes))
|
Ok(Annex(annex_bytes))
|
||||||
} else {
|
} else {
|
||||||
Err(Error::WrongAnnex)
|
Err(Error::WrongAnnex)
|
||||||
|
|
Loading…
Reference in New Issue