Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/cjs/block.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class Block {
if (buffer.length < 80) throw new Error('Buffer too small (< 80 bytes)');
const bufferReader = new bufferutils_js_1.BufferReader(buffer);
const block = new Block();
block.version = bufferReader.readInt32();
block.version = bufferReader.readUInt32();
block.prevHash = bufferReader.readSlice(32);
block.merkleRoot = bufferReader.readSlice(32);
block.timestamp = bufferReader.readUInt32();
Expand Down Expand Up @@ -184,7 +184,7 @@ class Block {
toBuffer(headersOnly) {
const buffer = new Uint8Array(this.byteLength(headersOnly));
const bufferWriter = new bufferutils_js_1.BufferWriter(buffer);
bufferWriter.writeInt32(this.version);
bufferWriter.writeUInt32(this.version);
bufferWriter.writeSlice(this.prevHash);
bufferWriter.writeSlice(this.merkleRoot);
bufferWriter.writeUInt32(this.timestamp);
Expand Down
4 changes: 2 additions & 2 deletions src/esm/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class Block {
if (buffer.length < 80) throw new Error('Buffer too small (< 80 bytes)');
const bufferReader = new BufferReader(buffer);
const block = new Block();
block.version = bufferReader.readInt32();
block.version = bufferReader.readUInt32();
block.prevHash = bufferReader.readSlice(32);
block.merkleRoot = bufferReader.readSlice(32);
block.timestamp = bufferReader.readUInt32();
Expand Down Expand Up @@ -142,7 +142,7 @@ export class Block {
toBuffer(headersOnly) {
const buffer = new Uint8Array(this.byteLength(headersOnly));
const bufferWriter = new BufferWriter(buffer);
bufferWriter.writeInt32(this.version);
bufferWriter.writeUInt32(this.version);
bufferWriter.writeSlice(this.prevHash);
bufferWriter.writeSlice(this.merkleRoot);
bufferWriter.writeUInt32(this.timestamp);
Expand Down
4 changes: 2 additions & 2 deletions ts_src/block.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class Block {
const bufferReader = new BufferReader(buffer);

const block = new Block();
block.version = bufferReader.readInt32();
block.version = bufferReader.readUInt32();
block.prevHash = bufferReader.readSlice(32);
block.merkleRoot = bufferReader.readSlice(32);
block.timestamp = bufferReader.readUInt32();
Expand Down Expand Up @@ -175,7 +175,7 @@ export class Block {

const bufferWriter = new BufferWriter(buffer);

bufferWriter.writeInt32(this.version);
bufferWriter.writeUInt32(this.version);
bufferWriter.writeSlice(this.prevHash!);
bufferWriter.writeSlice(this.merkleRoot!);
bufferWriter.writeUInt32(this.timestamp);
Expand Down