uahf: input_index check is back in SignatureHash
This commit is contained in:
parent
806bd02fbd
commit
7f14f9b40d
|
@ -1,4 +1,3 @@
|
||||||
use std::cmp::max;
|
|
||||||
use hash::H256;
|
use hash::H256;
|
||||||
use {Magic, Deployment};
|
use {Magic, Deployment};
|
||||||
|
|
||||||
|
|
|
@ -235,10 +235,6 @@ impl TransactionInputSigner {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn signature_hash_witness0(&self, input_index: usize, input_amount: u64, script_pubkey: &Script, sighashtype: u32, sighash: Sighash) -> H256 {
|
fn signature_hash_witness0(&self, input_index: usize, input_amount: u64, script_pubkey: &Script, sighashtype: u32, sighash: Sighash) -> H256 {
|
||||||
self.signature_hash_fork_id(input_index, input_amount, script_pubkey, sighashtype, sighash)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn signature_hash_fork_id(&self, input_index: usize, input_amount: u64, script_pubkey: &Script, sighashtype: u32, sighash: Sighash) -> H256 {
|
|
||||||
let hash_prevouts = compute_hash_prevouts(sighash, &self.inputs);
|
let hash_prevouts = compute_hash_prevouts(sighash, &self.inputs);
|
||||||
let hash_sequence = compute_hash_sequence(sighash, &self.inputs);
|
let hash_sequence = compute_hash_sequence(sighash, &self.inputs);
|
||||||
let hash_outputs = compute_hash_outputs(sighash, input_index, &self.outputs);
|
let hash_outputs = compute_hash_outputs(sighash, input_index, &self.outputs);
|
||||||
|
@ -257,6 +253,18 @@ impl TransactionInputSigner {
|
||||||
let out = stream.out();
|
let out = stream.out();
|
||||||
dhash256(&out)
|
dhash256(&out)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn signature_hash_fork_id(&self, input_index: usize, input_amount: u64, script_pubkey: &Script, sighashtype: u32, sighash: Sighash) -> H256 {
|
||||||
|
if input_index >= self.inputs.len() {
|
||||||
|
return 1u8.into();
|
||||||
|
}
|
||||||
|
|
||||||
|
if sighash.base == SighashBase::Single && input_index >= self.outputs.len() {
|
||||||
|
return 1u8.into();
|
||||||
|
}
|
||||||
|
|
||||||
|
self.signature_hash_witness0(input_index, input_amount, script_pubkey, sighashtype, sighash)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn compute_hash_prevouts(sighash: Sighash, inputs: &[UnsignedTransactionInput]) -> H256 {
|
fn compute_hash_prevouts(sighash: Sighash, inputs: &[UnsignedTransactionInput]) -> H256 {
|
||||||
|
|
Loading…
Reference in New Issue