Undefined is treated as zero if it ever gets to this point anyway, so no
value is added by having this default param here.
A test fixture to verify this behaviour is added.
Taken from browserify-buffer.
Also adds a few more tests to assert this is working correctly from both
read and write perspectives.
The assertion in for writePushDataInt in the 32 bit case was
unnecessary as that is handled by buffer.writeUInt32LE anyway.
The definition of a dust amount is pretty clear, and I feel it is less
readable when represented as isDust(amount) or !isDust(amount), by
comparison to amount <= dustThreshold or amount > dustThreshold.
Also means I don't have to stray my eyes to understand the
implemention by looking up isDust does.
Adds asserts to ensure only valid hashes are created (until the
implementation is complete).
Also uses `Script.without` to remove OP_CODESEPARATOR from the Scripts
as required by the protocol.
To save on us building a hash map with which to check the inputs,
instead I just ensure that the order of the inputs is the same as it is
in the serialized transaction.
Also fixes the bug when the sequence number is 0 and
`TransactionIn.defaultSequence` is used; resulting in an undefined
sequence number as it is undefined.
All the `invalid2` tests have been removed as they were not invalid
base58check. They were actually valid in some cases.
They will be re-integrated in more specific bitcoin core tests in
relation to Address/ECKey respectively.
By removing Address.Error, we remove a code smell.
This part of the code base was also not under any form of test.
Test data and tests have therefore been added verifying its behaviour in
both Wallet and Address tests.