mirror of
https://github.com/bitcoinj/bitcoinj.git
synced 2025-01-18 21:32:35 +01:00
BlockFileLoader, FullBlockTestGenerator: use readUint32()/writeInt32LE()
rather than manually reversing bytes
This commit is contained in:
parent
f0b69a405f
commit
90fc2bfb5e
@ -175,7 +175,7 @@ public class BlockFileLoader implements Iterable<Block>, Iterator<Block> {
|
||||
}
|
||||
byte[] bytes = new byte[4];
|
||||
currentFileStream.read(bytes, 0, 4);
|
||||
long size = ByteUtils.readUint32BE(ByteUtils.reverseBytes(bytes), 0);
|
||||
long size = ByteUtils.readUint32(bytes, 0);
|
||||
bytes = new byte[(int) size];
|
||||
currentFileStream.read(bytes, 0, (int) size);
|
||||
try {
|
||||
|
@ -195,8 +195,8 @@ public class FullBlockTestGenerator {
|
||||
ByteUtils.writeInt32BE(params.getPacketMagic(), outStream);
|
||||
byte[] block = ((BlockAndValidity) element).block.bitcoinSerialize();
|
||||
byte[] length = new byte[4];
|
||||
ByteUtils.writeInt32BE(block.length, length, 0);
|
||||
outStream.write(ByteUtils.reverseBytes(length));
|
||||
ByteUtils.writeInt32LE(block.length, length, 0);
|
||||
outStream.write(length);
|
||||
outStream.write(block);
|
||||
((BlockAndValidity)element).block = null;
|
||||
} catch (IOException e) {
|
||||
|
Loading…
Reference in New Issue
Block a user