mirror of
https://github.com/dashpay/dash.git
synced 2024-12-27 04:52:59 +01:00
Merge pull request #3616 from PastaPastaPasta/backports-0.17-pr14
Backports 0.17 pr14
This commit is contained in:
commit
e992a30901
@ -2,12 +2,6 @@ Contents
|
|||||||
========
|
========
|
||||||
This directory contains tools for developers working on this repository.
|
This directory contains tools for developers working on this repository.
|
||||||
|
|
||||||
check-doc.py
|
|
||||||
============
|
|
||||||
|
|
||||||
Check if all command line args are documented. The return value indicates the
|
|
||||||
number of undocumented args.
|
|
||||||
|
|
||||||
clang-format-diff.py
|
clang-format-diff.py
|
||||||
===================
|
===================
|
||||||
|
|
||||||
|
@ -24,17 +24,6 @@ for HEADER_FILE in $(filter_suffix h); do
|
|||||||
echo
|
echo
|
||||||
EXIT_CODE=1
|
EXIT_CODE=1
|
||||||
fi
|
fi
|
||||||
CPP_FILE=${HEADER_FILE/%\.h/.cpp}
|
|
||||||
if [[ ! -e $CPP_FILE ]]; then
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
DUPLICATE_INCLUDES_IN_HEADER_AND_CPP_FILES=$(grep -hE "^#include " <(sort -u < "${HEADER_FILE}") <(sort -u < "${CPP_FILE}") | grep -E "^#include " | sort | uniq -d)
|
|
||||||
if [[ ${DUPLICATE_INCLUDES_IN_HEADER_AND_CPP_FILES} != "" ]]; then
|
|
||||||
echo "Include(s) from ${HEADER_FILE} duplicated in ${CPP_FILE}:"
|
|
||||||
echo "${DUPLICATE_INCLUDES_IN_HEADER_AND_CPP_FILES}"
|
|
||||||
echo
|
|
||||||
EXIT_CODE=1
|
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
|
|
||||||
for CPP_FILE in $(filter_suffix cpp); do
|
for CPP_FILE in $(filter_suffix cpp); do
|
||||||
|
@ -375,12 +375,21 @@ C++ data structures
|
|||||||
|
|
||||||
- Vector bounds checking is only enabled in debug mode. Do not rely on it
|
- Vector bounds checking is only enabled in debug mode. Do not rely on it
|
||||||
|
|
||||||
- Make sure that constructors initialize all fields. If this is skipped for a
|
- Initialize all non-static class members where they are defined.
|
||||||
good reason (i.e., optimization on the critical path), add an explicit
|
If this is skipped for a good reason (i.e., optimization on the critical
|
||||||
comment about this
|
path), add an explicit comment about this
|
||||||
|
|
||||||
- *Rationale*: Ensure determinism by avoiding accidental use of uninitialized
|
- *Rationale*: Ensure determinism by avoiding accidental use of uninitialized
|
||||||
values. Also, static analyzers balk about this.
|
values. Also, static analyzers balk about this.
|
||||||
|
Initializing the members in the declaration makes it easy to
|
||||||
|
spot uninitialized ones.
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
class A
|
||||||
|
{
|
||||||
|
uint32_t m_count{0};
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
- By default, declare single-argument constructors `explicit`.
|
- By default, declare single-argument constructors `explicit`.
|
||||||
|
|
||||||
@ -399,18 +408,6 @@ C++ data structures
|
|||||||
- *Rationale*: Easier to understand what is happening, thus easier to spot mistakes, even for those
|
- *Rationale*: Easier to understand what is happening, thus easier to spot mistakes, even for those
|
||||||
that are not language lawyers
|
that are not language lawyers
|
||||||
|
|
||||||
- Initialize all non-static class members where they are defined
|
|
||||||
|
|
||||||
- *Rationale*: Initializing the members in the declaration makes it easy to spot uninitialized ones,
|
|
||||||
and avoids accidentally reading uninitialized memory
|
|
||||||
|
|
||||||
```cpp
|
|
||||||
class A
|
|
||||||
{
|
|
||||||
uint32_t m_count{0};
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Strings and formatting
|
Strings and formatting
|
||||||
------------------------
|
------------------------
|
||||||
|
|
||||||
@ -529,8 +526,7 @@ Source code organization
|
|||||||
avoided when using only lowercase characters in source code filenames.
|
avoided when using only lowercase characters in source code filenames.
|
||||||
|
|
||||||
- Every `.cpp` and `.h` file should `#include` every header file it directly uses classes, functions or other
|
- Every `.cpp` and `.h` file should `#include` every header file it directly uses classes, functions or other
|
||||||
definitions from, even if those headers are already included indirectly through other headers. One exception
|
definitions from, even if those headers are already included indirectly through other headers.
|
||||||
is that a `.cpp` file does not need to re-include the includes already included in its corresponding `.h` file.
|
|
||||||
|
|
||||||
- *Rationale*: Excluding headers because they are already indirectly included results in compilation
|
- *Rationale*: Excluding headers because they are already indirectly included results in compilation
|
||||||
failures when those indirect dependencies change. Furthermore, it obscures what the real code
|
failures when those indirect dependencies change. Furthermore, it obscures what the real code
|
||||||
|
@ -25,6 +25,12 @@ struct CCheckpointData {
|
|||||||
MapCheckpoints mapCheckpoints;
|
MapCheckpoints mapCheckpoints;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Holds various statistics on transactions within a chain. Used to estimate
|
||||||
|
* verification progress during chain sync.
|
||||||
|
*
|
||||||
|
* See also: CChainParams::TxData, GuessVerificationProgress.
|
||||||
|
*/
|
||||||
struct ChainTxData {
|
struct ChainTxData {
|
||||||
int64_t nTime;
|
int64_t nTime;
|
||||||
int64_t nTxCount;
|
int64_t nTxCount;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
This directory contains the DashQT graphical user interface (GUI). It uses the cross platform framework [QT](https://www1.qt.io/developers/).
|
This directory contains the DashQT graphical user interface (GUI). It uses the cross-platform framework [Qt](https://www1.qt.io/developers/).
|
||||||
|
|
||||||
The current precise version for QT 5 is specified in [qt.mk](/depends/packages/qt.mk). QT 4 is not supported.
|
The current precise version for Qt 5 is specified in [qt.mk](/depends/packages/qt.mk). Qt 4 is not supported.
|
||||||
|
|
||||||
## Compile and run
|
## Compile and run
|
||||||
|
|
||||||
@ -16,7 +16,7 @@ To run:
|
|||||||
|
|
||||||
### forms
|
### forms
|
||||||
|
|
||||||
Contains [Designer UI](http://doc.qt.io/qt-5.9/designer-using-a-ui-file.html) files. They are created with [Qt Creator](#use-qt-Creator-as IDE), but can be edited using any text editor.
|
Contains [Designer UI](http://doc.qt.io/qt-5.9/designer-using-a-ui-file.html) files. They are created with [Qt Creator](#using-qt-creator-as-ide), but can be edited using any text editor.
|
||||||
|
|
||||||
### locale
|
### locale
|
||||||
|
|
||||||
@ -36,7 +36,7 @@ Represents the main window of the Dash UI.
|
|||||||
|
|
||||||
### \*model.(h/cpp)
|
### \*model.(h/cpp)
|
||||||
|
|
||||||
The model. When it has a corresponding controller, it generally inherits from [QAbstractTableModel](http://doc.qt.io/qt-5/qabstracttablemodel.html). Models that are used by controllers as helpers inherit from other QT classes like [QValidator](http://doc.qt.io/qt-5/qvalidator.html).
|
The model. When it has a corresponding controller, it generally inherits from [QAbstractTableModel](http://doc.qt.io/qt-5/qabstracttablemodel.html). Models that are used by controllers as helpers inherit from other Qt classes like [QValidator](http://doc.qt.io/qt-5/qvalidator.html).
|
||||||
|
|
||||||
ClientModel is used by the main application `bitcoingui` and several models like `peertablemodel`.
|
ClientModel is used by the main application `bitcoingui` and several models like `peertablemodel`.
|
||||||
|
|
||||||
@ -69,7 +69,7 @@ Represents the view to a single wallet.
|
|||||||
|
|
||||||
## Contribute
|
## Contribute
|
||||||
|
|
||||||
See [CONTRIBUTING.md](/CONTRIBUTING.md) for general guidelines. Specifically for QT:
|
See [CONTRIBUTING.md](/CONTRIBUTING.md) for general guidelines. Specifically for Qt:
|
||||||
|
|
||||||
* don't change `local/dash_en.ts`; this happens [automatically](/doc/translation_process.md#writing-code-with-translations)
|
* don't change `local/dash_en.ts`; this happens [automatically](/doc/translation_process.md#writing-code-with-translations)
|
||||||
|
|
||||||
@ -83,7 +83,7 @@ Uncheck everything except Qt Creator during the installation process.
|
|||||||
|
|
||||||
Instructions for OSX:
|
Instructions for OSX:
|
||||||
|
|
||||||
1. Make sure you installed everything through Homebrew mentioned in the [OSX build instructions](/docs/build-osx.md)
|
1. Make sure you installed everything through Homebrew mentioned in the [OSX build instructions](/doc/build-osx.md)
|
||||||
2. Use `./configure` with the `--enable-debug` flag
|
2. Use `./configure` with the `--enable-debug` flag
|
||||||
3. In Qt Creator do "New Project" -> Import Project -> Import Existing Project
|
3. In Qt Creator do "New Project" -> Import Project -> Import Existing Project
|
||||||
4. Enter "dash-qt" as project name, enter src/qt as location
|
4. Enter "dash-qt" as project name, enter src/qt as location
|
||||||
|
@ -245,6 +245,7 @@ UniValue prioritisetransaction(const JSONRPCRequest& request)
|
|||||||
"\nArguments:\n"
|
"\nArguments:\n"
|
||||||
"1. \"txid\" (string, required) The transaction id.\n"
|
"1. \"txid\" (string, required) The transaction id.\n"
|
||||||
"2. fee_delta (numeric, required) The fee value (in duffs) to add (or subtract, if negative).\n"
|
"2. fee_delta (numeric, required) The fee value (in duffs) to add (or subtract, if negative).\n"
|
||||||
|
" Note, that this value is not a fee rate. It is a value to modify absolute fee of the TX.\n"
|
||||||
" The fee is not actually paid, only the algorithm for selecting transactions into a block\n"
|
" The fee is not actually paid, only the algorithm for selecting transactions into a block\n"
|
||||||
" considers the transaction as it would have paid a higher (or lower) fee.\n"
|
" considers the transaction as it would have paid a higher (or lower) fee.\n"
|
||||||
"\nResult:\n"
|
"\nResult:\n"
|
||||||
|
@ -166,6 +166,10 @@ public:
|
|||||||
|
|
||||||
bool ActivateBestChain(CValidationState &state, const CChainParams& chainparams, std::shared_ptr<const CBlock> pblock);
|
bool ActivateBestChain(CValidationState &state, const CChainParams& chainparams, std::shared_ptr<const CBlock> pblock);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If a block header hasn't already been seen, call CheckBlockHeader on it, ensure
|
||||||
|
* that it doesn't descend from an invalid block, and then add it to mapBlockIndex.
|
||||||
|
*/
|
||||||
bool AcceptBlockHeader(const CBlockHeader& block, CValidationState& state, const CChainParams& chainparams, CBlockIndex** ppindex) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
|
bool AcceptBlockHeader(const CBlockHeader& block, CValidationState& state, const CChainParams& chainparams, CBlockIndex** ppindex) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
|
||||||
bool AcceptBlock(const std::shared_ptr<const CBlock>& pblock, CValidationState& state, const CChainParams& chainparams, CBlockIndex** ppindex, bool fRequested, const CDiskBlockPos* dbp, bool* fNewBlock) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
|
bool AcceptBlock(const std::shared_ptr<const CBlock>& pblock, CValidationState& state, const CChainParams& chainparams, CBlockIndex** ppindex, bool fRequested, const CDiskBlockPos* dbp, bool* fNewBlock) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
|
||||||
|
|
||||||
@ -198,6 +202,11 @@ private:
|
|||||||
CBlockIndex* AddToBlockIndex(const CBlockHeader& block, enum BlockStatus nStatus = BLOCK_VALID_TREE) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
|
CBlockIndex* AddToBlockIndex(const CBlockHeader& block, enum BlockStatus nStatus = BLOCK_VALID_TREE) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
|
||||||
/** Create a new block index entry for a given block hash */
|
/** Create a new block index entry for a given block hash */
|
||||||
CBlockIndex* InsertBlockIndex(const uint256& hash) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
|
CBlockIndex* InsertBlockIndex(const uint256& hash) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
|
||||||
|
/**
|
||||||
|
* Make various assertions about the state of the block index.
|
||||||
|
*
|
||||||
|
* By default this only executes fully when using the Regtest chain; see: fCheckBlockIndex.
|
||||||
|
*/
|
||||||
void CheckBlockIndex(const Consensus::Params& consensusParams);
|
void CheckBlockIndex(const Consensus::Params& consensusParams);
|
||||||
|
|
||||||
void InvalidBlockFound(CBlockIndex *pindex, const CValidationState &state);
|
void InvalidBlockFound(CBlockIndex *pindex, const CValidationState &state);
|
||||||
@ -283,7 +292,8 @@ namespace {
|
|||||||
|
|
||||||
CBlockIndex* FindForkInGlobalIndex(const CChain& chain, const CBlockLocator& locator)
|
CBlockIndex* FindForkInGlobalIndex(const CChain& chain, const CBlockLocator& locator)
|
||||||
{
|
{
|
||||||
// Find the first block the caller has in the main chain
|
// Find the latest block common to locator and chain - we expect that
|
||||||
|
// locator.vHave is sorted descending by height.
|
||||||
for (const uint256& hash : locator.vHave) {
|
for (const uint256& hash : locator.vHave) {
|
||||||
BlockMap::iterator mi = mapBlockIndex.find(hash);
|
BlockMap::iterator mi = mapBlockIndex.find(hash);
|
||||||
if (mi != mapBlockIndex.end())
|
if (mi != mapBlockIndex.end())
|
||||||
@ -2936,6 +2946,10 @@ static void NotifyHeaderTip() LOCKS_EXCLUDED(cs_main) {
|
|||||||
* Make the best chain active, in multiple steps. The result is either failure
|
* Make the best chain active, in multiple steps. The result is either failure
|
||||||
* or an activated best chain. pblock is either nullptr or a pointer to a block
|
* or an activated best chain. pblock is either nullptr or a pointer to a block
|
||||||
* that is already loaded (to avoid loading it again from disk).
|
* that is already loaded (to avoid loading it again from disk).
|
||||||
|
*
|
||||||
|
* ActivateBestChain is split into steps (see ActivateBestChainStep) so that
|
||||||
|
* we avoid holding cs_main for an extended period of time; the length of this
|
||||||
|
* call may be quite long during reindexing or a substantial reorg.
|
||||||
*/
|
*/
|
||||||
bool CChainState::ActivateBestChain(CValidationState &state, const CChainParams& chainparams, std::shared_ptr<const CBlock> pblock) {
|
bool CChainState::ActivateBestChain(CValidationState &state, const CChainParams& chainparams, std::shared_ptr<const CBlock> pblock) {
|
||||||
// Note that while we're often called here from ProcessNewBlock, this is
|
// Note that while we're often called here from ProcessNewBlock, this is
|
||||||
@ -3606,6 +3620,9 @@ bool CChainState::AcceptBlockHeader(const CBlockHeader& block, CValidationState&
|
|||||||
if (!ContextualCheckBlockHeader(block, state, chainparams, pindexPrev, GetAdjustedTime()))
|
if (!ContextualCheckBlockHeader(block, state, chainparams, pindexPrev, GetAdjustedTime()))
|
||||||
return error("%s: Consensus::ContextualCheckBlockHeader: %s, %s", __func__, hash.ToString(), FormatStateMessage(state));
|
return error("%s: Consensus::ContextualCheckBlockHeader: %s, %s", __func__, hash.ToString(), FormatStateMessage(state));
|
||||||
|
|
||||||
|
// If the previous block index isn't valid, determine if it descends from any block which
|
||||||
|
// has been found invalid (g_failed_blocks), then mark pindexPrev and any blocks
|
||||||
|
// between them as failed.
|
||||||
if (!pindexPrev->IsValid(BLOCK_VALID_SCRIPTS)) {
|
if (!pindexPrev->IsValid(BLOCK_VALID_SCRIPTS)) {
|
||||||
for (const CBlockIndex* failedit : g_failed_blocks) {
|
for (const CBlockIndex* failedit : g_failed_blocks) {
|
||||||
if (pindexPrev->GetAncestor(failedit->nHeight) == failedit) {
|
if (pindexPrev->GetAncestor(failedit->nHeight) == failedit) {
|
||||||
|
@ -81,6 +81,7 @@ UniValue importprivkey(const JSONRPCRequest& request)
|
|||||||
throw std::runtime_error(
|
throw std::runtime_error(
|
||||||
"importprivkey \"privkey\" ( \"label\" ) ( rescan )\n"
|
"importprivkey \"privkey\" ( \"label\" ) ( rescan )\n"
|
||||||
"\nAdds a private key (as returned by dumpprivkey) to your wallet. Requires a new wallet backup.\n"
|
"\nAdds a private key (as returned by dumpprivkey) to your wallet. Requires a new wallet backup.\n"
|
||||||
|
"Hint: use importmulti to import more than one private key.\n"
|
||||||
"\nArguments:\n"
|
"\nArguments:\n"
|
||||||
"1. \"privkey\" (string, required) The private key (see dumpprivkey)\n"
|
"1. \"privkey\" (string, required) The private key (see dumpprivkey)\n"
|
||||||
"2. \"label\" (string, optional, default=\"\") An optional label\n"
|
"2. \"label\" (string, optional, default=\"\") An optional label\n"
|
||||||
|
Loading…
Reference in New Issue
Block a user