Many cleanups to Transaction, see detailed.

Default-ize the sequence rather than use a number, and default to bytes
for input. I doubt anybody ever uses this anyways.

Remove weird convenience code, and remove wallet logic. Checking a TX's
affects on a wallet should be managed by the wallet object.

Remove parsing for the weirder SIGHASH types. People use this library
for creating SIGHASH_ALL transactions, and I don't see the need to
support these other types at the moment since this library's more used
for wallets than for hardcore bitcoin tx analysis/creation. They weren't
tested anyways.

Add note about potentially improving performance by providing
pubkey/address. Deriving from the private key is slower, that
information should probably be cached by the end user.
This commit is contained in:
Kyle Drake 2014-03-20 15:40:07 -07:00
commit 28e146431c
No known key found for this signature in database
GPG key ID: 8BE721072E1864BE
2 changed files with 10 additions and 206 deletions

View file

@ -36,7 +36,7 @@ describe('Transaction', function() {
assert.equal(tx.ins.length, 1)
var input = tx.ins[0]
assert.equal(input.sequence, 4294967295)
assert.deepEqual(input.sequence, [255, 255, 255, 255])
assert.equal(input.outpoint.index, 0)
assert.equal(input.outpoint.hash, "69d02fc05c4e0ddc87e796eee42693c244a3112fffe1f762c3fb61ffcb304634")
@ -98,7 +98,7 @@ describe('Transaction', function() {
assert.equal(tx.ins.length, 1)
var input = tx.ins[0]
assert.equal(input.sequence, 4294967295)
assert.deepEqual(input.sequence, [255, 255, 255, 255])
assert.equal(input.outpoint.index, 0)
assert.equal(input.outpoint.hash, "0cb859105100ebc3344f749c835c7af7d7103ec0d8cbc3d8ccbd5d28c3c36b57")