This commit adds two new functions to the Block API for working with the
recently added Tx type from the Block.
These new functions are named Tx and Transactions. Tx returns a
transactions for the specified index as a Tx and also memoizes it so
subsequent calls are more efficient. Transactions returns a slice of all
transactions in the Block wrapped in a Tx.
This is part of the ongoing transaction hash optimization effort
noted in conformal/btcd#25.
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.