Browse Source

Address: fix consistent casing

hk-custom-address
Daniel Cousens 11 years ago
parent
commit
be29f50457
  1. 8
      src/address.js
  2. 2
      test/fixtures/address.json

8
src/address.js

@ -11,7 +11,7 @@ function findScriptTypeByVersion(queryVersion) {
var version = network[versionName] var version = network[versionName]
if (version === queryVersion) { if (version === queryVersion) {
return versionName return versionName.toLowerCase()
} }
} }
} }
@ -62,14 +62,14 @@ Address.prototype.toBase58Check = function () {
Address.prototype.toScriptPubKey = function() { Address.prototype.toScriptPubKey = function() {
var scriptType = findScriptTypeByVersion(this.version) var scriptType = findScriptTypeByVersion(this.version)
if (scriptType === 'pubKeyHash') { if (scriptType === 'pubkeyhash') {
return templates.createPubKeyHashScriptPubKey(this.hash) return templates.createPubKeyHashScriptPubKey(this.hash)
} else if (scriptType === 'scriptHash') { } else if (scriptType === 'scripthash') {
return templates.createP2SHScriptPubKey(this.hash) return templates.createP2SHScriptPubKey(this.hash)
} }
assert(false, this.toString() + ' has no matching script') assert(false, this.toString() + ' has no matching Script')
} }
Address.prototype.toString = Address.prototype.toBase58Check Address.prototype.toString = Address.prototype.toBase58Check

2
test/fixtures/address.json

@ -62,7 +62,7 @@
], ],
"toScriptPubKey": [ "toScriptPubKey": [
{ {
"description": "24kPZCmVgzfkpGdXExy56234MRHrsqQxNWE has no matching script", "description": "24kPZCmVgzfkpGdXExy56234MRHrsqQxNWE has no matching Script",
"hex": "751e76e8199196d454941c45d1b3a323f1433bd6", "hex": "751e76e8199196d454941c45d1b3a323f1433bd6",
"version": 153 "version": 153
} }

Loading…
Cancel
Save