3
0
mirror of https://github.com/Qortal/altcoinj.git synced 2025-02-07 06:44:16 +00:00

Close ByteArrayOutputStreams. Resolves issue 244.

This commit is contained in:
Mike Hearn 2012-08-20 16:12:49 +02:00
parent 6f6c5d6773
commit e2108d922d

View File

@ -700,6 +700,7 @@ public class Transaction extends ChildMessage implements Serializable {
bos.write(key.sign(hash.getBytes())); bos.write(key.sign(hash.getBytes()));
bos.write((hashType.ordinal() + 1) | (anyoneCanPay ? 0x80 : 0)); bos.write((hashType.ordinal() + 1) | (anyoneCanPay ? 0x80 : 0));
signatures[i] = bos.toByteArray(); signatures[i] = bos.toByteArray();
bos.close();
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(e); // Cannot happen. throw new RuntimeException(e); // Cannot happen.
} }
@ -767,6 +768,7 @@ public class Transaction extends ChildMessage implements Serializable {
// 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()));
bos.close();
// Put the transaction back to how we found it. // Put the transaction back to how we found it.
for (int i = 0; i < inputs.size(); i++) { for (int i = 0; i < inputs.size(); i++) {