From 526f9fc57415949e34949df471851abb5666a21c Mon Sep 17 00:00:00 2001 From: Andrew Poelstra Date: Tue, 12 Aug 2014 20:56:16 -0700 Subject: [PATCH] Remove -all- CODESEPARATORS before serializing the script, even though only one has effect I can validate the whole testnet chain now :) onto P2SH! --- src/blockdata/script.rs | 225 ++++++++++++++++----------------------- src/blockdata/utxoset.rs | 2 +- src/util/misc.rs | 9 +- 3 files changed, 102 insertions(+), 134 deletions(-) diff --git a/src/blockdata/script.rs b/src/blockdata/script.rs index 00aaa4e..65231d4 100644 --- a/src/blockdata/script.rs +++ b/src/blockdata/script.rs @@ -643,6 +643,7 @@ impl Script { let mut remove = Script::new(); remove.push_slice(sig_slice); script_find_and_remove(&mut script, remove.as_slice()); + script_find_and_remove(&mut script, [opcodes::OP_CODESEPARATOR as u8]); // This is as far as we can go without a transaction, so fail here if input_context.is_none() { return Err(NoTransaction); } @@ -692,6 +693,7 @@ impl Script { let mut remove = Script::new(); remove.push_slice(sig.as_slice()); script_find_and_remove(&mut script, remove.as_slice()); + script_find_and_remove(&mut script, [opcodes::OP_CODESEPARATOR as u8]); } // This is as far as we can go without a transaction, so fail here @@ -781,6 +783,27 @@ mod test { use blockdata::transaction::Transaction; use util::thinvec::ThinVec; + fn test_tx(tx_hex: &'static str, output_hex: Vec<&'static str>) { + let tx_hex = tx_hex.from_hex().unwrap(); + + let tx: Transaction = deserialize(tx_hex.clone()).ok().expect("transaction"); + let script_pk: Vec