aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CONTRIBUTING.md6
-rw-r--r--contrib/README.md2
-rw-r--r--contrib/devtools/README.md2
-rw-r--r--doc/developer-notes.md2
-rw-r--r--doc/translation_process.md4
-rw-r--r--doc/zmq.md4
-rwxr-xr-xqa/rpc-tests/importmulti.py10
-rwxr-xr-xqa/rpc-tests/p2p-fullblocktest.py4
-rw-r--r--src/test/DoS_tests.cpp2
-rw-r--r--src/txmempool.cpp2
-rw-r--r--src/validation.cpp16
-rw-r--r--src/wallet/rpcdump.cpp3
-rw-r--r--src/wallet/wallet.h22
-rw-r--r--src/wallet/walletdb.cpp2
14 files changed, 50 insertions, 31 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 47648cde22..fc8d58d97d 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -38,7 +38,7 @@ fixes or code moves with actual code changes.
Commit messages should be verbose by default consisting of a short subject line
(50 chars max), a blank line and detailed explanatory text as separate
paragraph(s); unless the title alone is self-explanatory (like "Corrected typo
-in main.cpp") then a single title line is sufficient. Commit messages should be
+in init.cpp") then a single title line is sufficient. Commit messages should be
helpful to people reading your code in the future, so explain the reasoning for
your decisions. Further explanation [here](http://chris.beams.io/posts/git-commit/).
@@ -79,7 +79,7 @@ Examples:
Consensus: Add new opcode for BIP-XXXX OP_CHECKAWESOMESIG
Net: Automatically create hidden service, listen on Tor
Qt: Add feed bump button
- Trivial: Fix typo in main.cpp
+ Trivial: Fix typo in init.cpp
If a pull request is specifically not to be considered for merging (yet) please
prefix the title with [WIP] or use [Tasks Lists](https://help.github.com/articles/basic-writing-and-formatting-syntax/#task-lists)
@@ -194,7 +194,7 @@ request. Typically reviewers will review the code for obvious errors, as well as
test out the patch set and opine on the technical merits of the patch. Project
maintainers take into account the peer review when determining if there is
consensus to merge a pull request (remember that discussions may have been
-spread out over github, mailing list and IRC discussions). The following
+spread out over GitHub, mailing list and IRC discussions). The following
language is used within pull-request comments:
- ACK means "I have tested the code and I agree it should be merged";
diff --git a/contrib/README.md b/contrib/README.md
index 4ea9700f59..6f750106e4 100644
--- a/contrib/README.md
+++ b/contrib/README.md
@@ -3,7 +3,7 @@ Repository Tools
### [Developer tools](/contrib/devtools) ###
Specific tools for developers working on this repository.
-Contains the script `github-merge.py` for merging github pull requests securely and signing them using GPG.
+Contains the script `github-merge.py` for merging GitHub pull requests securely and signing them using GPG.
### [Verify-Commits](/contrib/verify-commits) ###
Tool to verify that every merge commit was signed by a developer using the above `github-merge.py` script.
diff --git a/contrib/devtools/README.md b/contrib/devtools/README.md
index 34f2af6866..67c5e15a15 100644
--- a/contrib/devtools/README.md
+++ b/contrib/devtools/README.md
@@ -125,7 +125,7 @@ check or whatever).
This means that there are no potential race conditions (where a
pullreq gets updated while you're reviewing it, but before you click
-merge), and when using GPG signatures, that even a compromised github
+merge), and when using GPG signatures, that even a compromised GitHub
couldn't mess with the sources.
Setup
diff --git a/doc/developer-notes.md b/doc/developer-notes.md
index 989ad8d03e..3a7e4f73b3 100644
--- a/doc/developer-notes.md
+++ b/doc/developer-notes.md
@@ -448,7 +448,7 @@ Current subtrees include:
- Upstream at https://github.com/jgarzik/univalue ; report important PRs to Core to avoid delay.
-Git and github tips
+Git and GitHub tips
---------------------
- For resolving merge/rebase conflicts, it can be useful to enable diff3 style using
diff --git a/doc/translation_process.md b/doc/translation_process.md
index 9e9ced2457..1702637d53 100644
--- a/doc/translation_process.md
+++ b/doc/translation_process.md
@@ -4,7 +4,7 @@ Translations
The Bitcoin-Core project has been designed to support multiple localisations. This makes adding new phrases, and completely new languages easily achievable. For managing all application translations, Bitcoin-Core makes use of the Transifex online translation management tool.
### Helping to translate (using Transifex)
-Transifex is setup to monitor the Github repo for updates, and when code containing new translations is found, Transifex will process any changes. It may take several hours after a pull-request has been merged, to appear in the Transifex web interface.
+Transifex is setup to monitor the GitHub repo for updates, and when code containing new translations is found, Transifex will process any changes. It may take several hours after a pull-request has been merged, to appear in the Transifex web interface.
Multiple language support is critical in assisting Bitcoin’s global adoption, and growth. One of Bitcoin’s greatest strengths is cross-border money transfers, any help making that easier is greatly appreciated.
@@ -32,7 +32,7 @@ QToolBar *toolbar = addToolBar(tr("Tabs toolbar"));
### Creating a pull-request
For general PRs, you shouldn’t include any updates to the translation source files. They will be updated periodically, primarily around pre-releases, allowing time for any new phrases to be translated before public releases. This is also important in avoiding translation related merge conflicts.
-When an updated source file is merged into the Github repo, Transifex will automatically detect it (although it can take several hours). Once processed, the new strings will show up as "Remaining" in the Transifex web interface and are ready for translators.
+When an updated source file is merged into the GitHub repo, Transifex will automatically detect it (although it can take several hours). Once processed, the new strings will show up as "Remaining" in the Transifex web interface and are ready for translators.
To create the pull-request, use the following commands:
```
diff --git a/doc/zmq.md b/doc/zmq.md
index 6079e3254f..1019ff6653 100644
--- a/doc/zmq.md
+++ b/doc/zmq.md
@@ -1,4 +1,4 @@
-# Block and Transaction Broadcasting With ZeroMQ
+# Block and Transaction Broadcasting with ZeroMQ
[ZeroMQ](http://zeromq.org/) is a lightweight wrapper around TCP
connections, inter-process communication, and shared-memory,
@@ -50,7 +50,7 @@ during the *configure* step of building bitcoind:
$ ./configure --disable-zmq (other options)
To actually enable operation, one must set the appropriate options on
-the commandline or in the configuration file.
+the command line or in the configuration file.
## Usage
diff --git a/qa/rpc-tests/importmulti.py b/qa/rpc-tests/importmulti.py
index 02a932e737..1aa4ba2e18 100755
--- a/qa/rpc-tests/importmulti.py
+++ b/qa/rpc-tests/importmulti.py
@@ -64,6 +64,16 @@ class ImportMultiTest (BitcoinTestFramework):
watchonly_address = address['address']
watchonly_timestamp = timestamp
+ print("Should not import an invalid address")
+ result = self.nodes[1].importmulti([{
+ "scriptPubKey": {
+ "address": "not valid address",
+ },
+ "timestamp": "now",
+ }])
+ assert_equal(result[0]['success'], False)
+ assert_equal(result[0]['error']['code'], -5)
+ assert_equal(result[0]['error']['message'], 'Invalid address')
# ScriptPubKey + internal
print("Should import a scriptPubKey with internal flag")
diff --git a/qa/rpc-tests/p2p-fullblocktest.py b/qa/rpc-tests/p2p-fullblocktest.py
index e4b889d761..44e5f10322 100755
--- a/qa/rpc-tests/p2p-fullblocktest.py
+++ b/qa/rpc-tests/p2p-fullblocktest.py
@@ -398,7 +398,7 @@ class FullBlockTest(ComparisonTestFramework):
# Extend the b26 chain to make sure bitcoind isn't accepting b26
b27 = block(27, spend=out[7])
- yield rejected(RejectResult(16, b'bad-prevblk'))
+ yield rejected(RejectResult(0, b'bad-prevblk'))
# Now try a too-large-coinbase script
tip(15)
@@ -410,7 +410,7 @@ class FullBlockTest(ComparisonTestFramework):
# Extend the b28 chain to make sure bitcoind isn't accepting b28
b29 = block(29, spend=out[7])
- yield rejected(RejectResult(16, b'bad-prevblk'))
+ yield rejected(RejectResult(0, b'bad-prevblk'))
# b30 has a max-sized coinbase scriptSig.
tip(23)
diff --git a/src/test/DoS_tests.cpp b/src/test/DoS_tests.cpp
index a8f09ba6ae..c62e6ae838 100644
--- a/src/test/DoS_tests.cpp
+++ b/src/test/DoS_tests.cpp
@@ -23,7 +23,7 @@
#include <boost/foreach.hpp>
#include <boost/test/unit_test.hpp>
-// Tests this internal-to-main.cpp method:
+// Tests these internal-to-net_processing.cpp methods:
extern bool AddOrphanTx(const CTransactionRef& tx, NodeId peer);
extern void EraseOrphansFor(NodeId peer);
extern unsigned int LimitOrphanTxSize(unsigned int nMaxOrphans);
diff --git a/src/txmempool.cpp b/src/txmempool.cpp
index 236527a2ba..5842dd88d8 100644
--- a/src/txmempool.cpp
+++ b/src/txmempool.cpp
@@ -395,7 +395,7 @@ bool CTxMemPool::addUnchecked(const uint256& hash, const CTxMemPoolEntry &entry,
{
NotifyEntryAdded(entry.GetSharedTx());
// Add to memory pool without checking anything.
- // Used by main.cpp AcceptToMemoryPool(), which DOES do
+ // Used by AcceptToMemoryPool(), which DOES do
// all the appropriate checks.
LOCK(cs);
indexed_transaction_set::iterator newit = mapTx.insert(entry).first;
diff --git a/src/validation.cpp b/src/validation.cpp
index fe8f8365be..4ce0723b21 100644
--- a/src/validation.cpp
+++ b/src/validation.cpp
@@ -3187,7 +3187,7 @@ static bool AcceptBlock(const std::shared_ptr<const CBlock>& pblock, CValidation
}
if (fNewBlock) *fNewBlock = true;
- if (!CheckBlock(block, state, chainparams.GetConsensus(), GetAdjustedTime()) ||
+ if (!CheckBlock(block, state, chainparams.GetConsensus()) ||
!ContextualCheckBlock(block, state, chainparams.GetConsensus(), pindex->pprev)) {
if (state.IsInvalid() && !state.CorruptionPossible()) {
pindex->nStatus |= BLOCK_FAILED_VALID;
@@ -3229,13 +3229,19 @@ static bool AcceptBlock(const std::shared_ptr<const CBlock>& pblock, CValidation
bool ProcessNewBlock(const CChainParams& chainparams, const std::shared_ptr<const CBlock> pblock, bool fForceProcessing, bool *fNewBlock)
{
{
- LOCK(cs_main);
-
- // Store to disk
CBlockIndex *pindex = NULL;
if (fNewBlock) *fNewBlock = false;
CValidationState state;
- bool ret = AcceptBlock(pblock, state, chainparams, &pindex, fForceProcessing, NULL, fNewBlock);
+ // Ensure that CheckBlock() passes before calling AcceptBlock, as
+ // belt-and-suspenders.
+ bool ret = CheckBlock(*pblock, state, chainparams.GetConsensus());
+
+ LOCK(cs_main);
+
+ if (ret) {
+ // Store to disk
+ ret = AcceptBlock(pblock, state, chainparams, &pindex, fForceProcessing, NULL, fNewBlock);
+ }
CheckBlockIndex(chainparams.GetConsensus());
if (!ret) {
GetMainSignals().BlockChecked(*pblock, state);
diff --git a/src/wallet/rpcdump.cpp b/src/wallet/rpcdump.cpp
index 0a3225937e..908655d411 100644
--- a/src/wallet/rpcdump.cpp
+++ b/src/wallet/rpcdump.cpp
@@ -672,6 +672,9 @@ UniValue ProcessImport(const UniValue& data, const int64_t timestamp)
if (!isScript) {
address = CBitcoinAddress(output);
+ if (!address.IsValid()) {
+ throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid address");
+ }
script = GetScriptForDestination(address.Get());
} else {
if (!IsHex(output)) {
diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h
index 990c3bdf41..a7b15a8441 100644
--- a/src/wallet/wallet.h
+++ b/src/wallet/wallet.h
@@ -737,7 +737,7 @@ public:
CPubKey GenerateNewKey();
void DeriveNewChildKey(CKeyMetadata& metadata, CKey& secret);
//! Adds a key to the store, and saves it to disk.
- bool AddKeyPubKey(const CKey& key, const CPubKey &pubkey);
+ bool AddKeyPubKey(const CKey& key, const CPubKey &pubkey) override;
//! Adds a key to the store, without saving it to disk (used by LoadWallet)
bool LoadKey(const CKey& key, const CPubKey &pubkey) { return CCryptoKeyStore::AddKeyPubKey(key, pubkey); }
//! Load metadata (used by LoadWallet)
@@ -747,10 +747,10 @@ public:
void UpdateTimeFirstKey(int64_t nCreateTime);
//! Adds an encrypted key to the store, and saves it to disk.
- bool AddCryptedKey(const CPubKey &vchPubKey, const std::vector<unsigned char> &vchCryptedSecret);
+ bool AddCryptedKey(const CPubKey &vchPubKey, const std::vector<unsigned char> &vchCryptedSecret) override;
//! Adds an encrypted key to the store, without saving it to disk (used by LoadWallet)
bool LoadCryptedKey(const CPubKey &vchPubKey, const std::vector<unsigned char> &vchCryptedSecret);
- bool AddCScript(const CScript& redeemScript);
+ bool AddCScript(const CScript& redeemScript) override;
bool LoadCScript(const CScript& redeemScript);
//! Adds a destination data tuple to the store, and saves it to disk
@@ -764,7 +764,7 @@ public:
//! Adds a watch-only address to the store, and saves it to disk.
bool AddWatchOnly(const CScript& dest, int64_t nCreateTime);
- bool RemoveWatchOnly(const CScript &dest);
+ bool RemoveWatchOnly(const CScript &dest) override;
//! Adds a watch-only address to the store, without saving it to disk (used by LoadWallet)
bool LoadWatchOnly(const CScript &dest);
@@ -786,11 +786,11 @@ public:
void MarkDirty();
bool AddToWallet(const CWalletTx& wtxIn, bool fFlushOnClose=true);
bool LoadToWallet(const CWalletTx& wtxIn);
- void SyncTransaction(const CTransaction& tx, const CBlockIndex *pindex, int posInBlock);
+ void SyncTransaction(const CTransaction& tx, const CBlockIndex *pindex, int posInBlock) override;
bool AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlockIndex* pIndex, int posInBlock, bool fUpdate);
int ScanForWalletTransactions(CBlockIndex* pindexStart, bool fUpdate = false);
void ReacceptWalletTransactions();
- void ResendWalletTransactions(int64_t nBestBlockTime, CConnman* connman);
+ void ResendWalletTransactions(int64_t nBestBlockTime, CConnman* connman) override;
std::vector<uint256> ResendWalletTransactionsBefore(int64_t nTime, CConnman* connman);
CAmount GetBalance() const;
CAmount GetUnconfirmedBalance() const;
@@ -872,7 +872,7 @@ public:
bool IsAllFromMe(const CTransaction& tx, const isminefilter& filter) const;
CAmount GetCredit(const CTransaction& tx, const isminefilter& filter) const;
CAmount GetChange(const CTransaction& tx) const;
- void SetBestChain(const CBlockLocator& loc);
+ void SetBestChain(const CBlockLocator& loc) override;
DBErrors LoadWallet(bool& fFirstRunRet);
DBErrors ZapWalletTx(std::vector<CWalletTx>& vWtx);
@@ -882,9 +882,9 @@ public:
bool DelAddressBook(const CTxDestination& address);
- void UpdatedTransaction(const uint256 &hashTx);
+ void UpdatedTransaction(const uint256 &hashTx) override;
- void Inventory(const uint256 &hash)
+ void Inventory(const uint256 &hash) override
{
{
LOCK(cs_wallet);
@@ -894,8 +894,8 @@ public:
}
}
- void GetScriptForMining(boost::shared_ptr<CReserveScript> &script);
- void ResetRequestCount(const uint256 &hash)
+ void GetScriptForMining(boost::shared_ptr<CReserveScript> &script) override;
+ void ResetRequestCount(const uint256 &hash) override
{
LOCK(cs_wallet);
mapRequestCount[hash] = 0;
diff --git a/src/wallet/walletdb.cpp b/src/wallet/walletdb.cpp
index 106a59d562..81fdde401e 100644
--- a/src/wallet/walletdb.cpp
+++ b/src/wallet/walletdb.cpp
@@ -559,8 +559,8 @@ DBErrors CWalletDB::LoadWallet(CWallet* pwallet)
bool fNoncriticalErrors = false;
DBErrors result = DB_LOAD_OK;
+ LOCK(pwallet->cs_wallet);
try {
- LOCK(pwallet->cs_wallet);
int nMinVersion = 0;
if (Read((string)"minversion", nMinVersion))
{