Fixed address object creation bug

This commit is contained in:
vub 2013-10-08 07:13:05 -04:00
parent 2bfa783be2
commit b41a4ecb91
3 changed files with 4 additions and 4 deletions

4
bitcoinjs-min.js vendored

File diff suppressed because one or more lines are too long

View file

@ -14,7 +14,7 @@ var p2sh_types = {
var Address = function (bytes) { var Address = function (bytes) {
if (typeof bytes === 'string') { if (typeof bytes === 'string') {
this.hash = base58.decode(bytes); this.hash = base58.checkDecode(bytes);
this.version = this.hash.version; this.version = this.hash.version;
} }
else { else {

View file

@ -312,7 +312,7 @@ Script.createOutputScript = function (address)
{ {
var script = new Script(); var script = new Script();
// Standard pay-to-pubkey-hash // Standard pay-to-pubkey-hash
if (address.version == 0) { if (!address.version) {
script.writeOp(Opcode.map.OP_DUP); script.writeOp(Opcode.map.OP_DUP);
script.writeOp(Opcode.map.OP_HASH160); script.writeOp(Opcode.map.OP_HASH160);
script.writeBytes(address.hash); script.writeBytes(address.hash);