Skip to content

Commit

Permalink
Use write_all to write whole buffer
Browse files Browse the repository at this point in the history
A better way to write a byte string is to use write all so that
`ErrorKind::Interupted` is not returned.

Use `write_all` to write the non-sense (error indication) string to the
writer when we hit the SIGHASH_SINGLE bug.
  • Loading branch information
tcharding committed May 31, 2022
1 parent 51c60b8 commit a6efe98
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/blockdata/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ impl Transaction {
// will result in the data written to the writer being hashed, however the correct
// handling of the SIGHASH_SINGLE bug is to return the 'one array' - either implement
// this behaviour manually or use `signature_hash()`.
let _ = writer.write(b"[not a transaction] SIGHASH_SINGLE bug")?;
writer.write_all(b"[not a transaction] SIGHASH_SINGLE bug")?;
return Ok(())
}

Expand Down

0 comments on commit a6efe98

Please sign in to comment.