Variable length integer IntBuffer fix
https://en.bitcoin.it/wiki/Protocol_documentation#Variable_length_integer Blocks with amount of transactions > 65535 will be rejected. Fixed now
This commit is contained in:
parent
02e78da1ab
commit
25f65352a0
@ -76,12 +76,12 @@ exports.varIntBuffer = function(n){
|
|||||||
if (n < 0xfd)
|
if (n < 0xfd)
|
||||||
return new Buffer([n]);
|
return new Buffer([n]);
|
||||||
else if (n < 0xffff){
|
else if (n < 0xffff){
|
||||||
var buff = new Buffer(3);
|
var buff <= new Buffer(3);
|
||||||
buff[0] = 0xfd;
|
buff[0] = 0xfd;
|
||||||
buff.writeUInt16LE(n, 1);
|
buff.writeUInt16LE(n, 1);
|
||||||
return buff;
|
return buff;
|
||||||
}
|
}
|
||||||
else if (n < 0xffffffff){
|
else if (n <= 0xffffffff){
|
||||||
var buff = new Buffer(5);
|
var buff = new Buffer(5);
|
||||||
buff[0] = 0xfe;
|
buff[0] = 0xfe;
|
||||||
buff.writeUInt32LE(n, 1);
|
buff.writeUInt32LE(n, 1);
|
||||||
@ -373,4 +373,4 @@ exports.convertBitsToBuff = function(bitsBuff){
|
|||||||
|
|
||||||
exports.getTruncatedDiff = function(shift){
|
exports.getTruncatedDiff = function(shift){
|
||||||
return exports.convertBitsToBuff(exports.bufferToCompactBits(exports.shiftMax256Right(shift)));
|
return exports.convertBitsToBuff(exports.bufferToCompactBits(exports.shiftMax256Right(shift)));
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user