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.
This commit contains a basic definition for CoinSelector along with some
utility classes and some basic algos to make creating transactions from
a set of available unspent outpoints easier.
Thanks to @dajohi, @davec, @jrick for all the feedback and suggestions
regarding interfaces, organization, optimization, comments and
documentation.
This commit modifies DecodeAddress to accept and decode pay-to-pubkey
addresses (raw serialized public keys). Since the resulting Address
needs to have a network associated with it, and a raw serialized public
key does not encode the network with it, a new parameter has been added
which requires the caller to specify a default network to use when
decoding addresses.
In the case the address has a network encoded with it such as for
pay-to-pubkey-hash and pay-to-script-hash addresses, the network will be
decoded from the address and the resulting Address instance will have that
network associated with it. When the address does NOT have a network
encoded with it, such as a pay-to-pubkey address, the provided default
network will be associated with the returned Address instance.
Also, the tests have been updated to test the new functionality.
ok @owainga and @jrick.
Address is a generic interface for any type of "address" a
transaction can be sent to, including but not limited to
pay-to-pubkey, pay-to-pubkey-hash, and pay-to-script-hash.
This change implements Address and concrete types for P2PKH and P2SH
addresses with 100% test coverage. Pay-to-pubkey support will be
added in the future.
This API is intended to replace the old EncodeAddress/DecodeAddress
functions which are now deprecated.
This commit adds both positive and negative tests for the new Tx type to
bring its coverage to 100%.
This is part of the ongoing transaction hash optimization effort noted
in conformal/btcd#25.