This adds a function to generate a provably pruneable version 0 script
that is considered standard since the equivalent variant of it is
eventually going to be removed from txscript given it is a standardness
construct as opposed to a consensus rule.
This adds an exported constant for the maximum allowed size of version 0
nulldata scripts to be considered standard and makes use of it instead
of the one from txscript since the constant is eventually going to be
removed from txscript given it is purely a standardness construct as
opposed to a consensus rule.
This adds tests to validate that the fraud proof of transaction inputs
is corrected as necessary when entering the mempool under a variety of
conditions.
This updates mempool to now set the check fraud proof flag to true for
blockchain.CheckTransactionInputs since mempool now ensures that the
fraud proof is correct for all transaction inputs prior to this check.
This updates the fraud proof data on transaction inputs as necessary
when entering the mempool. The fraud proof data will ultimately get
filled in properly when miners create a block template. However,
ensuring that it is filled in properly when entering the mempool is
beneficial so that it is correct when relaying the transaction or
returning it from an RPC API.
This updates dcrutil.NewTxDeepTxIns to take a dcrutil.Tx as a parameter
rather than a wire.MsgTx, which allows for the tree and index set on the
input dcrutil.Tx to be copied to the new dcrutil.Tx.
This is less error prone for callers since the existing implementation
is often used to replace an existing dcrutil.Tx with the deep copy that
this function creates, but a side effect that is easy to miss is that
the new dcrutil.Tx would have reset the tree and index fields which
can lead to unintended behavior.
This removes an unnecessary transaction copy in the mining code. It is
not needed since all of the regular transactions have already been
copied prior to this point.
This makes the following changes pointed out by linting:
- Uses ++ instead of += 1 for incrementing the expiry in mempool test
code
- Removes an unused function in the rpc test code
- No need to specify variable type since it is inferred
This updates the rpc/jsonrpc/types module dependencies, the copyright
year in the files modified since the previous release, and serves as a
base for rpc/jsonrpc/types/v3.0.0.
The updated direct dependencies in this commit are as follows:
- github.com/decred/dcrd/dcrjson/v4@v4.0.0
The full list of updated direct dependencies since the previous
rpc/jsonrpc/types/v2.3.0 release are the same as above.
This updates the addrmgr module dependencies, the copyright year in the
files modified since the previous release, and serves as a base for
addrmgr/v2.0.0.
The updated direct dependencies in this commit are as follows:
- github.com/decred/dcrd/chaincfg/chainhash@v1.0.3
- github.com/decred/dcrd/wire@v1.5.0
- github.com/decred/slog@v1.2.0
The full list of updated direct dependencies since the previous
addrmgr/v1.2.0 release are the same as above.
Finally, all modules in the repository are tidied to ensure they are
updated to use the latest versions hoisted forward as a result.
This updates the chaincfg module dependencies and serves as a base for
chaincfg/v3.1.0.
The updated direct dependencies in this commit are as follows:
- github.com/decred/dcrd/chaincfg/chainhash@v1.0.3
- github.com/decred/dcrd/wire@v1.5.0
The full list of updated direct dependencies since the previous
chaincfg/v3.0.0 release are the same as above.
Finally, all modules in the repository are tidied to ensure they are
updated to use the latest versions hoisted forward as a result.
This updates FetchState for the UTXO backend to return nil if the
serialized state in the database has zero-length. This is not expected
in normal circumstances, however, due to a bug in upgrade code in a
previous commit, it could end up this way.
This fixes an edge case within the UTXO database migration logic. In
the upgrade that migrates the UTXO data to use simple key prefixes
rather than buckets, old entries will still be copied to the new
location even if they are nil, which incorrectly creates an empty entry
in the new location.
This updates the minimum known chain work values for the main and test
networks as follows:
mainnet: 0x0000000000000000000000000000000000000000001d987ec2c7f4bc1199489e
testnet: 0x000000000000000000000000000000000000000000000000e419ae4d750d4484
This modifies the ping interval to be defined in terms of the default
idle timeout such that it is shorter and relatively prime to it to help
prevent undesirable disconnects in higher latency scenarios.
This adds code to correct the ticket database and block index treasury
spend vote data due to the issue in FindSpentTicketsInBlock described by
the previous commit.
It involves unwinding all of the blocks from the current tip back to the
known good point in the ticket database and replaying them to apply the
the correct information to the various buckets in the ticket database as
well as the relevant entries in the block index. The process can be
interrupted at any point and future invocations will resume from the
point it was interrupted.
Also, since the next release of the software will include a vote to
change the consensus rules, all of the blocks previously marked as
having failed validation need to be unmarked so they are eligible for
which ensures clients that did not update prior to new rules activating
are able to automatically recover under the new rules without having to
download the entire chain again.
Since both cases require a database version bump, this takes advantage
of the database version bump to do both a single version bump.
This modifies FindSpentTicketsInBlock to also properly detect votes that
include information to vote on treasury spends as intended.
It should be noted that this commit only corrects the function and the
issue does not affect consensus in a way that could lead to an
unintended fork.
However, the incorrect behavior does mean the stake ticket database and
block index now have invalid entries in them that will be corrected via
a database migration in a separate commit.
More specifically, the behavior has resulted in the ticket database
incorrectly marking the associated tickets as missed instead of voted,
but that information is only used for serving RPC data. The live ticket
pool is still accurate and all votes and payouts are unaffected.
Further, the associated data in the block index is only used when
tallying vote information and since an upgrade is required before a new
vote can start anyway, it will necessarily be resolved prior to that
point.
This modifies the message writing code that writes out message headers
to write the fields directly instead of creating a copy of the data
first.
The primary motivation for this change is that the hdr.command field is
assigned and never used in the existing code because the size-limited
array variant of the command field is used instead when writing the
elements. Since that field is unused, rather than creating a local
partially-filled message header, and copying data into it only to turn
around and write that data immediately, it makes more sense to just
write the data directly.
This modifies the semver handling to specifically use uint32 instead of
architecture-dependent uint so bounds checking is consistent across
architectures and only needs to be done in one place.
This removes the flags param from the maybeAcceptBlockHeader function in
blockchain since it is now passed in as BFNone in all instances. The
appropriate flags will now be determined internally within blockchain.
This removes the flags param from the ProcessBlockHeader function in
blockchain since it is now passed in as BFNone in all instances. The
appropriate flags will now be determined internally within blockchain.
This removes the flags param from the ProcessBlock function in
blockchain since it is now passed in as BFNone in all instances. The
appropriate flags will now be determined internally within blockchain.
This removes the flags param from processBlockMsg and processBlock in
SyncManager since it is passed in as BFNone in all instances. The
appropriate flags will be determined internally within blockchain.
This removes the flags param from ProcessBlock in SyncManager since it
is passed in as BFNone in all instances. The appropriate flags will be
determined internally within blockchain.
This updates the block importer to enable bulk import mode on the chain
rather than passing in the blockchain.BFFastAdd parameter when
processing each block.
This will allow the blockchain.BehaviorFlags parameter to be removed
from the process block function in a subsequent commit.
This adds a bulk import mode that provides a mechanism to indicate that
several validation checks can be avoided when bulk importing blocks
already known to be valid. It will be used by the block importer in a
subsequent commit.
This provides an alternative mechanism to the current solution of
passing a BehaviorFlags parameter around, which is inconvenient and
makes it harder to determine where flags are being set.
This modifies the upgrade code related to block index entries to further
decouple it from the primary code base to help ensure legacy upgrade
paths remain stable as the primary code evolves.
The addition of the separate version 3 block index bits will also be
useful in future upgrade code as well.
This corrects the internal 96-bit accumulator used during modular
reduction over the curve order (ModNScalar) to properly handle the case
when both words of the multi-word addition overflow and adds accumulator
tests for all potential overflow conditions to ensure correctness.
This removes LatestBlockLocator since it is no longer used by anything
now that the desired hashes are always known from having all of the
headers available.
This updates the various blockchain call sites that deal with
determining if a node is an ancestor (or descendant) to make use of the
new IsAncestorOf convenience func.
This adds a convenience func to block nodes named IsAncestorOf for
determining whether or not a node is an ancestor of a given target node
along with tests to ensure proper functionality.
This addresses an issue in the ticket database when disconnecting a
block that contains an automatic revocation.
When the automatic ticket revocations agenda is enabled, a ticket can
become missed and revoked in the same block. When connecting that block
to the ticket database, this is recorded as two separate entries in the
undo data (the first moving it to missed, and the second moving it to
revoked). Therefore, when disconnecting the block, the undo data needs
to be applied in reverse order.
This updates the UTXO cache to flush all entries to the backend before
UTXO stats are fetched. This ensures that the UTXO stats are always in
sync with the current best block.
This also does not impact the effectiveness of the UTXO cache since
entries are still only evicted if necessary.
The method that calculates the next required difficulty currently logs
difficulty retargets which means it has side effects when it really
should free from them given its purpose.
This can be evidenced by the fact the logging is actually slightly
incorrect in a couple of ways due to those side effects. Namely, it can
potentially log when checking block templates when it shouldn't and it
is also currently logging when the headers are connected as opposed to
when the blocks themselves are actually connected which was the original
intention prior to the new headers-first logic.
Thus, this moves the debug logging for difficulty retargets from the
required difficulty calculation function to the block connection
function and also takes the opportunity to impose a new condition to
only log when the difficulty actually changes as opposed to the current
behavior of always logging on a retarget interval regardless.
This updates the blockchain checkpoints logic to use a single latest
checkpoint rather than multiple checkpoints. The intermediate
checkpoints are no longer necessary because headers first syncing was
introduced, which discovers the most recent checkpoint before block
syncing even starts.
This updates the Checkpoints param for mainnet and testnet to specify a
single latest checkpoint rather than multiple checkpoints. The
intermediate checkpoints are no longer necessary because headers first
syncing was introduced, which discovers the most recent checkpoint
before block syncing even starts.