Address/Script: consistent function ordering

This commit is contained in:
Daniel Cousens 2014-05-08 13:28:20 +10:00
parent 842b075e75
commit 54cc123d31
2 changed files with 15 additions and 15 deletions

View file

@ -314,6 +314,13 @@ Script.createPubKeyHashScriptSig = function(signature, pubKey) {
return script return script
} }
// <scriptSig> {serialized scriptPubKey script}
Script.createP2SHScriptSig = function(scriptSig, scriptPubKey) {
var inScript = new Script(scriptSig.buffer)
inScript.writeBytes(scriptPubKey.buffer)
return inScript
}
// OP_0 [signatures ...] // OP_0 [signatures ...]
Script.createMultisigScriptSig = function(signatures, scriptPubKey) { Script.createMultisigScriptSig = function(signatures, scriptPubKey) {
if (scriptPubKey) { if (scriptPubKey) {
@ -334,13 +341,6 @@ Script.createMultisigScriptSig = function(signatures, scriptPubKey) {
return inScript return inScript
} }
// <scriptSig> {serialized scriptPubKey script}
Script.createP2SHScriptSig = function(scriptSig, scriptPubKey) {
var inScript = new Script(scriptSig.buffer)
inScript.writeBytes(scriptPubKey.buffer)
return inScript
}
Script.prototype.clone = function() { Script.prototype.clone = function() {
return new Script(this.buffer) return new Script(this.buffer)
} }

View file

@ -22,14 +22,6 @@ describe('Address', function() {
}) })
describe('fromBase58Check', function() { describe('fromBase58Check', function() {
it('throws on invalid base58check', function() {
b58fixtures.invalid.forEach(function(f) {
assert.throws(function() {
Address.fromBase58Check(f)
})
})
})
fixtures.valid.forEach(function(f) { fixtures.valid.forEach(function(f) {
it('imports ' + f.description + '(' + f.network + ') correctly', function() { it('imports ' + f.description + '(' + f.network + ') correctly', function() {
var addr = Address.fromBase58Check(f.base58check) var addr = Address.fromBase58Check(f.base58check)
@ -38,6 +30,14 @@ describe('Address', function() {
assert.equal(addr.hash.toString('hex'), f.hex) assert.equal(addr.hash.toString('hex'), f.hex)
}) })
}) })
it('throws on invalid base58check', function() {
b58fixtures.invalid.forEach(function(f) {
assert.throws(function() {
Address.fromBase58Check(f)
})
})
})
}) })
describe('fromScriptPubKey', function() { describe('fromScriptPubKey', function() {