Merge pull request #493 from stevenroose/sighash-no-result
Revert the sighash method signatures
This commit is contained in:
commit
926cff0741
|
@ -397,10 +397,11 @@ impl Transaction {
|
||||||
input_index: usize,
|
input_index: usize,
|
||||||
script_pubkey: &Script,
|
script_pubkey: &Script,
|
||||||
sighash_u32: u32
|
sighash_u32: u32
|
||||||
) -> Result<SigHash, encode::Error> {
|
) -> SigHash {
|
||||||
let mut engine = SigHash::engine();
|
let mut engine = SigHash::engine();
|
||||||
self.encode_signing_data_to(&mut engine, input_index, script_pubkey, sighash_u32)?;
|
self.encode_signing_data_to(&mut engine, input_index, script_pubkey, sighash_u32)
|
||||||
Ok(SigHash::from_engine(engine))
|
.expect("engines don't error");
|
||||||
|
SigHash::from_engine(engine)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Gets the "weight" of this transaction, as defined by BIP141. For transactions with an empty
|
/// Gets the "weight" of this transaction, as defined by BIP141. For transactions with an empty
|
||||||
|
@ -897,7 +898,7 @@ mod tests {
|
||||||
raw_expected.reverse();
|
raw_expected.reverse();
|
||||||
let expected_result = SigHash::from_slice(&raw_expected[..]).unwrap();
|
let expected_result = SigHash::from_slice(&raw_expected[..]).unwrap();
|
||||||
|
|
||||||
let actual_result = tx.signature_hash(input_index, &script, hash_type as u32).unwrap();
|
let actual_result = tx.signature_hash(input_index, &script, hash_type as u32);
|
||||||
assert_eq!(actual_result, expected_result);
|
assert_eq!(actual_result, expected_result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -231,10 +231,11 @@ impl<R: Deref<Target=Transaction>> SigHashCache<R> {
|
||||||
script_code: &Script,
|
script_code: &Script,
|
||||||
value: u64,
|
value: u64,
|
||||||
sighash_type: SigHashType
|
sighash_type: SigHashType
|
||||||
) -> Result<SigHash, encode::Error> {
|
) -> SigHash {
|
||||||
let mut enc = SigHash::engine();
|
let mut enc = SigHash::engine();
|
||||||
self.encode_signing_data_to(&mut enc, input_index, script_code, value, sighash_type)?;
|
self.encode_signing_data_to(&mut enc, input_index, script_code, value, sighash_type)
|
||||||
Ok(SigHash::from_engine(enc))
|
.expect("engines don't error");
|
||||||
|
SigHash::from_engine(enc)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -292,7 +293,7 @@ mod tests {
|
||||||
let expected_result = SigHash::from_slice(&raw_expected[..]).unwrap();
|
let expected_result = SigHash::from_slice(&raw_expected[..]).unwrap();
|
||||||
let mut cache = SigHashCache::new(&tx);
|
let mut cache = SigHashCache::new(&tx);
|
||||||
let sighash_type = SigHashType::from_u32(hash_type);
|
let sighash_type = SigHashType::from_u32(hash_type);
|
||||||
let actual_result = cache.signature_hash(input_index, &script, value, sighash_type).unwrap();
|
let actual_result = cache.signature_hash(input_index, &script, value, sighash_type);
|
||||||
assert_eq!(actual_result, expected_result);
|
assert_eq!(actual_result, expected_result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue