remove usage of instanced Scripts

This commit is contained in:
Daniel Cousens 2015-08-07 16:30:24 +10:00
parent 5d2abb523e
commit e743c58ed6
11 changed files with 146 additions and 119 deletions

View file

@ -19,9 +19,9 @@ describe('Transaction', function () {
if (txIn.data) {
var data = new Buffer(txIn.data, 'hex')
script = new Script(data, [])
script = data
} else if (txIn.script) {
script = Script.fromASM(txIn.script)
script = Script.fromASM(txIn.script).buffer
}
tx.addInput(txHash, txIn.index, txIn.sequence, script)
@ -32,9 +32,9 @@ describe('Transaction', function () {
if (txOut.data) {
var data = new Buffer(txOut.data, 'hex')
script = new Script(data, [])
script = data
} else if (txOut.script) {
script = Script.fromASM(txOut.script)
script = Script.fromASM(txOut.script).buffer
}
tx.addOutput(script, txOut.value)
@ -102,7 +102,7 @@ describe('Transaction', function () {
var tx = new Transaction()
tx.addInput(prevTxHash, 0)
assert.strictEqual(tx.ins[0].script, Script.EMPTY)
assert.strictEqual(tx.ins[0].script.length, 0)
})
fixtures.invalid.addInput.forEach(function (f) {
@ -120,8 +120,8 @@ describe('Transaction', function () {
describe('addOutput', function () {
it('returns an index', function () {
var tx = new Transaction()
assert.strictEqual(tx.addOutput(Script.EMPTY, 0), 0)
assert.strictEqual(tx.addOutput(Script.EMPTY, 0), 1)
assert.strictEqual(tx.addOutput(new Buffer(0), 0), 0)
assert.strictEqual(tx.addOutput(new Buffer(0), 0), 1)
})
})