From 54cc123d319a42c78200675bd7ecc74236a170e1 Mon Sep 17 00:00:00 2001 From: Daniel Cousens Date: Thu, 8 May 2014 13:28:20 +1000 Subject: [PATCH] Address/Script: consistent function ordering --- src/script.js | 14 +++++++------- test/address.js | 16 ++++++++-------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/script.js b/src/script.js index e349d48..ae59fc2 100644 --- a/src/script.js +++ b/src/script.js @@ -314,6 +314,13 @@ Script.createPubKeyHashScriptSig = function(signature, pubKey) { return script } +// {serialized scriptPubKey script} +Script.createP2SHScriptSig = function(scriptSig, scriptPubKey) { + var inScript = new Script(scriptSig.buffer) + inScript.writeBytes(scriptPubKey.buffer) + return inScript +} + // OP_0 [signatures ...] Script.createMultisigScriptSig = function(signatures, scriptPubKey) { if (scriptPubKey) { @@ -334,13 +341,6 @@ Script.createMultisigScriptSig = function(signatures, scriptPubKey) { return inScript } -// {serialized scriptPubKey script} -Script.createP2SHScriptSig = function(scriptSig, scriptPubKey) { - var inScript = new Script(scriptSig.buffer) - inScript.writeBytes(scriptPubKey.buffer) - return inScript -} - Script.prototype.clone = function() { return new Script(this.buffer) } diff --git a/test/address.js b/test/address.js index 0ec736f..6475ebb 100644 --- a/test/address.js +++ b/test/address.js @@ -22,14 +22,6 @@ describe('Address', 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) { it('imports ' + f.description + '(' + f.network + ') correctly', function() { var addr = Address.fromBase58Check(f.base58check) @@ -38,6 +30,14 @@ describe('Address', function() { 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() {