lbcutil/doc.go
Dave Collins e402c62673 Add new Tx wrapper for btcwire.MsgTx.
Currently, transaction hash caching is provided via Block directly, but a
transaction is not always part of a block and there are several cases
where only the transaction needs to be dealt with without wanting to pass
the entire block and transaction index around to be able to get at the
cached hash.

So, this commit adds a new type named Tx which is a wrapper that provides
easier and more efficient manipulation of raw wire protocol transactions.
It memoizes the hash for the transaction on its first access so subsequent
accesses don't have to repeat the relatively expensive hashing operations.
The idea is the callers can pass around pointers to these Tx types instead
of raw btcwire.MsgTx pointers.

For now, the Block API has not been changed, but the plan is to change it
to provide access to these wrapped transactions rather than having it do
the transaction hash caching directly.

This is only the first part of a series of changes working towards
optimizations noted in conformal/btcd#25.
2013-10-27 13:55:51 -05:00

34 lines
995 B
Go

// Copyright (c) 2013 Conformal Systems LLC.
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
/*
Package btcutil provides bitcoin-specific convenience functions and types.
Block Overview
A Block defines a bitcoin block that provides easier and more efficient
manipulation of raw wire protocol blocks. It also memoizes hashes for the
block and its transactions on their first access so subsequent accesses don't
have to repeat the relatively expensive hashing operations.
Tx Overview
A Tx defines a bitcoin transaction that provides more efficient manipulation of
raw wire protocol transactions. It memoizes the hash for the transaction on its
first access so subsequent accesses don't have to repeat the relatively
expensive hashing operations.
Base58 Usage
To decode a base58 string:
rawData := btcutil.Base58Decode(encodedData)
Similarly, to encode the same data:
encodedData := btcutil.Base58Encode(rawData)
*/
package btcutil