|
|
@ -153,7 +153,7 @@ function Version(subversion, nonce) { |
|
|
|
this.version = PROTOCOL_VERSION; |
|
|
|
this.subversion = subversion || '/BitcoinX:0.1/'; |
|
|
|
this.nonce = nonce || CONNECTION_NONCE; |
|
|
|
}; |
|
|
|
} |
|
|
|
util.inherits(Version, Message); |
|
|
|
|
|
|
|
Version.prototype.fromBuffer = function(payload) { |
|
|
@ -352,7 +352,7 @@ function Alert() { |
|
|
|
} |
|
|
|
util.inherits(Alert, Message); |
|
|
|
|
|
|
|
Alert.prototype.fromBuffer = function() { |
|
|
|
Alert.prototype.fromBuffer = function(payload) { |
|
|
|
var parser = new BufferReader(payload); |
|
|
|
this.payload = parser.readVarintBuf(); // TODO: Use current format
|
|
|
|
this.signature = parser.readVarintBuf(); |
|
|
@ -376,12 +376,12 @@ function Headers(blockheaders) { |
|
|
|
} |
|
|
|
util.inherits(Headers, Message); |
|
|
|
|
|
|
|
Headers.prototype.fromBuffer = function() { |
|
|
|
Headers.prototype.fromBuffer = function(payload) { |
|
|
|
var parser = new BufferReader(payload); |
|
|
|
var count = parser.readVarintNum(); |
|
|
|
|
|
|
|
this.headers = []; |
|
|
|
for (i = 0; i < count; i++) { |
|
|
|
for (var i = 0; i < count; i++) { |
|
|
|
var header = Block().fromBufferReader(parser); |
|
|
|
this.headers.push(header); |
|
|
|
} |
|
|
@ -406,7 +406,7 @@ function Block(block) { |
|
|
|
} |
|
|
|
util.inherits(Block, Message); |
|
|
|
|
|
|
|
Block.prototype.fromBuffer = function() { |
|
|
|
Block.prototype.fromBuffer = function(payload) { |
|
|
|
var parser = new BufferReader(payload); |
|
|
|
this.block = Block().fromBufferReader(parser); |
|
|
|
return this; |
|
|
@ -429,7 +429,7 @@ function Transaction(transaction) { |
|
|
|
} |
|
|
|
util.inherits(Transaction, Message); |
|
|
|
|
|
|
|
Transaction.prototype.fromBuffer = function() { |
|
|
|
Transaction.prototype.fromBuffer = function(payload) { |
|
|
|
var parser = new BufferReader(payload); |
|
|
|
this.transaction = Transaction().fromBufferReader(parser); |
|
|
|
return this; |
|
|
@ -455,7 +455,7 @@ function GetBlocks(starts, stop) { |
|
|
|
} |
|
|
|
util.inherits(GetBlocks, Message); |
|
|
|
|
|
|
|
GetBlocks.prototype.fromBuffer = function() { |
|
|
|
GetBlocks.prototype.fromBuffer = function(payload) { |
|
|
|
var parser = new BufferReader(payload); |
|
|
|
this.version = parser.readUInt32LE(); |
|
|
|
|
|
|
|