Transaction: mass rename from SPK/SS to Input/Output
I think it is important we maintain some reasoning that an Input script is actually a script signature, but in the end, these names are more coherent and understandable when reasoning with our code. So I think its OK we break tradition with bitcoind.
This commit is contained in:
parent
5a96df1ec1
commit
7e5af52cd1
8 changed files with 39 additions and 41 deletions
test
|
@ -38,23 +38,23 @@ describe('Address', function() {
|
|||
})
|
||||
})
|
||||
|
||||
describe('fromScriptPubKey', function() {
|
||||
describe('fromOutputScript', function() {
|
||||
fixtures.valid.forEach(function(f) {
|
||||
it('imports ' + f.description + '(' + f.network + ') correctly', function() {
|
||||
var script = Script.fromHex(f.script)
|
||||
var addr = Address.fromScriptPubKey(script, networks[f.network])
|
||||
var addr = Address.fromOutputScript(script, networks[f.network])
|
||||
|
||||
assert.equal(addr.version, f.version)
|
||||
assert.equal(addr.hash.toString('hex'), f.hex)
|
||||
})
|
||||
})
|
||||
|
||||
fixtures.invalid.fromScriptPubKey.forEach(function(f) {
|
||||
fixtures.invalid.fromOutputScript.forEach(function(f) {
|
||||
it('throws when ' + f.description, function() {
|
||||
var script = Script.fromHex(f.hex)
|
||||
|
||||
assert.throws(function() {
|
||||
Address.fromScriptPubKey(script)
|
||||
Address.fromOutputScript(script)
|
||||
}, new RegExp(f.description))
|
||||
})
|
||||
})
|
||||
|
@ -71,22 +71,22 @@ describe('Address', function() {
|
|||
})
|
||||
})
|
||||
|
||||
describe('toScriptPubKey', function() {
|
||||
describe('toOutputScript', function() {
|
||||
fixtures.valid.forEach(function(f) {
|
||||
it('imports ' + f.description + '(' + f.network + ') correctly', function() {
|
||||
var addr = Address.fromBase58Check(f.base58check)
|
||||
var script = addr.toScriptPubKey()
|
||||
var script = addr.toOutputScript()
|
||||
|
||||
assert.equal(script.toHex(), f.script)
|
||||
})
|
||||
})
|
||||
|
||||
fixtures.invalid.toScriptPubKey.forEach(function(f) {
|
||||
fixtures.invalid.toOutputScript.forEach(function(f) {
|
||||
it('throws when ' + f.description, function() {
|
||||
var addr = new Address(new Buffer(f.hex, 'hex'), f.version)
|
||||
|
||||
assert.throws(function() {
|
||||
addr.toScriptPubKey()
|
||||
addr.toOutputScript()
|
||||
}, new RegExp(f.description))
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue