cryptocoinjs / btc-transaction

Create, parse, serialize Bitcoin transactions.
11 stars 8 forks source link

Bugfix - reversing byte order for value #5

Closed sidazhang closed 10 years ago

sidazhang commented 10 years ago

Value bytes should be reversed in new TransactionOut(data) so that it is LE

The correct example is demonstrated here: https://github.com/cryptocoinjs/btc-transaction/blob/master/lib/transaction.js#L132

I have included tests to make sure that the

  1. byte order is correct
  2. new TransactionOut() and Transaction.addOutput() produce the same byte order
sidazhang commented 10 years ago

@MidnightLightning,

https://github.com/cryptocoinjs/btc-transaction/commit/5daede028f63a9a605bc2ec83d4c44895d030cb3

This latest commit fixes the issue we discussed earlier. valueOf only supports up to 32 bit integer and so we should always convert to string first and then initialize biginteger

sidazhang commented 10 years ago

https://github.com/cryptocoinjs/btc-transaction/commit/461e17826b9d6436222bd8ce9de4efa748747d86

Reversing the value bytes when calculating output and tests.

@MidnightLightning @jprichardson Can I get an ack on these series of bugfixes?

sidazhang commented 10 years ago

Just ack from jp I will merge this.