Commit graph

67 commits

Author SHA1 Message Date
Daniel Cousens
884fd542fe Transaction: deprecate Tx signing methods 2014-08-16 17:36:06 +10:00
Daniel Cousens
8eaf44881a Transaction: improve hash length checking + tests 2014-06-17 20:18:39 +10:00
Daniel Cousens
d07cfccbc1 Transaction: move constants to Transaction 2014-06-17 12:26:14 +10:00
Daniel Cousens
4850570955 Transaction: remove untestable assert
Also changes the fromBuffer sanity test to use a clearer message that is
taken from the fixtures.
2014-06-17 12:24:35 +10:00
Daniel Cousens
1b1b550bd6 Transaction: add hash as addInput parameter 2014-06-17 12:23:27 +10:00
Daniel Cousens
0b17c2bc3d Transaction: re-adds getHash as a pure hash 2014-06-17 12:22:13 +10:00
Daniel Cousens
6c9f95c253 Transaction: add sequence parameter to addInput 2014-06-17 12:21:09 +10:00
Daniel Cousens
6ea89eeaae Transaction: data driven tests 2014-06-17 11:55:43 +10:00
Daniel Cousens
c0e5393595 Transaction: remove .outpoint object 2014-06-16 14:21:40 +10:00
Daniel Cousens
203d6c7116 Transaction: add test for clone 2014-06-16 14:21:40 +10:00
Daniel Cousens
d567463588 Transaction: remove estimateFee
This is a wallet abstraction.
2014-06-16 14:21:39 +10:00
Daniel Cousens
009fcb9b82 Transaction: now returns index of added input/output 2014-06-16 14:21:39 +10:00
Daniel Cousens
4f995fcae1 Transaction: tests should show unboxing of parameters 2014-06-16 14:21:39 +10:00
Daniel Cousens
3b3d19974c tests: avoid b2h where toHex exists 2014-06-16 14:21:39 +10:00
Daniel Cousens
66636f56bb Transaction: test hex formatting 2014-06-16 14:21:39 +10:00
Daniel Cousens
6ac3803483 Transaction: move test to proper section 2014-06-16 14:21:39 +10:00
Daniel Cousens
3b6f0bb9b3 Transaction: fix test name 2014-06-16 14:21:39 +10:00
Daniel Cousens
f85792ba22 Transaction: remove address from txOut 2014-06-16 14:21:39 +10:00
Daniel Cousens
5551c38812 Transaction: use hash Buffer instead of hex string 2014-06-16 14:21:39 +10:00
Daniel Cousens
bdc7131d0e Transaction: renames getHash to getId
In turn also removes the inherent calculation of tx.hash after deserialization.
2014-06-16 14:21:39 +10:00
Daniel Cousens
867465a03f Transaction: support non-addressable output scripts 2014-06-16 14:21:38 +10:00
Daniel Cousens
5bd636cab7 Transaction: remove TxIn/TxOut from API 2014-06-16 14:21:38 +10:00
Daniel Cousens
a6b9dd9473 Transaction: remove hash:index notation 2014-06-16 14:21:38 +10:00
Daniel Cousens
8b5647b0b9 Transaction: remove TxIn/TxOut exports 2014-06-16 14:21:38 +10:00
Daniel Cousens
b0317be4d5 tests: formatting 2014-06-16 14:21:38 +10:00
Daniel Cousens
7e5af52cd1 Transaction: mass rename from SPK/SS to Input/Output
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.
2014-06-13 11:36:31 +10:00
Daniel Cousens
41c3b68293 templates: rename to scripts 2014-06-13 10:52:07 +10:00
Daniel Cousens
00cec9ce64 Script: move all templates to templates.js 2014-06-13 10:52:07 +10:00
Daniel Cousens
9a72c7437b Script: adds Script.EMPTY constant 2014-06-13 10:49:08 +10:00
Daniel Cousens
2dec1375a1 ecdsa: use (r, s) values directly 2014-05-24 00:48:31 +10:00
Daniel Cousens
0468c4710c Transaction: rename (de)serialize to [to/from]Buffer 2014-05-17 00:09:13 +10:00
Daniel Cousens
55681e7e5d Script: use PubKey objects not prebuilt Buffers 2014-05-17 00:09:13 +10:00
Daniel Cousens
6c0eebe94b tests: use filepaths directly
After a long IRC discussion, it was decided that the use of direct
filepaths instead of the module is a more pure form of testing ,
although it may provide less overall coverage than the mixed integration
style imports used previously.

This will need to be remedied by further integration testing in
/test/integration.
2014-05-13 18:05:56 +10:00
Daniel Cousens
7a740c2e7b tests: forces consistent import syntax 2014-05-13 16:46:08 +10:00
Daniel Cousens
f18c5e4c1e Script: removes Script.createP2SHMultiSigScriptSig
It is favoured to compose the scriptSig manually using
Script.createP2SHScriptSig and Script.createMultisigScriptSig.

Added a test to verify that createMultisigScriptSig throws when not
enough signatures a provided and the redeemScript is given.
2014-05-09 16:26:35 +10:00
Daniel Cousens
f8e662e495 Script: rename toScriptHash to getHash and add tests 2014-05-09 13:07:06 +10:00
Daniel Cousens
708aa03390 Transaction/Script: bitcoin network no longer implied
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)
2014-05-08 10:59:58 +10:00
Daniel Cousens
0822def7e0 Script: add standard Script.create*ScriptPubKey
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.
2014-05-08 10:59:58 +10:00
Daniel Cousens
57b8afbdab Network: rename Network to Networks
This change removes the most common ambiguities.
As the network module is not representative of a class, the lower case
has been used.
2014-05-08 10:59:58 +10:00
Daniel Cousens
76323a07d0 Transaction: restrict TxIn/TxOut constructor params
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.
2014-05-08 10:59:58 +10:00
Daniel Cousens
a77846701f Fixes network support for TxOut 2014-05-06 15:40:40 +10:00
Daniel Cousens
4012b82bec Fixes Transaction.addOutput(Address, Number) 2014-05-06 15:40:40 +10:00
Daniel Cousens
baa568697b Transaction.deserialize no longer mutates input 2014-05-05 09:11:37 +10:00
Daniel Cousens
a8cf2fdd9e Changes internal serialization to use Buffers instead 2014-05-04 17:31:22 +10:00
Daniel Cousens
10ee5532c3 Serialize now returns a buffer 2014-05-04 15:37:25 +10:00
Daniel Cousens
09c6a787d9 Changes sequence number to an actual Number 2014-05-04 15:37:25 +10:00
Wei Lu
70219c877b Fixes signScriptSig test 2014-04-26 13:39:26 +08:00
Daniel Cousens
8ad8f6f169 Renames p2shsign to signScriptSig 2014-04-26 03:51:13 +10:00
Daniel Cousens
fbf8211cab Adds tests for TX.prototype.p2shsign 2014-04-26 03:51:13 +10:00
Daniel Cousens
1c52f9f3d8 Removes convert module 2014-04-26 03:51:13 +10:00