This adds a flushBlockDB function to the UTXO cache. The flushBlockDB
function is used to flush the block database to disk prior to flushing
the UTXO cache to the UTXO database.
This ensures that the block database is always at least as far along as
the UTXO database which keeps the UTXO database in a recoverable state
in the event of an unclean shutdown.
This adds a Flush method to the DB interface so that users of the DB
type can flush the underlying database to disk as needed.
The immediate use case for this is to allow for flushing dependencies.
For example, the block database always needs to be flushed to disk prior
to the UTXO database being flushed to disk to ensure that the UTXO
database remains in a recoverable state in the event of an unclean
shutdown.
This removes the gettxoutresult-version key from the RPC server help map
since the field no longer exists in the actual output and is therefore
no longer used.
The current code for handling signing standard scripts resides in
txscript and depends on parsing and creating standard scripts. This
poses a problem for future work which intends to split the standard
script handling from the consensus critical code since that code will
also need to depend on txscript and therefore would result in a circular
dependency.
In order to pave the way for splitting the standard script handling
without running into the aforementioned issue, this moves all of the
signing code in the txscript package to a new subpackage named sign.
As an aside, the signing code really never fit very well in the txscript
package anyway and it only exists there because it was not possible to
parse scripts outside of the package back when the original code was
implemented. However, that limitation no longer exists.
It should also be noted that this only does the minimum work necessary
to move the code and does not update it otherwise since future work
plans to replace it with a much more robust architecture that properly
handles things such as different script versions and non-standard
scripts which the current code does not handle.
OpenBSD 6.9 includes a new daemon_logger variable which may be set to
automatically set the syslog facility that the process will write to.
This lets us simplify our example service by avoiding the need to
redefine the rc_start function.
While here, update some of the default flags to more closely match
what I now recommend. /var is too small for block data on many
installations, so it is better to write all of the application data to
the /home partition instead. This also fixes the comment for how to
enable the service, since just defining the flags is not sufficient
for this.
When the SIGHUP signal is received, the process should perform
graceful shut down rather than dying from the unhandled signal.
For clarity, the signals which will cause shutdown have been moved to
a new filename so it does not remain specific to only SIGTERM
handling.
This allows RPCs which take hostnames as parameters (such as the
'node' method) to interpret the host part as an interface name, and
use the first IP address associated with the interface. This is done
for consistency with how interface names may be used in the dcrd
application config.
For config options which specify listen addresses (such as --listen
and --rpclisten), all addresses associated with the interface will be
listened on. For config options which specify dialed addresses (such
as --addpeer, --connect, --proxy, and --onion), only the first address
associated with the interface is included.
This migrates the UTXO set and state from the block database to the new
UTXO database. The benefit of doing this is that it will allow the
reading and writing to the UTXO set in the database to be optimized
specifically for use with the UTXO set.
An overview of the changes is as follows:
- Introduce upgrade code to migrate UTXO data from the block database to
the new UTXO database
- Update all references to use the UTXO database rather than the block
database where appropriate
This decouples the overall block database version and migrations from
the spend journal and utxo set versions and migrations.
This provides a couple of benefits. Firstly, the migration to version 3 of the
spend journal and utxo set currently require the block index to be loaded. In
the future this could be handled by reindexing, once that is introduced, but
until then this decoupling allows for new block database versions and migrations
to be run prior to the block index being loaded.
Secondly, this is a step toward removing the dependency that the utxo set and
spend journal have on the block database and index.
This is part of moving the UTXO set and state to a separate database.
This introduces a separate UTXO database that holds the UTXO database
info. In a subsequent commit it will additionally hold the UTXO set and
state.
An overview of the changes is as follows:
- Introduce LoadUtxoDB to load (or create when needed) the new UTXO
database on startup
- Add utxoDb and utxoDbInfo to BlockChain to hold the new UTXO database
- Initialize the UTXO database info in the UTXO database on startup
- Populate utxoDb for mock chains in tests
This is part of moving the UTXO set and state to a separate database.
The adds utxoDatabaseInfo which tracks the version, compression version,
utxo set version, and creation time of the UTXO database. The UTXO
database will be created as a separate database in a subsequent commit.
This is part of moving the UTXO set and state to a separate database.
This updates the ipc lifetimeEvent comments to match reality. In
particular, lifetimeEventTicketDB was previously removed but the
comments were not updated to reflect this.
This moves the tests that deal with the UTXO database buckets from
chainio_test.go to a separate file, utxoio_test.go.
This is part of moving the UTXO set and state to a separate database.
This moves the methods that deal with the UTXO database buckets from
chainio.go to a separate file, utxoio.go.
This is part of moving the UTXO set and state to a separate database.
When an empty string is provided for the optional block hash argument,
this should be treated as if it were omitted rather than the zero hash,
which is an invalid block.
This changes handleGetTreasuryBalance to treat "" like nil. This change
is consistent with how handleGetTreasurySpendVotes handles its optional
block argument.
The tests for both gettreasurybalance and gettreasuryspendvotes are
updated to ensure this behavior (existing for gettreasuryspendvotes).
This modifies checkTransactionContext to accept agenda flags instead of
a boolean for whether or not the treasury agenda is active so it is
easier to extend for future consensus votes which would otherwise
require a series of boolean parameters.
This modifies the IsTreasuryAgendaActive method to return false when a
zero hash is provided since that indicates the next block is the genesis
block and the treasury agenda is always inactive for the genesis block.
This has the effect of fixing a few RPC handlers, such as getblock, when
working with the genesis block.
Median time is a useful value to return to clients, saving them the
trouble of calculating it themselves. Include the value in verbose
getblock and getblockheader results.
This modifies the recently-updated blockchain module to use a valid
prerelease version of the blockchain/stake module so it can be used in
require statements in consumer code that is also under development.
The updated direct dependencies are as follows:
- github.com/decred/dcrd/blockchain/stake/v4@v4.0.0-20210409183916-7f402345f0a6
This moves the AddressParams interface and associated mock
implementations in the tests to util.go and util_address.go,
respectively, in preparation for removing the Address type and related
code.
An address is conceptually a human-readable string encoding of a
payment script, so the two methods String and PaymentScript should be
sufficient to provide basic address functionality. This also avoids
some stutter/repetition (e.g. ma.Address().Address()) in wallet code,
where wrapper types are used around the Address interface, and
additionally allows the wrapper types to implement the stdaddr.Address
interface directly while still providing their own Address method to
return the underlying interface type.
Now that the addresses have all been converted over to use the stdaddr
package, this removes only remaining dependencies on dcrutil which are
in the tests in order to avoid cyclic dependencies when updating the
dcrutil code to the use the stdaddr package.
This removes GenerateSStxAddrPush since it is no longer used by anything
in the repository and is now available via the RewardCommitmentScript
method of the relevant stdaddr address.
It also removes the associated tests and nilAddrErrStr that is no longer
used upon their removal.
This removes payToPubKeyHashScript since it is no longer used by
anything in the package and is now available via the PaymentScript
method of the relevant stdaddr address.
This removes payToPubKeyHashEdwardsScript since it is no longer used by
anything in the package and is now available via the PaymentScript
method of the relevant stdaddr address.
This removes payToPubKeyHashSchnorrScript since it is no longer used by
anything in the package and is now available via the PaymentScript
method of the relevant stdaddr address.
This removes payToScriptHashScript since it is no longer used by
anything in the package and is now available via the PaymentScript
method of the relevant stdaddr address.
This removes payToPubKeyScript since it is no longer used by anything in
the package and is now available via the PaymentScript method of the
relevant stdaddr address.
This removes payToEdwardsPubKeyScript since it is no longer used by
anything in the package and is now available via the PaymentScript
method of the relevant stdaddr address.
This removes payToSchnorrPubKeyScript since it is no longer used by
anything in the package and is now available via the PaymentScript
method of the relevant stdaddr address.
This removes PayToScriptHashScript since it is no longer used by
anything in the repository and is now available via the PaymentScript
method of the relevant script hash stdaddr address.
This removes PayToAddrScript and its associated example since it is no
longer used by anything in the repository and is now available via the
PaymentScript method of the relevant stdaddr address.
This removes PayToSSRtxSHDirect since it is no longer used by anything
in the repository and is now available via the PayRevokeCommitmentScript
method of the relevant script hash stdaddr address.
This removes PayToSSRtxPKHDirect since it is no longer used by anything
in the repository and is now available via the PayRevokeCommitmentScript
method of the relevant pubkey hash stdaddr address.
This removes PayToSSRtx since it is no longer used by anything in the
repository and is now available via the PayRevokeCommitmentScript method
of the relevant stdaddr addresses.
This removes PayToSSGenPKHDirect since it is no longer used by anything
in the repository and is now available via the PayVoteCommitmentScript
method of the relevant pubkey hash stdaddr address.
This removes PayToSSGenSHDirect since it is no longer used by anything
in the repository and is now available via the PayVoteCommitmentScript
method of the relevant script hash stdaddr address.
This removes PayToSSGen since it is no longer used by anything in the
repository and is now available via the PayVoteCommitmentScript method
of the relevant stdaddr addresses.
This removes PayToSStxChange since it is no longer used by anything in
the repository and is now available via the StakeChangeScript method of
the relevant stdaddr addresses.
This removes PayToSStx since it is no longer used by anything in the
repository and is now available via the VotingRightsScript method of the
relevant stdaddr addresses.
This converts the txscript 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, some previously
temporary address conversion code that is no longer needed is removed
from the blockchain/indexers and internal/rpcserver packages.
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 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.