mirror of
https://github.com/bitcoinj/bitcoinj.git
synced 2025-02-24 22:58:32 +01:00
Fix #292 by &'ing sigHashType to treat it as unsigned.
This commit is contained in:
parent
3211fe59f3
commit
38d01e14a6
1 changed files with 2 additions and 2 deletions
|
@ -869,8 +869,8 @@ public class Transaction extends ChildMessage implements Serializable {
|
||||||
|
|
||||||
ByteArrayOutputStream bos = new UnsafeByteArrayOutputStream(length == UNKNOWN_LENGTH ? 256 : length + 4);
|
ByteArrayOutputStream bos = new UnsafeByteArrayOutputStream(length == UNKNOWN_LENGTH ? 256 : length + 4);
|
||||||
bitcoinSerialize(bos);
|
bitcoinSerialize(bos);
|
||||||
// We also have to write a hash type.
|
// We also have to write a hash type (sigHashType is actually an unsigned char)
|
||||||
uint32ToByteStreamLE(sigHashType, bos);
|
uint32ToByteStreamLE(0x000000ff & sigHashType, bos);
|
||||||
// Note that this is NOT reversed to ensure it will be signed correctly. If it were to be printed out
|
// Note that this is NOT reversed to ensure it will be signed correctly. If it were to be printed out
|
||||||
// however then we would expect that it is IS reversed.
|
// however then we would expect that it is IS reversed.
|
||||||
Sha256Hash hash = new Sha256Hash(doubleDigest(bos.toByteArray()));
|
Sha256Hash hash = new Sha256Hash(doubleDigest(bos.toByteArray()));
|
||||||
|
|
Loading…
Add table
Reference in a new issue