Transaction: restrict TxIn/TxOut constructor params
To keep this change minimal, both TxIn/TxOut still use the parameter object for initialization. TxOut accepts only the types it uses internally, and not hex or byte arrays for scripts. The clone is unnecessary as a TransactionOut is never mutated after its creation. This resulted in TransactionOut.scriptPubKey no longer being needed, and was removed. To access the scriptPubKey as a byte buffer, a user can simply use: TransactionOut.script.toBuffer() Unfortunately, this leaves TransactionOut in a sorry state of test. Something that needs to be fixed.
This commit is contained in:
parent
9a7e291d70
commit
76323a07d0
2 changed files with 9 additions and 42 deletions
test
|
@ -279,18 +279,6 @@ describe('Transaction', function() {
|
|||
})
|
||||
|
||||
describe('TransactionOut', function() {
|
||||
describe('scriptPubKey', function() {
|
||||
it('returns hex string', function() {
|
||||
var address = Address.fromBase58Check("1AZpKpcfCzKDUeTFBQUL4MokQai3m3HMXv")
|
||||
|
||||
var txOut = new TransactionOut({
|
||||
value: 50000,
|
||||
script: Script.createOutputScript(address)
|
||||
})
|
||||
|
||||
assert.equal(txOut.scriptPubKey(), "76a91468edf28474ee22f68dfe7e56e76c017c1701b84f88ac")
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue