Use write_all to write whole buffer

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.
This commit is contained in:
Tobin C. Harding 2022-05-31 12:15:16 +10:00
parent 51c60b8507
commit a6efe982bd
1 changed files with 1 additions and 1 deletions

View File

@ -353,7 +353,7 @@ impl Transaction {
// will result in the data written to the writer being hashed, however the correct // 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 // handling of the SIGHASH_SINGLE bug is to return the 'one array' - either implement
// this behaviour manually or use `signature_hash()`. // 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(()) return Ok(())
} }