Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This requires #1820.
NOTE: This PR currently has a replacement for theblockchain
module that will need to be updated prior to merging this PR once said module is merged and tagged.In order to make use of
chaincfg/v2
,dcrutil/v2
,blockchain/stake/v2
,database/v2
andtxscript/v2
, a new major version ofblockchain
module is required becauseblockchain/v1
accepts and returns types from all of them in its API.Since a new major version is required, this also takes the opportunity handle a couple of other items that require a major version bump:
SubsidyCache
to use from the caller instead of creating a local one the caller must later queryConsequently, this introduces
blockchain/v2
which addresses the aforementioned items. A series of individual commits is provided to make the review process easier. Each commit message more thoroughly describes its purpose, but primarily they consist of the following:blockchain
module useblockchain
replace so building the software will still produce binaries based on thev1
module until thev2
module is fully releasedtxscript.CheckForDuplicateHashes
optimization toggleDisableLog
from bothblockchain
andindexers
packagesBlockOneCoinbasePaysTokens
IsCoinBase
IsCoinBaseTx
BuildMerkleTreeStore
BuildMsgTxMerkleTreeStore
SubsidyCache
NewSubsidyCache
CalcBlockWorkSubsidy
CalcStakeVoteSubsidy
CalcBlockTaxSubsidy
CoinbasePaysTax
CalculateAddedSubsidy
BestPrevHash
TotalSubsidy
FetchSubsidyCache
HashToBig
CompactToBig
BigToCompact
CalcWork
CheckProofOfWork
blockchain/stake/v2@v2.0.1
chaincfg/v2@v2.2.0
database/v2@v2.0.0
dcrutil/v2@v2.0.0
txscript/v2@v2.0.0
v2
Finally, it should also be noted that this only introduces the new module and does not update anything to make use of it yet, so building the software will still produce binaries based on the
v1
module.The following table provides a mapping of the removed items to their equivalents to aid consumers in upgrading:
DisableLog
UseLogger(slog.Disabled)
BlockOneCoinbasePaysTokens
IsCoinBase
standalone.IsCoinBaseTx
IsCoinBaseTx
standalone.IsCoinBaseTx
BuildMerkleTreeStore
standalone.CalcTxTreeMerkleRoot
BuildMsgTxMerkleTreeStore
standalone.CalcTxTreeMerkleRoot
SubsidyCache
standalone.SubsidyCache
NewSubsidyCache
standalone.NewSubsidyCache
CalcBlockWorkSubsidy
standalone.SubsidyCache.CalcWorkSubsidy
CalcStakeVoteSubsidy
standalone.SubsidyCache.CalcStakeVoteSubsidy
CalcBlockTaxSubsidy
standalone.SubsidyCache.CalcTreasurySubsidy
CoinbasePaysTax
CalculateAddedSubsidy
BestPrevHash
BestSnapshot.PrevHash
TotalSubsidy
BestSnapshot.TotalSubsidy
FetchSubsidyCache
standalone.NewSubsidyCache
passed to chain viaConfig
HashToBig
standalone.HashToBig
CompactToBig
standalone.CompactToBig
BigToCompact
standalone.BigToCompact
CalcWork
standalone.CalcWork
CheckProofOfWork
standalone.CheckProofOfWork