This converts the hdkeychain package example to use the stdaddr package
instead of dcrutil.Address.
This is part of a series of commits to convert all packages in the
repository to make use of the new stdaddr package.
This converts the internal/rpcserver package to use the stdaddr package
instead of dcrutil.Address as well as to support script versions.
All callers that use the package in the repository are updated
accordingly to maintain code that continues to build and work properly
as well as pass all tests. In order to achieve this, it introduces
temporary address conversion code that will be removed in future
commits.
This is part of a series of commits to convert all packages in the
repository to make use of the new stdaddr package.
This converts the rpcclient package to use the stdaddr package instead
of dcrutil.Address as well as to support script versions.
All callers that use the package in the repository are updated
accordingly to maintain code that continues to build and work properly
as well as pass all tests.
This is part of a series of commits to convert all packages in the
repository to make use of the new stdaddr package.
This converts the rpcclient package to use the stdaddr package instead
of dcrutil.Address as well as to support script versions.
All callers that use the package in the repository are updated
accordingly to maintain code that continues to build and work properly
as well as pass all tests.
This is part of a series of commits to convert all packages in the
repository to make use of the new stdaddr package.
This removes PurchaseCommitmentScript since it is no longer used by
anything in the repository and is now available via the
RewardCommitmentScript method of the relevant stdaddr address.
This converts the blockchain package to use the stdaddr package instead
of dcrutil.Address.
All callers that use the package in the repository are updated
accordingly to maintain code that continues to build and work properly
as well as pass all tests.
This is part of a series of commits to convert all packages in the
repository to make use of the new stdaddr package.
This converts the blockchain/indexers package to use the stdaddr package
instead of dcrutil.Address.
All callers that use the package in the repository are updated
accordingly to maintain code that continues to build and work properly
as well as pass all tests. In order to achieve this, it introduces
temporary address conversion code that will be removed in future
commits.
This is part of a series of commits to convert all packages in the
repository to make use of the new stdaddr package.
This converts the blockchain/stake package to use the stdaddr package
instead of dcrutil.Address as well as to support script versions.
All callers that use the package in the repository are updated
accordingly to maintain code that continues to build and work properly
as well as pass all tests. In order to achieve this, it introduces
temporary address conversion code that will be removed in future
commits.
This is part of a series of commits to convert all packages in the
repository to make use of the new stdaddr package.
This converts the internal mempool package to use the stdaddr package
instead of dcrutil.Address as well as to support script versions.
All callers that use the mempool package in the repository are updated
accordingly to maintain code that continues to build and work properly
as well as pass all tests.
This is part of a series of commits to convert all packages in the
repository to make use of the new stdaddr package.
This converts the internal mining package to use the stdaddr package
instead of dcrutil.Address as well as to support script versions.
All callers that use the mining package in the repository are updated
accordingly to maintain code that continues to build and work properly
as well as pass all tests. In order to achieve this, it introduces
temporary address conversion code that will be removed in future
commits.
This is part of a series of commits to convert all packages in the
repository to make use of the new stdaddr package.
This modifies the test code for joining mempools and blocks to send any
errors that occur over the sync channel and calling fatal in the main
goroutine instead of calling fatal in the goroutines to prevent any
potential teardown issues in the case of failure.
This also makes go vet happy.
This modifies the RewardCommitmentScript method of the StakeAddress
interface to accept the vote and revoke fee limits separately instead of
expecting the caller to have already encoded it properly.
This simplifies the creation of the reward commitment script since there
is not currently any other method available anywhere to independently
encode the limits properly and it is not a particularly trivial
encoding.
Finally, the tests and example are updated accordingly.
This moves the new stdaddr package from the internal staging area to the
txscript module and updates the relevant paths and package README.md
accordingly.
This modifies README.md to include information about the new
SerialiedPubKeyer interface and obtaining the serialized public key from
a public key address in general.
This adds an interface named SerializedPubKeyer which consists of a
single SerializedPubKey method that allows the raw public keys
associated with a public key address to be obtained and implements the
interface on all supported public key addresses.
It also adds tests to ensure proper functionality.
This makes getOurIP return a local IP that is on the same subnet as
the serviceIP used for uPnP. Verified getOurIP doesn't return a local
IPv6 IP when the serviceIP is IPv4. Didn't test with IPv6 serviceIP.
Co-authored-by: lol_and_hold <lolandhold@protonmail.com>
This removes the unused MiningAddrs field from the cpuminer Config
struct as the cpuminer no longer requires direct access to them after it
was converted to make use of the background template generator.
This modifies MultiSigScript to accept raw serialized variadic pubkeys
instead of a fixed slice of addresses and updates the tests to be more
consistent with the rest of the code.
It also now takes the required number of signatures (threshold) as the
first parameter so it more closely matches the typical way threshold
signatures are referred to. Namely, m-of-n where m is the threshold and
n is the number of pubkeys.
These style of multisig scripts involve public keys as opposed to
addresses, and callers typically have the public key as opposed to an
address already anyway, so the new API is more convenient, logical, and
flexible.
Finally, in order to keep the semantics the same such that only
compressed secp256k1 public keys are used, an additional check is added
to reject the provided serialized public keys when they do not adhere to
the strict compressed public key encoding requirements.
This updates the check which determines whether the chain believes it is
current to also detect when the current best chain tip is an alternative
tip at the same height as the best header.
This is being done because the best header is determined based on when
the block data was received during steady state operation to prevent
miners being able to gain an unfair advantage, however, that order is
intentionally not stored to the database since it only applies to steady
state. The result is that restarting the software when there are
multiple chain tips might result in one of the other variants becoming
the best header as compared to when it was shutdown and thus it will not
match the current best block.
This corrects the tests in the rpctest package to work properly with the
latest code.
The tests were not failing by default because many of the tests in the
rpctest package are not executed when only performing short tests which
is the default mode used in run_tests.sh.
This adds a new method to ScriptBuilder named AddOpsUnchecked that is
similar to AddDataUnchecked in that it allows the limits that are
ordinarily impose to be bypassed for regression testing purposes where
sizes are intentionally made larger than allowed.
It also updates the test code to make use of the method instead of
reaching into the internals to manually concatenate the opcodes.
This adds benchmarks for decoding and generating the payment script for
each supported version 0 address type.
This is part of a series of commits to fully implement the stdaddr
package.
This adds a new type to fully support version 0 pay-to-script-hash
addresses along with associated tests.
This is part of a series of commits to fully implement the stdaddr
package.
This adds a new type to fully support version 0
pay-to-pubkey-hash-schnorr-secp256k1 addresses along with associated
tests.
This is part of a series of commits to fully implement the stdaddr
package.
This adds a new type to fully support version 0
pay-to-pubkey-hash-ed25519 addresses along with associated tests.
This is part of a series of commits to fully implement the stdaddr
package.
This adds a new type to fully support version 0
pay-to-pubkey-hash-ecdsa-secp256k1 addresses along with associated
tests.
This is part of a series of commits to fully implement the stdaddr
package.
This adds a new type to fully support version 0
pay-to-pubkey-schnorr-secp256k1 addresses along with associated tests.
This is part of a series of commits to fully implement the stdaddr
package.
This adds a new type to fully support version 0 pay-to-pubkey-ed25519
addresses along with associated tests.
This is part of a series of commits to fully implement the stdaddr
package.
This adds a new type to fully support version 0
pay-to-pubkey-ecdsa-secp256k1 addresses along with associated tests.
This is part of a series of commits to fully implement the stdaddr
package.
This adds the overall infrastracture for decoding version 0 addresses
along with associated testing infrastructure.
Note that, in order to help ease the review process, this only adds the
relevant infrastructure and does not yet support any version 0 address
types. Each supported version 0 address type will be added in future
commits.
This is part of a series of commits to fully implement the stdaddr
package.
The current code for handling standard addresses implemented in dcrutil
was written many years ago prior a wide variety of changes and several
new features added by Decred. As a result, it entirely lacks support
for some features and supports others in a roundabout and non-intuitive
way.
Specifically, it does not support or provide a clean path to enable
support for different script versions and the way they are handled in
stake transactions is entirely non-intuitive.
Further, back when the original address code was implemented, it was
necessary to implement script creation in the txscript package which led
to the current design of providing methods such as
txscript.PayTo{AddrScript,SStx,SStxChange}, and others, which need to
type assert the specific concrete types of addresses in order to produce
the necessary scripts. This, unfortunately, effectively negates the use
of an interface to support generic addresses because it means callers,
such as dcrwallet, are not able to implement their own types without
somewhat invisibly breaking the script creation.
Finally, the aforementioned blending of the address code into txscript
has led to confusion regarding what is considered standard and what is
considered consensus which has tripped up several contributors over the
years.
This is part of a series of commits that aims to resolve all of the
aforementioned issues by introducing a new package named stdaddr which
entirely reworks the way addresses are handled.
For the time being, the package is introduced into the internal staging
area for initial review.
The following provides an overview of some of the key features of the
new design:
- Supports versioned addresses
- Produces scripts directly via methods implemented on underlying types
- Provides direct support for creation of the scripts necessary for the
staking system
- Uses a capabilities-based approach via interfaces so callers can
cleanly and generically determine under what circumstances addresses
can be used
- Allows callers to create their own concrete address types without
worrying about breaking the existing ones
- Clearly denotes that addresses are a standardized construction that
must not be used directly in consensus code
In order to help ease the review process, this commit only contains the
overall generic infrastructure without adding support for any specific
address types. Each supported version 0 address type will be added in
future commits.
This corrects the generic public key address constructor to pass the
actual serialized ed25519 public key to specialized constructor instead
of incorrectly including the initial byte that identifies the signature
suite and y bit oddness.
With this update, when dcrd is run with the LOGFLAGS=nodatetime
environment variable, the logs will not contain any date or time.
This is useful when logs already only end up in another logging system
which provides its own logged dates and times.
Fast block announcements were added a few years ago as a way to increase
the propagation speed of new blocks that extend the main chain through
the network to significantly reduce voting latency as well as how
quickly proof-of-work miners discover new blocks. This is desirable
behavior, however, it should only apply to full nodes since only they
are equipped to deal with the fast announcements.
As a case in point, header commitments and committed block filters can
pose a problem for lightweight clients that rely on them in the case of
fast block announcements because lightweight clients tend to request the
filters as soon as they learn about the new blocks and those filters
have not been created yet when fast block announcements are sent.
Since there is network latency involved in the request process, the
result is that sometimes the filters are available by the time the
requests from lightweight clients are received and sometimes they are
not.
In order to help prevent the aforementioned case, and other similar
ones, this modifies the code that deals with block announcements to only
send fast block announcements to peers that advertise themselves as full
nodes instead of all nodes and separates out the block announcement
logic slightly to make future enhancements easier in the process.
It also modifies the filtering of duplicate block announcements to work
on a per peer basis since not all peers receive the fast block
announcement now.
This adds tests for the UtxoCache Initialize method. These tests
include recovery scenarios that are particularly hard to simulate to
ensure that those code paths are not broken in the future.
In order to test recovery scenarios, this introduces a test utxo cache
that allows for toggling flushing on and off.
Additionally, this adds an ExpectUtxoSetState method to chaingenHarness
that allows for easily validating the last flushed block for the utxo
set.
This adds a UtxoCacher interface so that alternative utxo cache
implementations can be provided. In particular, this will be used to
provide a mock implementation for testing in order to more easily
simulate various scenarios.
In addition to introducing the UtxoCacher interface, this updates
BlockChain and UtxoViewpoint to use the interface rather than the
concrete type.
This changes the InitUtxoCache method on the BlockChain type to a
Initialize method on the UtxoCache type instead. This simplifies
providing alternative implementations for testing since the Initialize
method deals with internal fields of the UtxoCache type.
This updates the utxo cache flush tests to use a mock function for
getting the current time. Without this the flush tests will fail if
the flush happens fast enough for time.Now to not have elapsed any time.
This updates the error messages in the chainio tests to consistently use
the newer style of `t.Errorf("%q: ...", test.name)` rather than
including extra information for the function name, test index, etc.
The extra information is no longer needed to pinpoint an error since the
test framework now shows proper line numbers for any errors that occur.