@@ -32,6 +32,12 @@ Transaction.fromBuffer = function (buffer, __noStrict) {
3232 return i
3333 }
3434
35+ function readInt32 ( ) {
36+ var i = buffer . readInt32LE ( offset )
37+ offset += 4
38+ return i
39+ }
40+
3541 function readUInt64 ( ) {
3642 var i = bufferutils . readUInt64LE ( buffer , offset )
3743 offset += 8
@@ -49,7 +55,7 @@ Transaction.fromBuffer = function (buffer, __noStrict) {
4955 }
5056
5157 var tx = new Transaction ( )
52- tx . version = readUInt32 ( )
58+ tx . version = readInt32 ( )
5359
5460 var vinLen = readVarInt ( )
5561 for ( var i = 0 ; i < vinLen ; ++ i ) {
@@ -261,10 +267,11 @@ Transaction.prototype.toBuffer = function (buffer, initialOffset) {
261267 var offset = initialOffset || 0
262268 function writeSlice ( slice ) { offset += slice . copy ( buffer , offset ) }
263269 function writeUInt32 ( i ) { offset = buffer . writeUInt32LE ( i , offset ) }
270+ function writeInt32 ( i ) { offset = buffer . writeInt32LE ( i , offset ) }
264271 function writeUInt64 ( i ) { offset = bufferutils . writeUInt64LE ( buffer , i , offset ) }
265272 function writeVarInt ( i ) { offset += bufferutils . writeVarInt ( buffer , i , offset ) }
266273
267- writeUInt32 ( this . version )
274+ writeInt32 ( this . version )
268275 writeVarInt ( this . ins . length )
269276
270277 this . ins . forEach ( function ( txIn ) {
0 commit comments