Skip to content

Commit e3746e2

Browse files
authored
Merge pull request #105 from sanket1729/misc_fixes
Decode 65 bytes pubkey
2 parents 1d270ae + bcbe365 commit e3746e2

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ pub enum Error {
333333
IncorrectScriptHash,
334334
/// Recursion depth exceeded when parsing policy/miniscript from string
335335
MaxRecursiveDepthExceeded,
336-
/// Recursion depth exceeded when parsing policy/miniscript from string
336+
/// Script size too large
337337
ScriptSizeTooLarge,
338338
}
339339

src/miniscript/lex.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ pub fn lex(script: &script::Script) -> Result<Vec<Token>, Error> {
224224
x.copy_from_slice(bytes);
225225
ret.push(Token::Hash32(x))
226226
}
227-
33 => {
227+
33 | 65 => {
228228
ret.push(Token::Pubkey(
229229
PublicKey::from_slice(bytes).map_err(Error::BadPubkey)?,
230230
));

src/miniscript/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,9 @@ impl Miniscript<bitcoin::PublicKey> {
129129
/// Attempt to parse a script into a Miniscript representation
130130
pub fn parse(script: &script::Script) -> Result<Miniscript<bitcoin::PublicKey>, Error> {
131131
// Transactions more than 100Kb are non-standard
132-
if script.len() > 10000 {}
132+
if script.len() > 100_000 {
133+
return Err(Error::ScriptSizeTooLarge);
134+
}
133135
let tokens = lex(script)?;
134136
let mut iter = TokenIter::new(tokens);
135137

0 commit comments

Comments
 (0)