This makes use of the newly exposed notification from blockchain when a
block that intends to extend the main chain has passed all sanity and
contextual checks to relay the block the rest of the network at that
point rather than needing to wait for the more expensive connection code
to complete.
This adds a new notification type to blockchain which allows the caller
to be notified when a block that intents to extend the main chain has
passed all sanity and contextual checks such as having valid proof of
work, valid merkle and stake roots, and only containing allowed votes
and revocations.
The intention is to allow faster relay of new tip blocks throughout the
network by providing a means to relay it before the more expensive
connection code takes place even though it may ultimately fail to
connect.
This is acceptable because blocks that pass all of the aforementioned
checks and then fail to connect are quite rare since it takes a
significant amount of work to create a block which satisfies the proof
of work requirement as well as all other checks up to that point.
This modifies the infrastructure for the server inventory relay to allow
the caller to specify the inventory should be announced immediately
versus using the typical trickle mechanism.
It also updates all callers in the repository and changes the relay of
accepted blocks use the new ability.
This adds a new function to peers which allows an inventory vector to be
queued for immediate send versus the standard trickling batched
inventory queue method while still respecting the functionality which
filters attempts to notify peers about inventory that they are already
known to have.
This modifies the code in blockchain to make less assumptions about the
availability of the block data by checking the status flags to determine
whether or not it is available.
While currently there aren't actually ever any nodes in the block index
that don't have the full block data available, that will not always be
true in the future.
This modifies the results provided by the getrawtransaction and
searchrawtransactions RPCs to make them consistent with each other.
In particular, it adds the transaction expiry, block height, and block
index fields to the searchrawtransactions result and ensures that both
omit the block height when it is zero so that it is not included in the
results for mempool transactions.
Since populating the block index requires additional details to be
stored to the transaction index to efficiently provide, only the
infrastructure is added and the value is left as the default for now,
which means it will be omitted and therefore not change the visible
behavior.
Finally, it also updates the RPC server help to provide consistent
descriptions for the fields and also updates the JSON-RPC documentation.
This modifies the functions in the exists address index to use the
internalBucket interface instead of directly taking a database.Bucket
interface. This allows tests to mock the data the source and is
consistent with the address index.
This removes the implementation of the NeedsInputser interface on the
exists address index since not implementing the interface is the same as
implementing it and returning false.
This is desirable because not only is it less code, it is consistent
with the transaction index.
This introduces a new internal package named version to house the
version information and updates the various code to use it. This allows
both dcrd and dcrctl to make use of the package so the version
information only needs to be bumped in one place and also ensure that
any link-time overrides to the pre-release and/or build metadata apply
to both.
Also, while here, include the OS and architecture in the version log at
start of day as well as the output from the version CLI flag.
This corrects the NextPoolSize field that was recently added to the best
state when a block is disconnected to calculate the next pool size
relative to the previous block since it will become the new best state.
This makes the style of the function definitions in the dcrcec/edwards
package more consistent with the code throughout the rest of the code
base.
Also, move the nil check for pubkey parsing to the top of the function
before any more work is done.
Current code results in transactions from invalidated blocks being
removed from the mempool instead of remaining there to be mined in a
future block.
The new version ensures that transactions are *only* removed once they
are in a block voted as valid.
This only applies to regular transactions, since stake transactions are
not affected by the validity bits.
This improves trace logs related to transaction removal from the
mempool. During some debugging, they were found to be slightly
misleading in their current form.
This adds PrevHash, NextPoolSize, NextStakeDiff, NextWinningTickets,
MissedTickets and NextFinalState fields to BestState.
Port of upstream commit c57c18c. In preparation of the removal of
chainState.
This marks the start of a new release process as compared to previous
releases.
Instead of bumping the version just before a release and releasing from
the master branch, as has been done up to this point, the minor (or
major when necessary) will now be bumped on the master branch at the
beginning of a release cycle. In addition, the pre-release portion of
the semantic version is now the string "pre" to help make it more
obvious that the master branch represents a pre-release build of work
leading up to the next release.
When a new release is prepared, a new release branch will be created
that has a naming scheme of "release-vX.Y", where X is the major and Y
is the minor. Any additional commits needed to prepare the release
leading up to a release candidate will be cherry-picked to the release
branch, and all tags for releases and release candidates will be created
against that.
This implies that should any additional patch releases be necessary, the
relevant commits will also be cherry-picked to the release branch as
needed, followed by a new release candidate for the patch release and
the eventual patch release.
This adds a new parameter named UserAgentComments to the peer Config
struct so that callers may specify additional comments to add to the
user agent string.
It also updates the server to include the prelease portion of the
semantic version as a comment when creating peers.
This updates the interface tests in database/ffldb to reference the
block tests within the same module as opposed to escaping the module to
find it in the blockchain module.
This should have been a part of the previous commit that performs the
same, but was missed.
This modifies the fullblocktests that create a temporary database to
make use of ioutil.TempDir instead of a relative directory path. This
allows the tests to be run from any path without failure.
This updates the tests in database/ffldb and blockchain/stake to
reference the block tests within the same module as opposed to escaping
the module to find it in the blockchain module.
This is necessary for the new test all functionality of the upcoming
go1.11 release since it individually tests each module in a separate
path and therefore it prevent the ability to use relative paths that
escape the module.
Unfortunately, this means the data had to be copied, but, but it's not a
huge amount of data, and it seems that git mostly deduplicates the data
internally.
This modifies the various tests that create temporary databases to make
use of ioutil.TempDir instead of a relative directory path. This allows
the tests to be run from any path without failure.
This modifies the getcfilter and getcfilterheader RPC handlers to return
an error when an unknown block is provided as opposed an empty filter in
the case of the former and an all-zero hash in the case of the latter.
It also modifies the error returned when an unknown filter type is
specified to indicate an invalid parameter as opposed to a misc error so
it is more consistent with the other handlers.
Finally, it removes the debug logs in the error cases since the errors
are now returned to the caller.
This modifies the block connection logic to also mark the status of
blocks that are not already known to be valid in the fast add code path
as valid.
This change is being made because the intent of the fast add path is to
skip expensive checks on blocks which are already assumed to be valid
due to checkpoints and therefore should be marked accordingly.
Also, since the status for those blocks in the block index does not have
them marked valid, mark them all ancestors of the current tip as valid
init time.
This bumps the various module versions as follows:
- github.com/decred/dcrd/addrmgr@v1.0.2
- github.com/decred/dcrd/wire@v1.1.0
- github.com/decred/dcrd/chaincfg@v1.1.1
- github.com/decred/dcrd/connmgr@v1.0.1
- github.com/decred/dcrd/dcrutil@v1.1.1
- github.com/decred/dcrd/database@v1.0.1
- github.com/decred/dcrd/hdkeychain@v1.1.0
- github.com/decred/dcrd/txscript@v1.0.1
- github.com/decred/dcrd/blockchain/stake@v1.0.1
- github.com/decred/dcrd/gcs@v1.0.1
- github.com/decred/dcrd/blockchain@v1.0.1
- github.com/decred/dcrd/mining@v1.0.1
- github.com/decred/dcrd/mempool@v1.0.1
- github.com/decred/dcrd/peer@v1.0.1
- github.com/decred/dcrd/rpcclient@v1.0.1
It also updates all of the dependencies for every module accordingly and
adds a few missing overrides for transitive dependencies.
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.
This modifies the logic which allows the reduction of difficulty on
testnet to match the upstream code such that after a block has not been
produced for a long period of time, as configured by the parameters, the
difficulty drops to the minimum allowed by the configured proof-of-work
limit for the network.
It should be noted that this would be a hard fork if the test network
had the code path enabled, however, since the code is disabled for
testnet2, it does not technically change the consensus rules for it.
The modified code will be active for testnet3.
This modifies the test code for several unit tests to prefer using
another network, such as mainnet or simnet, when not specifically
testing something that requires testnet.
In the cases where where testnet is required, it also now prefers a
local reference over directly accessing the testnet parameters directly
from the chaincfg package.
This is being done because the test network undergoes periodic resets
and by reducing the number of direct references, it simplifies the
process of resetting it.
This removes the funcs which were used to override the test network name
as they were inherited from the upstream code and, once testnet v2 was
introduced, were no longer needed, but unfortunately weren't removed
accordingly.
This further refines the modules to add the following new modules
instead of depending on the entire dcrd module:
- github.com/decred/dcrd/dcrjson@v1.0.0
- github.com/decred/dcrd/blockchain@v1.0.0
- github.com/decred/dcrd/blockchain/stake@v1.0.0
- github.com/decred/dcrd/gcs@v1.0.0
- github.com/decred/dcrd/mining@v1.0.0
- github.com/decred/dcrd/mempool@v1.0.0
- github.com/decred/dcrd/peer@v1.0.0
- github.com/decred/dcrd/rpcclient@v1.0.0
Also, it ensures modules that rely on other modules within the repo are
provided replacements to the latest repo code to ensure builds against
master and continuous integration use the latest code.
- github.com/decred/dcrd/addrmgr
- github.com/decred/dcrd/blockchain
- github.com/decred/dcrd/blockchain/stake
- github.com/decred/dcrd/chaincfg
- github.com/decred/dcrd/connmgr
- github.com/decred/dcrd/database
- github.com/decred/dcrd/dcrec/secp256k1
- github.com/decred/dcrd/dcrjson
- github.com/decred/dcrd/dcrutil
- github.com/decred/dcrd/gcs
- github.com/decred/dcrd/hdkeychain
- github.com/decred/dcrd/mempool
- github.com/decred/dcrd/mining
- github.com/decred/dcrd/peer
- github.com/decred/dcrd/rpcclient
- github.com/decred/dcrd/txscript
- github.com/decred/dcrd/wire
These functions and associated tests are being removed because nothing
depends on them and they end up creating a dependency on
blockchain/stake package, which is not desirable.
This modifies the way orphan removal and processing is done to more
aggressively remove orphans that can no longer be valid due to other
transactions being added or removed from the primary transaction pool.
The net effect of these changes is that orphan pool will typically be
much smaller which greatly improves its effectiveness. Previously, it
would typically quickly reach the max allowed worst-case usage and
effectively stay there forever.
The following is a summary of the changes:
- Modify the map that tracks which orphans redeem a given transaction to
instead track by the specific outpoints that are redeemed
- Modify the various orphan removal and processing functions to accept
the full transaction rather than just its hash
- Introduce a new flag on removeOrphans which specifies whether or not
to remove the transactions that redeem the orphan being removed as
well which is necessary since only some paths require it
- Add a new function named removeOrphanDoubleSpends that is invoked
whenever a transaction is added to the main pool and thus the outputs
they spent become concrete spends
- Introduce a new flag on maybeAcceptTransaction which specifies whether
or not duplicate orphans should be rejected since only some paths
require it
- Modify processOrphans as follows:
- Make use of the modified map
- Use newly available flags and logic work more strictly work with tx
chains
- Recursively remove any orphans that also redeem any outputs redeemed
by the accepted transactions
- Several new tests to ensure proper functionality
- Removing an orphan that doesn't exist is removed both when there is
another orphan that redeems it and when there is not
- Removing orphans works properly with orphan chains per the new
remove redeemers flag
- Removal of multi-input orphans that double spend an output when a
concrete redeemer enters the transaction pool
Ticket purchase, vote and revocation orphan tests have also been added.