Transaction/Script: bitcoin network no longer implied

A Transaction (and its subsequent scripts) do not carry any network
specific information in the Bitcoin protocol.
Therefore they can not (without further context) produce the network
specific constants for the generation of the base58 Addresses.

As TransactionOut.address is used heavily throughout Wallet and other
areas of the library, this could not be entirely removed without a large
number of changes.
For now, TransactionOut.address is only defined in the case of
Tx.addOutput being used directly:

      Transaction.addOutput(address, value)
This commit is contained in:
Daniel Cousens 2014-05-06 16:52:31 +10:00
parent 4207a0df99
commit 708aa03390
6 changed files with 47 additions and 142 deletions

View file

@ -116,25 +116,6 @@ describe('Script', function() {
})
})
describe('getToAddress', function() {
it('works for p2sh type output', function() {
var script = Script.fromHex(p2shScriptPubKey)
assert.equal(script.getToAddress().toString(), '3NukJ6fYZJ5Kk8bPjycAnruZkE5Q7UW7i8')
})
it('works for pubkey type output', function() {
var script = Script.fromHex(pubKeyScriptPubKey)
assert.equal(script.getToAddress().toString(), '19E6FV3m3kEPoJD5Jz6dGKdKwTVvjsWUvu')
})
})
describe('getFromAddress', function() {
it('works for address type input', function() {
var script = Script.fromHex(addressScriptSig)
assert.equal(script.getFromAddress().toString(), '1BBjuhF2jHxu7tPinyQGCuaNhEs6f5u59u')
})
})
describe('2-of-3 Multi-Signature', function() {
var pubKeys