parent
d2b790fef9
commit
45e55a07b0
2 changed files with 37 additions and 8 deletions
|
@ -458,6 +458,7 @@ Transaction.deserialize = function(buffer) {
|
|||
});
|
||||
}
|
||||
obj.locktime = readAsInt(4);
|
||||
|
||||
return new Transaction(obj);
|
||||
}
|
||||
|
||||
|
@ -539,6 +540,8 @@ var TransactionIn = function (data) {
|
|||
|
||||
if (data.scriptSig)
|
||||
this.script = Script.fromScriptSig(data.scriptSig)
|
||||
else if (data.script)
|
||||
this.script = data.script
|
||||
else
|
||||
this.script = new Script(data.script)
|
||||
|
||||
|
|
26
test/transaction.js
Normal file
26
test/transaction.js
Normal file
|
@ -0,0 +1,26 @@
|
|||
var Transaction = require('../src/transaction.js').Transaction
|
||||
var convert = require('../src/convert.js')
|
||||
var assert = require('assert')
|
||||
|
||||
describe('Transaction', function() {
|
||||
describe('deserialize', function() {
|
||||
var tx, serializedTx
|
||||
beforeEach(function() {
|
||||
serializedTx = [
|
||||
'0100000001344630cbff61fbc362f7e1ff2f11a344c29326e4ee96e78',
|
||||
'7dc0d4e5cc02fd069000000004a493046022100ef89701f460e8660c8',
|
||||
'0808a162bbf2d676f40a331a243592c36d6bd1f81d6bdf022100d29c0',
|
||||
'72f1b18e59caba6e1f0b8cadeb373fd33a25feded746832ec179880c2',
|
||||
'3901ffffffff0100f2052a010000001976a914dd40dedd8f7e3746662',
|
||||
'4c4dacc6362d8e7be23dd88ac00000000'
|
||||
].join('')
|
||||
})
|
||||
|
||||
it('works', function() {
|
||||
var actual = Transaction.deserialize(serializedTx).serialize()
|
||||
var expected = convert.hexToBytes(serializedTx)
|
||||
assert.deepEqual(actual, expected)
|
||||
})
|
||||
})
|
||||
|
||||
})
|
Loading…
Add table
Reference in a new issue