squashme: work around lack of associated constants

This commit is contained in:
Kaz Wesley 2018-11-11 14:52:52 -08:00
parent 45234eb09a
commit 6b67c8cdff
4 changed files with 672 additions and 669 deletions

View File

@ -78,7 +78,7 @@ fn bitcoin_genesis_tx() -> Transaction {
// Outputs
let out_script = script::Builder::new()
.push_slice(&hex_bytes("04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f").unwrap())
.push_opcode(opcodes::All::OP_CHECKSIG)
.push_opcode(opcodes::all::OP_CHECKSIG)
.into_script();
ret.output.push(TxOut {
value: 50 * COIN_VALUE,

View File

@ -35,7 +35,10 @@ use consensus::encode::{Decodable, Encodable};
#[derive(Copy, Clone, PartialEq, Eq)]
pub struct All(u8);
impl All {
pub mod all {
//! Constants associated with All type
use super::All;
/// Push an empty array onto the stack
pub const OP_PUSHBYTES_0: All = All(0x0);
/// Push the next byte as an array onto the stack
@ -560,92 +563,92 @@ impl fmt::Debug for All {
f.write_str("OP_")?;
match *self {
All(x) if x <= 75 => write!(f, "PUSHBYTES_{}", self.0),
All::OP_PUSHDATA1 => write!(f, "PUSHDATA1"),
All::OP_PUSHDATA2 => write!(f, "PUSHDATA2"),
All::OP_PUSHDATA4 => write!(f, "PUSHDATA4"),
All::OP_PUSHNUM_NEG1 => write!(f, "PUSHNUM_NEG1"),
All::OP_RESERVED => write!(f, "RESERVED"),
All(x) if x >= All::OP_PUSHNUM_1.0 && x <= All::OP_PUSHNUM_16.0 => write!(f, "PUSHNUM_{}", x - All::OP_PUSHNUM_1.0 + 1),
All::OP_NOP => write!(f, "NOP"),
All::OP_VER => write!(f, "VER"),
All::OP_IF => write!(f, "IF"),
All::OP_NOTIF => write!(f, "NOTIF"),
All::OP_VERIF => write!(f, "VERIF"),
All::OP_VERNOTIF => write!(f, "VERNOTIF"),
All::OP_ELSE => write!(f, "ELSE"),
All::OP_ENDIF => write!(f, "ENDIF"),
All::OP_VERIFY => write!(f, "VERIFY"),
All::OP_RETURN => write!(f, "RETURN"),
All::OP_TOALTSTACK => write!(f, "TOALTSTACK"),
All::OP_FROMALTSTACK => write!(f, "FROMALTSTACK"),
All::OP_2DROP => write!(f, "2DROP"),
All::OP_2DUP => write!(f, "2DUP"),
All::OP_3DUP => write!(f, "3DUP"),
All::OP_2OVER => write!(f, "2OVER"),
All::OP_2ROT => write!(f, "2ROT"),
All::OP_2SWAP => write!(f, "2SWAP"),
All::OP_IFDUP => write!(f, "IFDUP"),
All::OP_DEPTH => write!(f, "DEPTH"),
All::OP_DROP => write!(f, "DROP"),
All::OP_DUP => write!(f, "DUP"),
All::OP_NIP => write!(f, "NIP"),
All::OP_OVER => write!(f, "OVER"),
All::OP_PICK => write!(f, "PICK"),
All::OP_ROLL => write!(f, "ROLL"),
All::OP_ROT => write!(f, "ROT"),
All::OP_SWAP => write!(f, "SWAP"),
All::OP_TUCK => write!(f, "TUCK"),
All::OP_CAT => write!(f, "CAT"),
All::OP_SUBSTR => write!(f, "SUBSTR"),
All::OP_LEFT => write!(f, "LEFT"),
All::OP_RIGHT => write!(f, "RIGHT"),
All::OP_SIZE => write!(f, "SIZE"),
All::OP_INVERT => write!(f, "INVERT"),
All::OP_AND => write!(f, "AND"),
All::OP_OR => write!(f, "OR"),
All::OP_XOR => write!(f, "XOR"),
All::OP_EQUAL => write!(f, "EQUAL"),
All::OP_EQUALVERIFY => write!(f, "EQUALVERIFY"),
All::OP_RESERVED1 => write!(f, "RESERVED1"),
All::OP_RESERVED2 => write!(f, "RESERVED2"),
All::OP_1ADD => write!(f, "1ADD"),
All::OP_1SUB => write!(f, "1SUB"),
All::OP_2MUL => write!(f, "2MUL"),
All::OP_2DIV => write!(f, "2DIV"),
All::OP_NEGATE => write!(f, "NEGATE"),
All::OP_ABS => write!(f, "ABS"),
All::OP_NOT => write!(f, "NOT"),
All::OP_0NOTEQUAL => write!(f, "0NOTEQUAL"),
All::OP_ADD => write!(f, "ADD"),
All::OP_SUB => write!(f, "SUB"),
All::OP_MUL => write!(f, "MUL"),
All::OP_DIV => write!(f, "DIV"),
All::OP_MOD => write!(f, "MOD"),
All::OP_LSHIFT => write!(f, "LSHIFT"),
All::OP_RSHIFT => write!(f, "RSHIFT"),
All::OP_BOOLAND => write!(f, "BOOLAND"),
All::OP_BOOLOR => write!(f, "BOOLOR"),
All::OP_NUMEQUAL => write!(f, "NUMEQUAL"),
All::OP_NUMEQUALVERIFY => write!(f, "NUMEQUALVERIFY"),
All::OP_NUMNOTEQUAL => write!(f, "NUMNOTEQUAL"),
All::OP_LESSTHAN => write!(f, "LESSTHAN "),
All::OP_GREATERTHAN => write!(f, "GREATERTHAN "),
All::OP_LESSTHANOREQUAL => write!(f, "LESSTHANOREQUAL "),
All::OP_GREATERTHANOREQUAL => write!(f, "GREATERTHANOREQUAL "),
All::OP_MIN => write!(f, "MIN"),
All::OP_MAX => write!(f, "MAX"),
All::OP_WITHIN => write!(f, "WITHIN"),
All::OP_RIPEMD160 => write!(f, "RIPEMD160"),
All::OP_SHA1 => write!(f, "SHA1"),
All::OP_SHA256 => write!(f, "SHA256"),
All::OP_HASH160 => write!(f, "HASH160"),
All::OP_HASH256 => write!(f, "HASH256"),
All::OP_CODESEPARATOR => write!(f, "CODESEPARATOR"),
All::OP_CHECKSIG => write!(f, "CHECKSIG"),
All::OP_CHECKSIGVERIFY => write!(f, "CHECKSIGVERIFY"),
All::OP_CHECKMULTISIG => write!(f, "CHECKMULTISIG"),
All::OP_CHECKMULTISIGVERIFY => write!(f, "CHECKMULTISIGVERIFY"),
All(x) if x >= All::OP_NOP1.0 && x <= All::OP_NOP10.0 => write!(f, "NOP{}", x - All::OP_NOP1.0 + 1),
all::OP_PUSHDATA1 => write!(f, "PUSHDATA1"),
all::OP_PUSHDATA2 => write!(f, "PUSHDATA2"),
all::OP_PUSHDATA4 => write!(f, "PUSHDATA4"),
all::OP_PUSHNUM_NEG1 => write!(f, "PUSHNUM_NEG1"),
all::OP_RESERVED => write!(f, "RESERVED"),
All(x) if x >= all::OP_PUSHNUM_1.0 && x <= all::OP_PUSHNUM_16.0 => write!(f, "PUSHNUM_{}", x - all::OP_PUSHNUM_1.0 + 1),
all::OP_NOP => write!(f, "NOP"),
all::OP_VER => write!(f, "VER"),
all::OP_IF => write!(f, "IF"),
all::OP_NOTIF => write!(f, "NOTIF"),
all::OP_VERIF => write!(f, "VERIF"),
all::OP_VERNOTIF => write!(f, "VERNOTIF"),
all::OP_ELSE => write!(f, "ELSE"),
all::OP_ENDIF => write!(f, "ENDIF"),
all::OP_VERIFY => write!(f, "VERIFY"),
all::OP_RETURN => write!(f, "RETURN"),
all::OP_TOALTSTACK => write!(f, "TOALTSTACK"),
all::OP_FROMALTSTACK => write!(f, "FROMALTSTACK"),
all::OP_2DROP => write!(f, "2DROP"),
all::OP_2DUP => write!(f, "2DUP"),
all::OP_3DUP => write!(f, "3DUP"),
all::OP_2OVER => write!(f, "2OVER"),
all::OP_2ROT => write!(f, "2ROT"),
all::OP_2SWAP => write!(f, "2SWAP"),
all::OP_IFDUP => write!(f, "IFDUP"),
all::OP_DEPTH => write!(f, "DEPTH"),
all::OP_DROP => write!(f, "DROP"),
all::OP_DUP => write!(f, "DUP"),
all::OP_NIP => write!(f, "NIP"),
all::OP_OVER => write!(f, "OVER"),
all::OP_PICK => write!(f, "PICK"),
all::OP_ROLL => write!(f, "ROLL"),
all::OP_ROT => write!(f, "ROT"),
all::OP_SWAP => write!(f, "SWAP"),
all::OP_TUCK => write!(f, "TUCK"),
all::OP_CAT => write!(f, "CAT"),
all::OP_SUBSTR => write!(f, "SUBSTR"),
all::OP_LEFT => write!(f, "LEFT"),
all::OP_RIGHT => write!(f, "RIGHT"),
all::OP_SIZE => write!(f, "SIZE"),
all::OP_INVERT => write!(f, "INVERT"),
all::OP_AND => write!(f, "AND"),
all::OP_OR => write!(f, "OR"),
all::OP_XOR => write!(f, "XOR"),
all::OP_EQUAL => write!(f, "EQUAL"),
all::OP_EQUALVERIFY => write!(f, "EQUALVERIFY"),
all::OP_RESERVED1 => write!(f, "RESERVED1"),
all::OP_RESERVED2 => write!(f, "RESERVED2"),
all::OP_1ADD => write!(f, "1ADD"),
all::OP_1SUB => write!(f, "1SUB"),
all::OP_2MUL => write!(f, "2MUL"),
all::OP_2DIV => write!(f, "2DIV"),
all::OP_NEGATE => write!(f, "NEGATE"),
all::OP_ABS => write!(f, "ABS"),
all::OP_NOT => write!(f, "NOT"),
all::OP_0NOTEQUAL => write!(f, "0NOTEQUAL"),
all::OP_ADD => write!(f, "ADD"),
all::OP_SUB => write!(f, "SUB"),
all::OP_MUL => write!(f, "MUL"),
all::OP_DIV => write!(f, "DIV"),
all::OP_MOD => write!(f, "MOD"),
all::OP_LSHIFT => write!(f, "LSHIFT"),
all::OP_RSHIFT => write!(f, "RSHIFT"),
all::OP_BOOLAND => write!(f, "BOOLAND"),
all::OP_BOOLOR => write!(f, "BOOLOR"),
all::OP_NUMEQUAL => write!(f, "NUMEQUAL"),
all::OP_NUMEQUALVERIFY => write!(f, "NUMEQUALVERIFY"),
all::OP_NUMNOTEQUAL => write!(f, "NUMNOTEQUAL"),
all::OP_LESSTHAN => write!(f, "LESSTHAN "),
all::OP_GREATERTHAN => write!(f, "GREATERTHAN "),
all::OP_LESSTHANOREQUAL => write!(f, "LESSTHANOREQUAL "),
all::OP_GREATERTHANOREQUAL => write!(f, "GREATERTHANOREQUAL "),
all::OP_MIN => write!(f, "MIN"),
all::OP_MAX => write!(f, "MAX"),
all::OP_WITHIN => write!(f, "WITHIN"),
all::OP_RIPEMD160 => write!(f, "RIPEMD160"),
all::OP_SHA1 => write!(f, "SHA1"),
all::OP_SHA256 => write!(f, "SHA256"),
all::OP_HASH160 => write!(f, "HASH160"),
all::OP_HASH256 => write!(f, "HASH256"),
all::OP_CODESEPARATOR => write!(f, "CODESEPARATOR"),
all::OP_CHECKSIG => write!(f, "CHECKSIG"),
all::OP_CHECKSIGVERIFY => write!(f, "CHECKSIGVERIFY"),
all::OP_CHECKMULTISIG => write!(f, "CHECKMULTISIG"),
all::OP_CHECKMULTISIGVERIFY => write!(f, "CHECKMULTISIGVERIFY"),
All(x) if x >= all::OP_NOP1.0 && x <= all::OP_NOP10.0 => write!(f, "NOP{}", x - all::OP_NOP1.0 + 1),
All(x) => write!(f, "RETURN_{}", x),
}
}
@ -656,34 +659,34 @@ impl All {
#[inline]
pub fn classify(&self) -> Class {
// 17 opcodes
if *self == All::OP_VERIF || *self == All::OP_VERNOTIF ||
*self == All::OP_CAT || *self == All::OP_SUBSTR ||
*self == All::OP_LEFT || *self == All::OP_RIGHT ||
*self == All::OP_INVERT || *self == All::OP_AND ||
*self == All::OP_OR || *self == All::OP_XOR ||
*self == All::OP_2MUL || *self == All::OP_2DIV ||
*self == All::OP_MUL || *self == All::OP_DIV || *self == All::OP_MOD ||
*self == All::OP_LSHIFT || *self == All::OP_RSHIFT {
if *self == all::OP_VERIF || *self == all::OP_VERNOTIF ||
*self == all::OP_CAT || *self == all::OP_SUBSTR ||
*self == all::OP_LEFT || *self == all::OP_RIGHT ||
*self == all::OP_INVERT || *self == all::OP_AND ||
*self == all::OP_OR || *self == all::OP_XOR ||
*self == all::OP_2MUL || *self == all::OP_2DIV ||
*self == all::OP_MUL || *self == all::OP_DIV || *self == all::OP_MOD ||
*self == all::OP_LSHIFT || *self == all::OP_RSHIFT {
Class::IllegalOp
// 11 opcodes
} else if *self == All::OP_NOP ||
(All::OP_NOP1.0 <= self.0 &&
self.0 <= All::OP_NOP10.0) {
} else if *self == all::OP_NOP ||
(all::OP_NOP1.0 <= self.0 &&
self.0 <= all::OP_NOP10.0) {
Class::NoOp
// 75 opcodes
} else if *self == All::OP_RESERVED || *self == All::OP_VER || *self == All::OP_RETURN ||
*self == All::OP_RESERVED1 || *self == All::OP_RESERVED2 ||
self.0 >= All::OP_RETURN_186.0 {
} else if *self == all::OP_RESERVED || *self == all::OP_VER || *self == all::OP_RETURN ||
*self == all::OP_RESERVED1 || *self == all::OP_RESERVED2 ||
self.0 >= all::OP_RETURN_186.0 {
Class::ReturnOp
// 1 opcode
} else if *self == All::OP_PUSHNUM_NEG1 {
} else if *self == all::OP_PUSHNUM_NEG1 {
Class::PushNum(-1)
// 16 opcodes
} else if All::OP_PUSHNUM_1.0 <= self.0 &&
self.0 <= All::OP_PUSHNUM_16.0 {
Class::PushNum(1 + self.0 as i32 - All::OP_PUSHNUM_1.0 as i32)
} else if all::OP_PUSHNUM_1.0 <= self.0 &&
self.0 <= all::OP_PUSHNUM_16.0 {
Class::PushNum(1 + self.0 as i32 - all::OP_PUSHNUM_1.0 as i32)
// 76 opcodes
} else if self.0 <= All::OP_PUSHBYTES_75.0 {
} else if self.0 <= all::OP_PUSHBYTES_75.0 {
Class::PushBytes(self.0 as u32)
// 60 opcodes
} else {
@ -733,13 +736,13 @@ impl serde::Serialize for All {
}
/// Empty stack is also FALSE
pub static OP_FALSE: All = All::OP_PUSHBYTES_0;
pub static OP_FALSE: All = all::OP_PUSHBYTES_0;
/// Number 1 is also TRUE
pub static OP_TRUE: All = All::OP_PUSHNUM_1;
pub static OP_TRUE: All = all::OP_PUSHNUM_1;
/// check locktime verify
pub static OP_CLTV: All = All::OP_NOP2;
pub static OP_CLTV: All = all::OP_NOP2;
/// check sequence verify
pub static OP_CSV: All = All::OP_NOP3;
pub static OP_CSV: All = all::OP_NOP3;
/// Broad categories of opcodes with similar behavior
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
@ -776,14 +779,14 @@ macro_rules! ordinary_opcode {
#[doc(hidden)]
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
pub enum Ordinary {
$( $op = All::$op.0 ),*
$( $op = all::$op.0 ),*
}
impl Ordinary {
/// Try to create from an All
pub fn try_from_all(b: All) -> Option<Self> {
match b {
$( All::$op => { Some(Ordinary::$op) } ),*
$( all::$op => { Some(Ordinary::$op) } ),*
_ => None,
}
}

View File

@ -58,7 +58,7 @@ impl fmt::Debug for Script {
n as usize
} else {
match opcode {
opcodes::All::OP_PUSHDATA1 => {
opcodes::all::OP_PUSHDATA1 => {
if self.0.len() < index + 1 {
f.write_str("<unexpected end>")?;
break;
@ -68,7 +68,7 @@ impl fmt::Debug for Script {
Err(_) => { f.write_str("<bad length>")?; break; }
}
}
opcodes::All::OP_PUSHDATA2 => {
opcodes::all::OP_PUSHDATA2 => {
if self.0.len() < index + 2 {
f.write_str("<unexpected end>")?;
break;
@ -78,7 +78,7 @@ impl fmt::Debug for Script {
Err(_) => { f.write_str("<bad length>")?; break; }
}
}
opcodes::All::OP_PUSHDATA4 => {
opcodes::all::OP_PUSHDATA4 => {
if self.0.len() < index + 4 {
f.write_str("<unexpected end>")?;
break;
@ -94,7 +94,7 @@ impl fmt::Debug for Script {
if index > 1 { f.write_str(" ")?; }
// Write the opcode
if opcode == opcodes::All::OP_PUSHBYTES_0 {
if opcode == opcodes::all::OP_PUSHBYTES_0 {
f.write_str("OP_0")?;
} else {
write!(f, "{:?}", opcode)?;
@ -304,9 +304,9 @@ impl Script {
/// Compute the P2SH output corresponding to this redeem script
pub fn to_p2sh(&self) -> Script {
Builder::new().push_opcode(opcodes::All::OP_HASH160)
Builder::new().push_opcode(opcodes::all::OP_HASH160)
.push_slice(&Hash160::from_data(&self.0)[..])
.push_opcode(opcodes::All::OP_EQUAL)
.push_opcode(opcodes::all::OP_EQUAL)
.into_script()
}
@ -326,52 +326,52 @@ impl Script {
#[inline]
pub fn is_p2sh(&self) -> bool {
self.0.len() == 23 &&
self.0[0] == opcodes::All::OP_HASH160.into_u8() &&
self.0[1] == opcodes::All::OP_PUSHBYTES_20.into_u8() &&
self.0[22] == opcodes::All::OP_EQUAL.into_u8()
self.0[0] == opcodes::all::OP_HASH160.into_u8() &&
self.0[1] == opcodes::all::OP_PUSHBYTES_20.into_u8() &&
self.0[22] == opcodes::all::OP_EQUAL.into_u8()
}
/// Checks whether a script pubkey is a p2pkh output
#[inline]
pub fn is_p2pkh(&self) -> bool {
self.0.len() == 25 &&
self.0[0] == opcodes::All::OP_DUP.into_u8() &&
self.0[1] == opcodes::All::OP_HASH160.into_u8() &&
self.0[2] == opcodes::All::OP_PUSHBYTES_20.into_u8() &&
self.0[23] == opcodes::All::OP_EQUALVERIFY.into_u8() &&
self.0[24] == opcodes::All::OP_CHECKSIG.into_u8()
self.0[0] == opcodes::all::OP_DUP.into_u8() &&
self.0[1] == opcodes::all::OP_HASH160.into_u8() &&
self.0[2] == opcodes::all::OP_PUSHBYTES_20.into_u8() &&
self.0[23] == opcodes::all::OP_EQUALVERIFY.into_u8() &&
self.0[24] == opcodes::all::OP_CHECKSIG.into_u8()
}
/// Checks whether a script pubkey is a p2pkh output
#[inline]
pub fn is_p2pk(&self) -> bool {
(self.0.len() == 67 &&
self.0[0] == opcodes::All::OP_PUSHBYTES_65.into_u8() &&
self.0[66] == opcodes::All::OP_CHECKSIG.into_u8())
self.0[0] == opcodes::all::OP_PUSHBYTES_65.into_u8() &&
self.0[66] == opcodes::all::OP_CHECKSIG.into_u8())
|| (self.0.len() == 35 &&
self.0[0] == opcodes::All::OP_PUSHBYTES_33.into_u8() &&
self.0[34] == opcodes::All::OP_CHECKSIG.into_u8())
self.0[0] == opcodes::all::OP_PUSHBYTES_33.into_u8() &&
self.0[34] == opcodes::all::OP_CHECKSIG.into_u8())
}
/// Checks whether a script pubkey is a p2wsh output
#[inline]
pub fn is_v0_p2wsh(&self) -> bool {
self.0.len() == 34 &&
self.0[0] == opcodes::All::OP_PUSHBYTES_0.into_u8() &&
self.0[1] == opcodes::All::OP_PUSHBYTES_32.into_u8()
self.0[0] == opcodes::all::OP_PUSHBYTES_0.into_u8() &&
self.0[1] == opcodes::all::OP_PUSHBYTES_32.into_u8()
}
/// Checks whether a script pubkey is a p2wpkh output
#[inline]
pub fn is_v0_p2wpkh(&self) -> bool {
self.0.len() == 22 &&
self.0[0] == opcodes::All::OP_PUSHBYTES_0.into_u8() &&
self.0[1] == opcodes::All::OP_PUSHBYTES_20.into_u8()
self.0[0] == opcodes::all::OP_PUSHBYTES_0.into_u8() &&
self.0[1] == opcodes::all::OP_PUSHBYTES_20.into_u8()
}
/// Check if this is an OP_RETURN output
pub fn is_op_return (&self) -> bool {
!self.0.is_empty() && (opcodes::All::from(self.0[0]) == opcodes::All::OP_RETURN)
!self.0.is_empty() && (opcodes::All::from(self.0[0]) == opcodes::all::OP_RETURN)
}
/// Whether a script can be proven to have no satisfying input
@ -722,18 +722,18 @@ mod test {
script = script.push_slice("NRA4VR".as_bytes()); comp.extend([6u8, 78, 82, 65, 52, 86, 82].iter().cloned()); assert_eq!(&script[..], &comp[..]);
// opcodes
script = script.push_opcode(opcodes::All::OP_CHECKSIG); comp.push(0xACu8); assert_eq!(&script[..], &comp[..]);
script = script.push_opcode(opcodes::All::OP_CHECKSIG); comp.push(0xACu8); assert_eq!(&script[..], &comp[..]);
script = script.push_opcode(opcodes::all::OP_CHECKSIG); comp.push(0xACu8); assert_eq!(&script[..], &comp[..]);
script = script.push_opcode(opcodes::all::OP_CHECKSIG); comp.push(0xACu8); assert_eq!(&script[..], &comp[..]);
}
#[test]
fn script_builder() {
// from txid 3bb5e6434c11fb93f64574af5d116736510717f2c595eb45b52c28e31622dfff which was in my mempool when I wrote the test
let script = Builder::new().push_opcode(opcodes::All::OP_DUP)
.push_opcode(opcodes::All::OP_HASH160)
let script = Builder::new().push_opcode(opcodes::all::OP_DUP)
.push_opcode(opcodes::all::OP_HASH160)
.push_slice(&hex_decode("16e1ae70ff0fa102905d4af297f6912bda6cce19").unwrap())
.push_opcode(opcodes::All::OP_EQUALVERIFY)
.push_opcode(opcodes::All::OP_CHECKSIG)
.push_opcode(opcodes::all::OP_EQUALVERIFY)
.push_opcode(opcodes::all::OP_CHECKSIG)
.into_script();
assert_eq!(&format!("{:x}", script), "76a91416e1ae70ff0fa102905d4af297f6912bda6cce1988ac");
}
@ -884,7 +884,7 @@ mod test {
v_min,
vec![
Instruction::PushBytes(&[105]),
Instruction::Op(opcodes::All::OP_NOP3),
Instruction::Op(opcodes::all::OP_NOP3),
]
);
@ -899,7 +899,7 @@ mod test {
v_nonmin_alt,
vec![
Instruction::PushBytes(&[105, 0]),
Instruction::Op(opcodes::All::OP_NOP3),
Instruction::Op(opcodes::all::OP_NOP3),
]
);
@ -913,7 +913,7 @@ mod test {
let script_1 = Builder::new().push_slice(&[1,2,3,4]).into_script();
let script_2 = Builder::new().push_int(10).into_script();
let script_3 = Builder::new().push_int(15).into_script();
let script_4 = Builder::new().push_opcode(opcodes::All::OP_RETURN).into_script();
let script_4 = Builder::new().push_opcode(opcodes::all::OP_RETURN).into_script();
assert!(script_1 < script_2);
assert!(script_2 < script_3);

View File

@ -212,21 +212,21 @@ impl Address {
Payload::Pubkey(ref pk) => {
script::Builder::new()
.push_slice(&pk.serialize_uncompressed()[..])
.push_opcode(opcodes::All::OP_CHECKSIG)
.push_opcode(opcodes::all::OP_CHECKSIG)
},
Payload::PubkeyHash(ref hash) => {
script::Builder::new()
.push_opcode(opcodes::All::OP_DUP)
.push_opcode(opcodes::All::OP_HASH160)
.push_opcode(opcodes::all::OP_DUP)
.push_opcode(opcodes::all::OP_HASH160)
.push_slice(&hash[..])
.push_opcode(opcodes::All::OP_EQUALVERIFY)
.push_opcode(opcodes::All::OP_CHECKSIG)
.push_opcode(opcodes::all::OP_EQUALVERIFY)
.push_opcode(opcodes::all::OP_CHECKSIG)
},
Payload::ScriptHash(ref hash) => {
script::Builder::new()
.push_opcode(opcodes::All::OP_HASH160)
.push_opcode(opcodes::all::OP_HASH160)
.push_slice(&hash[..])
.push_opcode(opcodes::All::OP_EQUAL)
.push_opcode(opcodes::all::OP_EQUAL)
},
Payload::WitnessProgram(ref witprog) => {
script::Builder::new()