Connection: default value for sendGetBlocks
This commit is contained in:
parent
e130a3fe4b
commit
9d53ef5106
|
@ -186,10 +186,15 @@ Connection.prototype.sendVersion = function () {
|
|||
};
|
||||
|
||||
Connection.prototype.sendGetBlocks = function (starts, stop, wantHeaders) {
|
||||
var put = new Put();
|
||||
put.word32le(this.sendVer);
|
||||
// Default value for stop is 0 to get as many blocks as possible (500)
|
||||
stop = stop || '00000000000000000000000000000000';
|
||||
|
||||
var put = new Put();
|
||||
|
||||
// https://en.bitcoin.it/wiki/Protocol_specification#getblocks
|
||||
put.word32le(this.sendVer);
|
||||
put.varint(starts.length);
|
||||
|
||||
for (var i = 0; i < starts.length; i++) {
|
||||
if (starts[i].length != 32) {
|
||||
throw new Error('Invalid hash length');
|
||||
|
@ -443,8 +448,8 @@ Connection.prototype.parseMessage = function (command, payload) {
|
|||
data.headers = [];
|
||||
for (i = 0; i < data.count; i++) {
|
||||
var header = new Block();
|
||||
header.parse(parser);
|
||||
data.headers.push(header);
|
||||
header.parse(parser);
|
||||
data.headers.push(header);
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
Loading…
Reference in New Issue