Commit graph

14 commits

Author SHA1 Message Date
Dave Collins
6c4b5928ab goimports -w . 2014-07-02 19:29:48 -05:00
Dave Collins
2db41b1f56 Remove deprecated TxShas func from btcutil.Block.
This commit removes the previously deprecated TxShas function from
btcutil.Block.  The preferred method to access transaction hashes is via
the Sha function on each btcutil.Tx contained within the block.

For example, the following illustrates how convert the old TxShas approach
to the new method:

OLD:

for i, sha := range block.TxShas() {
	// use sha
}

NEW:

for i, tx := range block.Transactions() {
	// use tx.Sha()
}

This commit also updates the tests for the removed function.
2014-03-24 13:56:43 -05:00
David Hill
ca515e278d gofmt 2014-02-04 16:15:14 -05:00
Dave Collins
4edc4ceb9e Update for recent btcwire API changes. 2014-01-18 20:59:07 -06:00
Dave Collins
2af3c8263a Add 2014 to copyright dates. 2014-01-08 23:46:05 -06:00
Dave Collins
93e46b9ffd Add tests for new Block API functions.
This commit adds both positive and negative tests for the new Tx and
Transactions Block API functions.

This is part of the ongoing transaction hash optimization effort noted in
conformal/btcd#25.
2013-10-28 10:55:55 -05:00
Dave Collins
ad7e3894c7 Allow var def to infer type from right-hand side.
Found by golint.
2013-08-06 12:37:20 -05:00
Dave Collins
43095c66bc Remove dependency on protocol version.
This commit unfortunately changes the public API of Block which I
ordinarily don't like to do, but in this case, I felt it was necessary.

The blocks used throughout the database and elsewhere should be indepedent
of the protocol version which is used to encode the block to wire format.
Each block has its own Version field which should be the deciding factor
for the serialization and deserialization of blocks.  In practice, they
are currently the same encoding, but that may not always be the case, and
it's important the blocks are stable depending on their own version
regardless of the protocol version.

This makes use of the new Serialize and Deserialize functions on MsgBlock
which are intended for long-term storage as opposed to wire encoding.
2013-08-05 16:28:55 -05:00
Dave Collins
05d31cdc7a Add negative test for TxLoc. 2013-05-30 11:50:58 -05:00
Dave Collins
3ffe28e364 Add test for OutOfRangeError. 2013-05-30 11:12:29 -05:00
Dave Collins
a5bb254ac6 Add negative tests for TxSha. 2013-05-30 11:06:09 -05:00
Dave Collins
f8fc23a541 Add negative test for NewBlockFromBytes. 2013-05-30 10:45:38 -05:00
Dave Collins
b90727cc8a Add tests for TxLoc. 2013-05-30 10:30:04 -05:00
Dave Collins
ef6c01960f Initial implementation. 2013-05-28 18:21:26 -05:00