script: Return bitcoinconsensus::Error from verify functions
There is no need no nest the `bitcoinconsensus::Error` type within the `script::Error`, it is the only error type returned by the verify functions so just return it directly.
This commit is contained in:
parent
8ed74c4f0d
commit
ca2512f471
|
@ -12,8 +12,6 @@ use secp256k1::{Secp256k1, Verification};
|
||||||
use crate::blockdata::opcodes::all::*;
|
use crate::blockdata::opcodes::all::*;
|
||||||
use crate::blockdata::opcodes::{self};
|
use crate::blockdata::opcodes::{self};
|
||||||
use crate::blockdata::script::witness_version::WitnessVersion;
|
use crate::blockdata::script::witness_version::WitnessVersion;
|
||||||
#[cfg(feature = "bitcoinconsensus")]
|
|
||||||
use crate::blockdata::script::Error;
|
|
||||||
use crate::blockdata::script::{
|
use crate::blockdata::script::{
|
||||||
bytes_to_asm_fmt, Builder, Instruction, InstructionIndices, Instructions, ScriptBuf,
|
bytes_to_asm_fmt, Builder, Instruction, InstructionIndices, Instructions, ScriptBuf,
|
||||||
};
|
};
|
||||||
|
@ -449,7 +447,7 @@ impl Script {
|
||||||
index: usize,
|
index: usize,
|
||||||
amount: crate::Amount,
|
amount: crate::Amount,
|
||||||
spending_tx: &[u8],
|
spending_tx: &[u8],
|
||||||
) -> Result<(), Error> {
|
) -> Result<(), bitcoinconsensus::Error> {
|
||||||
self.verify_with_flags(index, amount, spending_tx, bitcoinconsensus::VERIFY_ALL)
|
self.verify_with_flags(index, amount, spending_tx, bitcoinconsensus::VERIFY_ALL)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -467,14 +465,14 @@ impl Script {
|
||||||
amount: crate::Amount,
|
amount: crate::Amount,
|
||||||
spending_tx: &[u8],
|
spending_tx: &[u8],
|
||||||
flags: F,
|
flags: F,
|
||||||
) -> Result<(), Error> {
|
) -> Result<(), bitcoinconsensus::Error> {
|
||||||
Ok(bitcoinconsensus::verify_with_flags(
|
bitcoinconsensus::verify_with_flags(
|
||||||
&self.0[..],
|
&self.0[..],
|
||||||
amount.to_sat(),
|
amount.to_sat(),
|
||||||
spending_tx,
|
spending_tx,
|
||||||
index,
|
index,
|
||||||
flags.into(),
|
flags.into(),
|
||||||
)?)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Writes the assembly decoding of the script to the formatter.
|
/// Writes the assembly decoding of the script to the formatter.
|
||||||
|
|
Loading…
Reference in New Issue