Merge pull request #1 from runn1ng/patch-1

Correcting addresses for multibyte versions
This commit is contained in:
str4d 2016-12-07 11:38:56 +13:00 committed by GitHub
commit 208069bee8
1 changed files with 2 additions and 1 deletions

View File

@ -460,7 +460,8 @@ Address.prototype.isPayToScriptHash = function() {
* @returns {Buffer} Bitcoin address buffer
*/
Address.prototype.toBuffer = function() {
var version = new Buffer([this.network[this.type]]);
var version = new Buffer(2);
version.writeUInt16BE(this.network[this.type], 0);
var buf = Buffer.concat([version, this.hashBuffer]);
return buf;
};