This modifies the logic which sends winning ticket notifications to RPC
clients to consider the reorganization depth and refuse to send the
notifications for blocks on side chains that would ultimately result in
a reorg of 6 or more blocks.
Also, the code used to send the notifications was needlessly repeated in
multiple places since any blocks accepted via ProcessBlock also result
in an accepted notification and therefore the RPC notification only
needs to be sent from there.
This corrects the handler for the rebroadcastwinners RPC to return the
hash of the block the tickets are voting on when there are multiple
candidates at the current tip as opposed to all claiming to vote on the
current best block.
This modifies the ProcessBlock function in the blockchain package to
return the fork length for the connected block and updates all callers
and tests accordingly. Several of the internal functions which
ProcessBlock calls are also updated in order to bubble the necessary
information back up so it can be returned. It does not make any
behavioral changes.
This is being done to better expose information about the position of
the block within the chain to callers without them having to make
additional queries.
The SplitTx parameter for PurchaseTicketCmd specifies theminimumnumberof inputs needed to use a split transaction for aticketpurchase. Theparameter options are 1 and 2. Ticket purchaseinputsless than the setSplitTx value are used directly in thetransaction.
This lowers the default minimum relay fee to 0.0001 DCR/Kb from its
previous value of 0.001 DCR/Kb and increases the high fee multiplier to
keep the same default high fee threshold of 1 DCR/kB.
In order to keep the comments accurate, it also updates the comments in
the isDust function and the sample config file to match the new default
relay fee as it's nice to have the most recent values as a reference in
the comments.
Finally, it updates the tests for the expected new values as a result of
the reduced default relay fee and adds add a couple of dust tests just
below and above the dust point for the new reduced default relay fee.
It should be noted that this is only a default node policy change and as
such does not affect the consensus rules in any way.
This cleans up the code for handling the substr opcode to explicitly
call out its semantics which are likely not otherwise obvious as well as
improve its readability.
Now that wire has been defined, update the chaincfg module to only
depend on it instead of the entire dcrd module. The chainhash
dependency is handled transitively via wire.
Now that wire has been defined, update the addrmgr module to only depend
on it instead of the entire dcrd module. Also, since there is no longer
a dep on the entire dcrd module to pick it up transitively, add the slog
dep as well.
This adds module support for the versioned go toolchain to the chainhash package.
It does not update the travis build environment or README since it is
experimental at this point.
This adds module support for the versioned go toolchain. In particular,
the following packages are defined as modules:
* addrmgr
* blockchain
* certgen
* chaincfg
* connmgr
* database
* dcrjson
* dcrutil
* gcs
* hdkeychain
* mempool
* mining
* peer
* rpcclient
* txscript
* wire
It does not update the travis build environment or README since it is
experimental at this point.
This modifies all packages within the repository to the use the Decred
fork of btclog which has been renamed to slog and updates the dependency
files accordingly.
This PR replaces chainec function calls within the mempool packagewith the underlining secp256k1 functions. This is in preparation forremoving the chainec package.
This PR replaces chainec function calls within the blockchain package
with the underlining secp256k1 functions. This is in preparation for
removing the chainec package.
PubKey() returns the corresponding public key of the referenced private
key. This is preferred to Public() which returns the X and Y values
of the public key instead. Public() is scheduled to be removed after
the imposed chainec interface restrictions are removed.
The chainec package is scheduled to be removed. This PR replaces
chainec function calls within the hdkeychain package with the
underlining secp256k1 types and fields which breaks its dependence
on a package soon to be removed. memwallet, a member of rpctest which
calls hdkeychain functions is also updated.
This modifies the example for connecting to the dcrd RPC server from
node.js to work with node.js v8.11.1 LTS and v10.0.1 along with calling
out the tested version and requirement for the additional ecdhCurve
parameter on v8.11.1 LTS.
This removes the ScriptStrictMultiSig flag from the txscript package
since it is not used or needed by Decred.
The flag is a holdover from the upstream code which was used to address
a bug that does not exist in Decred.
This modifies the pruning code to make use of the newly available
function in blockchain to test if a transaction is expired.
While here, it makes the comments on the functions more consistent with
others and moves the unexported definition before the exported function
from which it is used.
The CheckTransactionInputs, as it name suggested, is only intended to
perform validation that requires the inputs to transactions.
Consequently, this moves the check for validating the transactions in
the block are not expired into the checkBlockContext function where it
more naturally belongs since it is only dependent on the block and its
contextual position within the chain.
Since this check is also needed by the mempool, it refactors the check
into separate functions named IsExpired and IsExpiredTx, which work with
both util transactions and raw wire transactions, respectively, and
updates mempool to perform the necessary check by making use of them.
previously fullblocktests entries required in-depth knowledge of the
stake tree in order to retrieve the prevailing ticket price.
`ticketPrice := b.STransactions[5].TxOut[0].Value`
Standardness rules are not the same as consensus rules and it is
important to keep clear separation between them, because standardness
rules can and do change, while the consensus rules must not change
without a specific vote, and even then, the old rules must be kept
around for validation of all blocks prior to any changes introduced by a
successful vote.
Prior to this commit, the blockchain code which enforces the consensus
rule that requires the second output of the coinbase transaction to
contain the height of the block in a provably pruneable nulldata script
push was relying on code in txscript/standard.go, which, as the name of
the file suggests, is specifically intended for code related to
standardness checks.
This introduces a new function in the txscript package named
ExtractCoinbaseNullData which does not rely on any of the code related
to standardness checks and modifies the blockchain code accordingly to
make use of the new function instead. It also removes the
standardness-dependent GetNullDataContent function which is no longer
used by anything.
Finally, it adds tests in the txscript package to ensure the new
function has the required semantics.
This introduces a new pool membership test function to the mempool
testing infrastructure and refactors the tests to make use of it.
It is useful since it is common logic that is not only needed in the
existing tests, but will be needed by most mempool-related tests.
This corrects an issue introduced by commit
c6f9474348 which resulted in empty paths
that were cleaned and expanded being transformed into "." instead of
having no effect as intended.
This adds a test to ensure blocks with an expired transaction in the
stake tree is rejected as expected.
While here, it also updates the existing test for an expired transaction
in the regular tree to be the exact block height which is including it
to help detect any off by one errors.
This removes the CheckConnectBlock function in favor of a new function
named CheckConnectBlockTemplate which more accurately reflects its
purpose of testing block template proposals and uses this fact to be
more restrictive about the allowed inputs and to avoid performing the
proof of work check.
In particular, the provided block template must only build from the
current tip or its parent or an error is returned.
All mining code has been updated to call the new function accordingly.
Finally, it also adds a full suite of tests for the new function using
the chaingen framework in order to ensure proper functionality.
This removes the TxSerializeWitnessSigning serialization type since
it is no longer required due to implementing it directly in the
signature hash calculation function. It also removes all related tests.
Although this is technically a change to the wire protocol, the protocol
version is not being bumped because nothing ever sends messages using
this serialization type as it only applied for calculating signature
hashes and really should not have ever been in the wire package to begin
with.
This modifies the signature hash calculation logic to completely
decouple it from the wire transaction serialization and significantly
optimizes it in the process. It also significantly improves the
comments to specifically call out the semantics.
This change is highly desirable because it has several beneficial
properties:
- The signature hash semantics are much clearer and specific
- There is no longer a need to copy the entire transaction and modify
the relevant portions since the necessary substitutions are made on
the fly
- Allows much faster calculation by serializing directly into byte
slices and avoiding all of the additional error handling logic
dedicated to handling network streams
- Provides the possibility of changing the wire format without breaking
signature hash calculation
- Note that the caching portion still relies on the wire format, but
that can be addressed in future commits since it is merely an
optimization that can also be decoupled
The following is a before and after comparison of signature hash
calculation for both speed and memory allocations for a transaction with
many inputs:
benchmark old ns/op new ns/op delta
------------------------------------------------------------
BenchmarkCalcSigHash 6299714 1551740 -75.37%
benchmark old allocs new allocs delta
------------------------------------------------------------
BenchmarkCalcSigHash 18601 1691 -90.91%