I think it is important we maintain some reasoning that an Input script
is actually a script signature, but in the end, these names are more
coherent and understandable when reasoning with our code. So I think
its OK we break tradition with bitcoind.
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.
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.
A Transaction (and its subsequent scripts) do not carry any network
specific information in the Bitcoin protocol.
Therefore they can not (without further context) produce the network
specific constants for the generation of the base58 Addresses.
As TransactionOut.address is used heavily throughout Wallet and other
areas of the library, this could not be entirely removed without a large
number of changes.
For now, TransactionOut.address is only defined in the case of
Tx.addOutput being used directly:
Transaction.addOutput(address, value)
Extracts the two Script types out of Script.createOutputScript, and puts
them both under test.
Also renames Script.createMultiSigOutputScript to adhere to the same
convention.
These functions are not under test, and are unnecessary bloat due to a
confusing API.
Script.from*(asmStr) were two functions that attempted to parse ASM
codes and produce a script from this.
While useful, an parser can be introduced later under a single function
and under test... removed.
Although Script.extractPublicKeys implementation is likely to be correct,
it is not absolute in that what it returns is even strictly a set of
public keys.
It is a useful function, but can be done in a better way later,
probably checking against the Script templates instead.
Transaction.signWithKeys has some inherent undocumented behaviour, and it is not
clear when you would use it over just Transaction.addOutput and
Transaction.sign individually. Nor does it mimic anything in the
bitcoind API... removed.
To keep this change minimal, both TxIn/TxOut still use the parameter
object for initialization. TxOut accepts only the types it uses
internally, and not hex or byte arrays for scripts.
The clone is unnecessary as a TransactionOut is never mutated after its
creation.
This resulted in TransactionOut.scriptPubKey no longer being needed,
and was removed. To access the scriptPubKey as a byte buffer, a user
can simply use:
TransactionOut.script.toBuffer()
Unfortunately, this leaves TransactionOut in a sorry state of test.
Something that needs to be fixed.