From a6efe982bd642fa873267656cacaa5ace77185a4 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Tue, 31 May 2022 12:15:16 +1000 Subject: [PATCH] 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. --- src/blockdata/transaction.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/blockdata/transaction.rs b/src/blockdata/transaction.rs index 5488486d..a39dcd84 100644 --- a/src/blockdata/transaction.rs +++ b/src/blockdata/transaction.rs @@ -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(()) }