Rename OP_NOP2 and OP_NOP3 to OP_CLTV and OP_CSV

This commit is contained in:
Steven Roose 2019-06-13 18:56:18 +01:00
parent 330e0fd587
commit d2923b7cce
No known key found for this signature in database
GPG Key ID: 2F2A88D7F8D68E87
2 changed files with 14 additions and 12 deletions

View File

@ -399,10 +399,10 @@ pub mod all {
pub const OP_CHECKMULTISIGVERIFY: All = All {code: 0xaf}; pub const OP_CHECKMULTISIGVERIFY: All = All {code: 0xaf};
/// Does nothing /// Does nothing
pub const OP_NOP1: All = All {code: 0xb0}; pub const OP_NOP1: All = All {code: 0xb0};
/// Does nothing /// https://github.com/bitcoin/bips/blob/master/bip-0065.mediawiki
pub const OP_NOP2: All = All {code: 0xb1}; pub const OP_CLTV: All = All {code: 0xb1};
/// Does nothing /// https://github.com/bitcoin/bips/blob/master/bip-0112.mediawiki
pub const OP_NOP3: All = All {code: 0xb2}; pub const OP_CSV: All = All {code: 0xb2};
/// Does nothing /// Does nothing
pub const OP_NOP4: All = All {code: 0xb3}; pub const OP_NOP4: All = All {code: 0xb3};
/// Does nothing /// Does nothing
@ -650,6 +650,8 @@ impl fmt::Debug for All {
all::OP_CHECKSIGVERIFY => write!(f, "CHECKSIGVERIFY"), all::OP_CHECKSIGVERIFY => write!(f, "CHECKSIGVERIFY"),
all::OP_CHECKMULTISIG => write!(f, "CHECKMULTISIG"), all::OP_CHECKMULTISIG => write!(f, "CHECKMULTISIG"),
all::OP_CHECKMULTISIGVERIFY => write!(f, "CHECKMULTISIGVERIFY"), all::OP_CHECKMULTISIGVERIFY => write!(f, "CHECKMULTISIGVERIFY"),
all::OP_CLTV => write!(f, "CLTV"),
all::OP_CSV => write!(f, "CSV"),
All {code: x} if x >= all::OP_NOP1.code && x <= all::OP_NOP10.code => write!(f, "NOP{}", x - all::OP_NOP1.code + 1), All {code: x} if x >= all::OP_NOP1.code && x <= all::OP_NOP10.code => write!(f, "NOP{}", x - all::OP_NOP1.code + 1),
All {code: x} => write!(f, "RETURN_{}", x), All {code: x} => write!(f, "RETURN_{}", x),
} }
@ -741,10 +743,10 @@ impl serde::Serialize for All {
pub static OP_FALSE: All = all::OP_PUSHBYTES_0; pub static OP_FALSE: All = all::OP_PUSHBYTES_0;
/// Number 1 is also TRUE /// 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 /// previously called OP_NOP2
pub static OP_CLTV: All = all::OP_NOP2; pub static OP_NOP2: All = all::OP_CLTV;
/// check sequence verify /// previously called OP_NOP3
pub static OP_CSV: All = all::OP_NOP3; pub static OP_NOP3: All = all::OP_CSV;
/// Broad categories of opcodes with similar behavior /// Broad categories of opcodes with similar behavior
#[derive(Copy, Clone, PartialEq, Eq, Debug)] #[derive(Copy, Clone, PartialEq, Eq, Debug)]
@ -1031,8 +1033,8 @@ mod tests {
roundtrip!(unique, OP_CHECKMULTISIG); roundtrip!(unique, OP_CHECKMULTISIG);
roundtrip!(unique, OP_CHECKMULTISIGVERIFY); roundtrip!(unique, OP_CHECKMULTISIGVERIFY);
roundtrip!(unique, OP_NOP1); roundtrip!(unique, OP_NOP1);
roundtrip!(unique, OP_NOP2); roundtrip!(unique, OP_CLTV);
roundtrip!(unique, OP_NOP3); roundtrip!(unique, OP_CSV);
roundtrip!(unique, OP_NOP4); roundtrip!(unique, OP_NOP4);
roundtrip!(unique, OP_NOP5); roundtrip!(unique, OP_NOP5);
roundtrip!(unique, OP_NOP6); roundtrip!(unique, OP_NOP6);

View File

@ -909,7 +909,7 @@ mod test {
v_min, v_min,
vec![ vec![
Instruction::PushBytes(&[105]), Instruction::PushBytes(&[105]),
Instruction::Op(opcodes::all::OP_NOP3), Instruction::Op(opcodes::OP_NOP3),
] ]
); );
@ -924,7 +924,7 @@ mod test {
v_nonmin_alt, v_nonmin_alt,
vec![ vec![
Instruction::PushBytes(&[105, 0]), Instruction::PushBytes(&[105, 0]),
Instruction::Op(opcodes::all::OP_NOP3), Instruction::Op(opcodes::OP_NOP3),
] ]
); );