Add test with transaction with no signatures

Add checks for no signature
This commit is contained in:
Stephen Akridge
2019-03-02 14:01:53 -08:00
committed by sakridge
parent 9ce2bc94bf
commit 97274030b9
2 changed files with 48 additions and 6 deletions

View File

@ -256,9 +256,11 @@ impl Transaction {
// a hash of a slice of transactions only needs to hash the signatures
pub fn hash(transactions: &[Transaction]) -> Hash {
let mut hasher = Hasher::default();
transactions
.iter()
.for_each(|tx| hasher.hash(&tx.signatures[0].as_ref()));
transactions.iter().for_each(|tx| {
if !tx.signatures.is_empty() {
hasher.hash(&tx.signatures[0].as_ref());
}
});
hasher.result()
}