This updates the following modules to use the secp256k1/v2 module:
- blockchain
- chaincfg/v2
- dcrutil/v2
- hdkeychain/v2
- mempool/v3
- txscript/v2
- main
The hdkeychain/v3 and txscript/v2 modules both use types from secp256k1
in their public API.
Consequently, in order avoid forcing them to bump their major versions,
secp256k1/v1.0.3 was released with the types redefined in terms of the
secp256k1/v2 module so callers still using v1 of the module that are not
ready to upgrade to the v2 module yet can interoperate by updating to
the latest patch version.
This introduces a new interface named AddressParams and updates the
functions that currently take a pointer to a chaincfg.Params struct to
accept the interface instead.
This removes the tight coupling between the two packages at the API
boundary and allows callers to easily provide custom values without
having to create and register and entire chaincfg network as previously
required.
It also updates the tests to make use of the interface.
This modifies the concrete address implementations to only store the
necessary individual parameters instead of the entire params struct to
further decouple from chaincfg.
This removes the DSA method from the Address interface in favor of only
defining it on the specific concrete address implementations to which it
applies. It also modifies the remaining instances to remove the network
parameters since they are already available on the type.
Finnaly, it updates the example code accordingly.
This removes the no longer necessary IsForNet method from the Address
interface and all concrete address implementations.
It also updates the tests accordingly.
This modifies DecodeAddress to accept the required network parameters
for the provided encoded address and return an error when the provided
address is for the wrong network.
This means that DecodeAddress will now return ErrUnknownAddressType if
the address being decoded is not for the provided network. This differs
from the previous behavior relied on globally-registered networks in
chaincfg to determine which network the encoded address was for followed
by requiring the caller to check if the address was for the specific
network it desired upon return.
It also updates the tests and example accordingly.
This modifies the code that looks up the params by a given network
prefix to make use of the new function provided by chaincfg in order to
ensure that it works with all registered networks as the package was
intended.
This modifies the majority of the tests that make use of chain
parameters and the RPC tests to use the resurrected regression test
network.
It also bumps the affected module versions as follows:
- github.com/decred/dcrd/txscript@v1.0.2
- github.com/decred/dcrd/blockchain/stake@v1.0.3
- github.com/decred/dcrd/mempool@v1.0.2
The blockchain and dcrutil modules are also affected, but since their
version has already been bumped since their last release tags, they are
not bumped again.
This resurrects the regression test network that was removed before
initial launch although it really should not have been. The simulation
test network and the regression test network do not serve the same
purpose. Specifically, the regression test network is intended for unit
tests, RPC server tests, and consensus tests. On the other hand, the
simulation test network is intended for private use within a group of
individuals doing simulation testing and full integration tests between
different applications such as wallets, voting service providers, mining
pools, block explorers, and other services that build on Decred.
Keeping the concerns separate will allow the simulation test network to
be modified in ways such as activating consensus changes that have been
successfully voted into mainnet without also needing to vote them in on
the simulation test network while still preserving the ability for the
unit tests to properly test the voting semantics and handling to help
prevent regressions.
In addition to resurrecting the regression test network, this also fully
fleshes out new values for the various addresses prefixes (Rk, Rs, Re,
etc), HD key prefixes (rprv, rpub), and treasury multisig details.
As a part of resurrecting the network, a new CLI flag `--regnet` is
added to allow the RPC test harness connect to a running instance, the
areas of the code which involve votes have been modified to allow the
votes to apply to the new network, and tests have been added to the
relevant modules.
This bumps the affected module versions as follows:
- github.com/decred/dcrd/wire@v1.2.0
- github.com/decred/dcrd/chaincfg@v1.2.0
- github.com/decred/dcrd/dcrutil@v1.2.0
- github.com/decred/dcrd/hdkeychain@v1.1.1
The blockchain module is also affected, but since its version has
already been bumped since the last release tag, it is not bumped again.
Finally, this does not include switching unit tests or the RPC test
harness over the new network since that will be done in a separate
commit.
This adds a new testnet3 network with new genesis block, block one
ledger, treasury address, and network magic.
All consensus rules that were voted in by testnet2 are automatically
active on the new testnet3 without having to vote them in again.
Consequently, there are no consensus vote agendas defined for it.
Hybrid pubkeys, which are a relic of OpenSSL used in Bitcoin Core, are
not usable with OP_CHECKSIG and we can potentially prevent creating
unspendable outputs by never allowing the creation of P2PK (or derived
P2PKH) addresses for these pubkeys.