Commit Graph

29 Commits

Author SHA1 Message Date
Braydon Fuller f1d19b438e Transaction: Added replace-by-fee (RBF) support
- Useful for bidding transactions as described in: https://bitpay.com/chaindb.pdf
- Reference: nSequence-based opt-in: https://github.com/bitcoin/bitcoin/pull/6871
2015-12-03 02:12:12 -05:00
Zaki Manian aa8e548800 To be effective within the current Bitcoin network, the inputs to a transaction
with an nLocktime must be not the standard max value.

We set the sequence number of 0 if the value is max.

Currently sequence numbers other than MAX_INT32 have no meaning in the Bitcoin protocol
but this may change in future BIPS
2015-08-24 20:07:57 -07:00
Braydon Fuller a50fccef4d Changes behavior of `toJSON` to work as expected with `JSON.stringify`
- see: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#toJSON%28%29_behavior
- Updates CONTRIBUTING with changes to Stardard Methods
- Aliases toJSON for toObject
- Removes all `fromJSON` methods, and many cases replaces with `fromObject`
- Constructors expect an object parsed via `JSON.parse` for JSON input
2015-08-13 10:46:08 -04:00
Patrick Nagurny 0dec8e7bd8 Merge pull request #1294 from braydonf/tx-unmodified-arguments
Objects passed as arguments are unmodified.
2015-07-30 10:16:00 -04:00
Braydon Fuller d9047eebf0 Detect if scriptSig (input) or scriptPubKey (output) is previously known. 2015-07-09 11:30:20 -04:00
Braydon Fuller 3d1dc7aafe Objects passed as arguments are unmodified. 2015-07-06 19:32:34 -04:00
Esteban Ordano 4280b993e0 Add CLTV (BIP65) support 2015-07-01 18:46:54 -07:00
Braydon Fuller 458abe069e Fixed issue with handling invalid output scripts
- Changed toObject serialization to always use a hexa string for a script
- Updated inspect method to handle a null script
- Roundtrip toObject/fromObject with an invalid script
- Additional test coverage for Output
2015-05-14 01:50:14 -04:00
Kirill Fomichev 346b2af446 delete writable for accessor property 2015-05-10 23:55:55 +03:00
Manuel Araoz d556a0c33d fix regressions 2015-04-29 18:55:42 -03:00
Manuel Araoz dfc075e5d1 fix block parsing problem 2015-04-29 17:29:33 -03:00
Manuel Araoz dff0891871 add failing test for Block#toObject 2015-04-28 15:17:41 -03:00
Manuel Araoz b92fd915eb increase coverage for Input and Output, fix some bugs 2015-02-27 18:46:27 -03:00
Manuel Araoz aa1158097d fix bug in change calculation 2015-02-10 18:12:45 -03:00
Esteban Ordano 4781c4328f Better error message on unsupported input types 2015-02-06 10:14:41 -03:00
Manuel Araoz c664f211d2 add BufferReader.readVarLengthBuffer 2015-02-04 13:04:55 -03:00
Yemel Jardi e57d02c03c Use define immutable helper 2015-01-08 10:57:46 -03:00
Esteban Ordano 9a73338c91 Add tests for changes to Transaction interface 2014-12-18 20:38:19 -03:00
Esteban Ordano e5631b1a69 Modify transaction interface
* Add checks when serializing
* Add default _estimateSize to generic inputs
* Fix multisig size estimation
* Change _addOutput to addOutput
* Add addInput and using that internally
* Split `getFee` out from `_updateChangeOutput`
2014-12-18 14:09:44 -03:00
Esteban Ordano 9f442e8ec4 Merge pull request #777 from maraoz/add/tx_invalid/tests
add tx_invalid.json tests
2014-12-16 23:13:59 -03:00
Manuel Araoz 84deec297a add tx_invalid tests 2014-12-16 22:40:59 -03:00
Esteban Ordano f7f7d147c6 Add change features 2014-12-16 22:39:25 -03:00
Manuel Araoz 49192a1ed7 style change to BufferUtil 2014-12-16 13:33:57 -03:00
Esteban Ordano de4d2884c7 Modify Transaction to use Multisig
* Allow `Script#add` to add a Script causing concatenation of opcodes
* Add `Script#equals` to compare scripts
* Add `Script#fromAddress`
* Drop `_payTo` methods
* Add `Script.buildP2SHMultisigIn`

Greatly simplifying the internal transaction object
2014-12-15 18:19:54 -03:00
Esteban Ordano af43228daf Add `PublicKeyHashInput` and `ScriptHashInput`.
Remove `_outpoints`, `_utxos` from Transaction, as that info
can be efficiently retrieved from the inputs
2014-12-15 18:19:39 -03:00
Braydon Fuller ad4bc9324f Transaction: Use Script toString for transaction JSON output 2014-12-13 14:54:07 -05:00
Braydon Fuller b544b0594d Added test to check that Transaction fromJSON could initialize from toJSON, and fixed a bug. 2014-12-13 14:54:07 -05:00
Braydon Fuller 002eb3dcf5 Transaction: Added toObject method and changed toJSON to return a string 2014-12-12 19:03:14 -05:00
Esteban Ordano ef49dda0fd Move input to subfolder before refactor
Gonna inherit from it on two subclasses: "P2SH Input" and "P2PKH Input"

They'll have a `addSignature` method, to deal with new signatures,
a `clearSignatures`, in case the outputs change and the signatures get
invalidated, `countMissingSignatures`, and a reference to the UTXO
they'll be spending, so all logic regarding "p2sh mapping" gets to
be in here and the Transaction class is not polluted.
2014-12-11 09:18:20 -03:00