Commit Graph

27 Commits

Author SHA1 Message Date
Braydon Fuller
116ddac345 If skipMagic is enabled do not set the magic or size on the block, the values would have been incorrect. 2015-01-17 00:07:09 -05:00
Braydon Fuller
38b8c211f3 Fix jshint complaints. 2015-01-17 00:07:09 -05:00
Esteban Ordano
b416655222 block serialization: Add option skip magic numbers 2015-01-17 00:07:09 -05:00
Esteban Ordano
2a084e641c Coverage for block and blockheader
* JSDocs where already good, written by @braydonf
2014-12-19 16:37:57 -03:00
Manuel Aráoz
9f51b1b4ce Merge pull request #772 from braydonf/docs/block
Block: Updated documentation, and changed to use consistent naming.
2014-12-17 11:58:22 -03:00
Manuel Araoz
84deec297a add tx_invalid tests 2014-12-16 22:40:59 -03:00
Braydon Fuller
d86e718743 Block: Updated documentation, and changed to use consistent naming. 2014-12-16 18:19:27 -05:00
Esteban Ordano
d4b8c4adc6 Remove globals 2014-12-16 17:30:43 -03:00
Esteban Ordano
4433bd422b Refactor gulpfile 2014-12-16 17:21:41 -03:00
Esteban Ordano
63f1d307fa Reviewing docs 2014-12-16 02:45:23 -03:00
Braydon Fuller
f43c2f9aa3 Fixed bug, toObject should use other object's toObject 2014-12-13 14:54:07 -05:00
Braydon Fuller
19a17017a9 Block: Added toObject method and changed toJSON to return a string 2014-12-12 18:34:43 -05:00
Braydon Fuller
162438d111 Block: Change utility naming 2014-12-12 12:06:39 -05:00
Braydon Fuller
3276236cce Consistent names for utilities 2014-12-12 12:06:39 -05:00
Braydon Fuller
94cc10b1a3 Changed *Json to *JSON and returned an object so that methods can be called from other toJSON methods without the double-stringification issue. 2014-12-12 12:06:39 -05:00
Braydon Fuller
1858766627 Standardized toJSON, fromJSON, toString and fromString interfaces 2014-12-12 09:51:59 -05:00
Esteban Ordano
1579eed9af Consistency with "id", "hash", and "_getHash" 2014-12-10 15:20:42 -03:00
Esteban Ordano
5c974a8ef2 Refactor transaction to match new API
* Refactor transaction into a different subfolder
* Added a lot of tests for sighash and transaction serialization (from
  reddit's and Ryan X. Charles' `fullnode`)
* Drop "only" from sighash tests and consolidate logs
2014-12-10 12:44:30 -03:00
Braydon Fuller
5d1da9802c Block: Added validation of proof of work, merkle tree and other interface changes. Closes #601 2014-12-08 14:51:43 -05:00
Manuel Araoz
4508fb6765 fix references to encoding 2014-11-21 12:54:56 -03:00
Manuel Araoz
ca9b8d8f7b use strict to protocol 2014-11-20 12:52:32 -03:00
Ryan X. Charles
e984736736 allow bufs in constructors
For Transaction, Block and Blockheader. This is a convenience so if you happen
to have the buffer for one of these, you can make a new one like this:

Transaction(txbuf);

Rather than having to do this:

Transaction().fromBuffer(txbuf);
2014-09-22 13:07:39 -07:00
Ryan X. Charles
cc3196085f add .hash() function for a block
This is the plain old hash, which is a double sha256. The id of a block is the
reverse of this.
2014-09-19 17:29:40 -07:00
Ryan X. Charles
40d17c5180 block id
The block id is the reverse of the double sha256 hash of the blockheader.
2014-09-19 17:08:44 -07:00
Ryan X. Charles
e11019a083 toJSON, fromJSON
Every object should have toJSON and fromJSON methods so you can have a reliable
way to store and retrieve objects.
2014-09-18 17:52:02 -07:00
Ryan X. Charles
6494ca5076 convenience: varint -> vi 2014-09-17 15:27:12 -07:00
Ryan X. Charles
8a52e6c316 Block 2014-09-16 18:42:11 -07:00