aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am12
-rw-r--r--src/Makefile.test.include3
-rw-r--r--src/bitcoin-cli.cpp7
-rw-r--r--src/bitcoin-tx.cpp10
-rw-r--r--src/bitcoind.cpp3
-rw-r--r--src/chain.cpp3
-rw-r--r--src/chainparams.cpp3
-rw-r--r--src/chainparams.h2
-rw-r--r--src/coincontrol.h3
-rw-r--r--src/coins.cpp34
-rw-r--r--src/coins.h29
-rw-r--r--src/consensus/merkle.cpp172
-rw-r--r--src/consensus/merkle.h32
-rw-r--r--src/eccryptoverify.cpp68
-rw-r--r--src/eccryptoverify.h21
-rw-r--r--src/ecwrapper.cpp218
-rw-r--r--src/ecwrapper.h40
-rw-r--r--src/httprpc.cpp56
-rw-r--r--src/httpserver.cpp38
-rw-r--r--src/httpserver.h2
-rw-r--r--src/init.cpp327
-rw-r--r--src/init.h4
-rw-r--r--src/main.cpp643
-rw-r--r--src/main.h38
-rw-r--r--src/miner.cpp20
-rw-r--r--src/miner.h5
-rw-r--r--src/net.cpp18
-rw-r--r--src/net.h24
-rw-r--r--src/netbase.cpp2
-rw-r--r--src/netbase.h4
-rw-r--r--src/policy/fees.cpp52
-rw-r--r--src/policy/fees.h17
-rw-r--r--src/policy/policy.cpp2
-rw-r--r--src/policy/policy.h2
-rw-r--r--src/primitives/block.cpp63
-rw-r--r--src/primitives/block.h6
-rw-r--r--src/pubkey.cpp260
-rw-r--r--src/pubkey.h16
-rw-r--r--src/qt/bitcoin.cpp30
-rw-r--r--src/qt/bitcoingui.cpp28
-rw-r--r--src/qt/bitcoingui.h5
-rw-r--r--src/qt/bitcoinstrings.cpp5
-rw-r--r--src/qt/clientmodel.cpp73
-rw-r--r--src/qt/clientmodel.h16
-rw-r--r--src/qt/coincontroldialog.cpp20
-rw-r--r--src/qt/forms/debugwindow.ui148
-rw-r--r--src/qt/guiconstants.h2
-rw-r--r--src/qt/guiutil.cpp5
-rw-r--r--src/qt/intro.cpp2
-rw-r--r--src/qt/intro.h2
-rw-r--r--src/qt/locale/bitcoin_ar.ts4
-rw-r--r--src/qt/locale/bitcoin_be_BY.ts12
-rw-r--r--src/qt/locale/bitcoin_bg.ts72
-rw-r--r--src/qt/locale/bitcoin_ca.ts32
-rw-r--r--src/qt/locale/bitcoin_ca@valencia.ts32
-rw-r--r--src/qt/locale/bitcoin_ca_ES.ts32
-rw-r--r--src/qt/locale/bitcoin_cs.ts32
-rw-r--r--src/qt/locale/bitcoin_da.ts74
-rw-r--r--src/qt/locale/bitcoin_de.ts40
-rw-r--r--src/qt/locale/bitcoin_el_GR.ts28
-rw-r--r--src/qt/locale/bitcoin_en.ts102
-rw-r--r--src/qt/locale/bitcoin_eo.ts20
-rw-r--r--src/qt/locale/bitcoin_es.ts122
-rw-r--r--src/qt/locale/bitcoin_es_CL.ts29
-rw-r--r--src/qt/locale/bitcoin_es_DO.ts20
-rw-r--r--src/qt/locale/bitcoin_et.ts20
-rw-r--r--src/qt/locale/bitcoin_fa.ts16
-rw-r--r--src/qt/locale/bitcoin_fa_IR.ts8
-rw-r--r--src/qt/locale/bitcoin_fi.ts32
-rw-r--r--src/qt/locale/bitcoin_fr.ts36
-rw-r--r--src/qt/locale/bitcoin_gl.ts16
-rw-r--r--src/qt/locale/bitcoin_he.ts28
-rw-r--r--src/qt/locale/bitcoin_hr.ts20
-rw-r--r--src/qt/locale/bitcoin_hu.ts17
-rw-r--r--src/qt/locale/bitcoin_id_ID.ts174
-rw-r--r--src/qt/locale/bitcoin_it.ts32
-rw-r--r--src/qt/locale/bitcoin_ja.ts68
-rw-r--r--src/qt/locale/bitcoin_ka.ts16
-rw-r--r--src/qt/locale/bitcoin_ko_KR.ts20
-rw-r--r--src/qt/locale/bitcoin_la.ts16
-rw-r--r--src/qt/locale/bitcoin_lt.ts16
-rw-r--r--src/qt/locale/bitcoin_lv_LV.ts20
-rw-r--r--src/qt/locale/bitcoin_mn.ts4
-rw-r--r--src/qt/locale/bitcoin_nb.ts68
-rw-r--r--src/qt/locale/bitcoin_nl.ts32
-rw-r--r--src/qt/locale/bitcoin_pam.ts8
-rw-r--r--src/qt/locale/bitcoin_pl.ts36
-rw-r--r--src/qt/locale/bitcoin_pt_BR.ts212
-rw-r--r--src/qt/locale/bitcoin_pt_PT.ts28
-rw-r--r--src/qt/locale/bitcoin_ro_RO.ts32
-rw-r--r--src/qt/locale/bitcoin_ru.ts36
-rw-r--r--src/qt/locale/bitcoin_sk.ts32
-rw-r--r--src/qt/locale/bitcoin_sl_SI.ts32
-rw-r--r--src/qt/locale/bitcoin_sr.ts4
-rw-r--r--src/qt/locale/bitcoin_sv.ts40
-rw-r--r--src/qt/locale/bitcoin_tr.ts32
-rw-r--r--src/qt/locale/bitcoin_uk.ts40
-rw-r--r--src/qt/locale/bitcoin_uz@Cyrl.ts8
-rw-r--r--src/qt/locale/bitcoin_vi_VN.ts4
-rw-r--r--src/qt/locale/bitcoin_zh_CN.ts36
-rw-r--r--src/qt/locale/bitcoin_zh_TW.ts64
-rw-r--r--src/qt/optionsdialog.cpp75
-rw-r--r--src/qt/optionsdialog.h23
-rw-r--r--src/qt/optionsmodel.cpp9
-rw-r--r--src/qt/optionsmodel.h4
-rw-r--r--src/qt/paymentrequestplus.cpp2
-rw-r--r--src/qt/paymentrequestplus.h2
-rw-r--r--src/qt/qvalidatedlineedit.cpp16
-rw-r--r--src/qt/qvalidatedlineedit.h4
-rw-r--r--src/qt/rpcconsole.cpp29
-rw-r--r--src/qt/rpcconsole.h13
-rw-r--r--src/qt/sendcoinsdialog.cpp36
-rw-r--r--src/qt/transactiontablemodel.cpp15
-rw-r--r--src/qt/transactiontablemodel.h2
-rw-r--r--src/qt/transactionview.cpp8
-rw-r--r--src/qt/transactionview.h1
-rw-r--r--src/qt/utilitydialog.cpp20
-rw-r--r--src/qt/walletmodel.cpp6
-rw-r--r--src/rpcblockchain.cpp13
-rw-r--r--src/rpcclient.cpp2
-rw-r--r--src/rpcmining.cpp86
-rw-r--r--src/rpcnet.cpp13
-rw-r--r--src/rpcrawtransaction.cpp4
-rw-r--r--src/rpcserver.cpp2
-rw-r--r--src/rpcserver.h2
-rw-r--r--src/script/bitcoinconsensus.cpp9
-rw-r--r--src/script/interpreter.cpp13
-rw-r--r--src/script/standard.cpp1
-rw-r--r--src/script/standard.h3
-rw-r--r--src/secp256k1/Makefile.am2
-rw-r--r--src/test/accounting_tests.cpp8
-rw-r--r--src/test/bignum.h180
-rw-r--r--src/test/coins_tests.cpp162
-rw-r--r--src/test/main_tests.cpp1
-rw-r--r--src/test/mempool_tests.cpp73
-rw-r--r--src/test/merkle_tests.cpp136
-rw-r--r--src/test/miner_tests.cpp60
-rw-r--r--src/test/pmt_tests.cpp3
-rw-r--r--src/test/policyestimator_tests.cpp64
-rw-r--r--src/test/rpc_tests.cpp1
-rw-r--r--src/test/scriptnum10.h183
-rw-r--r--src/test/scriptnum_tests.cpp41
-rw-r--r--src/test/test_bitcoin.cpp22
-rw-r--r--src/test/test_bitcoin.h28
-rw-r--r--src/timedata.cpp14
-rw-r--r--src/torcontrol.cpp13
-rw-r--r--src/txmempool.cpp27
-rw-r--r--src/txmempool.h35
-rw-r--r--src/ui_interface.h3
-rw-r--r--src/uint256.h6
-rw-r--r--src/util.cpp12
-rw-r--r--src/util.h5
-rw-r--r--src/utiltime.cpp16
-rw-r--r--src/version.h5
-rw-r--r--src/wallet/db.cpp2
-rw-r--r--src/wallet/db.h1
-rw-r--r--src/wallet/rpcwallet.cpp30
-rw-r--r--src/wallet/wallet.cpp183
-rw-r--r--src/wallet/wallet.h42
-rw-r--r--src/wallet/walletdb.cpp10
-rw-r--r--src/wallet/walletdb.h6
-rw-r--r--src/zmq/zmqnotificationinterface.cpp6
-rw-r--r--src/zmq/zmqpublishnotifier.cpp10
163 files changed, 3646 insertions, 2706 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 1cec0d4d61..bb627a5448 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -100,12 +100,11 @@ BITCOIN_CORE_H = \
compat/sanity.h \
compressor.h \
consensus/consensus.h \
+ consensus/merkle.h \
consensus/params.h \
consensus/validation.h \
core_io.h \
core_memusage.h \
- eccryptoverify.h \
- ecwrapper.h \
hash.h \
httprpc.h \
httpserver.h \
@@ -271,10 +270,9 @@ libbitcoin_common_a_SOURCES = \
chainparams.cpp \
coins.cpp \
compressor.cpp \
+ consensus/merkle.cpp \
core_read.cpp \
core_write.cpp \
- eccryptoverify.cpp \
- ecwrapper.cpp \
hash.cpp \
key.cpp \
keystore.cpp \
@@ -405,8 +403,6 @@ libbitcoinconsensus_la_SOURCES = \
crypto/sha1.cpp \
crypto/sha256.cpp \
crypto/sha512.cpp \
- eccryptoverify.cpp \
- ecwrapper.cpp \
hash.cpp \
primitives/transaction.cpp \
pubkey.cpp \
@@ -421,8 +417,8 @@ if GLIBC_BACK_COMPAT
endif
libbitcoinconsensus_la_LDFLAGS = $(AM_LDFLAGS) -no-undefined $(RELDFLAGS)
-libbitcoinconsensus_la_LIBADD = $(CRYPTO_LIBS)
-libbitcoinconsensus_la_CPPFLAGS = $(AM_CPPFLAGS) $(CRYPTO_CFLAGS) -I$(builddir)/obj -DBUILD_BITCOIN_INTERNAL
+libbitcoinconsensus_la_LIBADD = $(LIBSECP256K1)
+libbitcoinconsensus_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(builddir)/obj -I$(srcdir)/secp256k1/include -DBUILD_BITCOIN_INTERNAL
libbitcoinconsensus_la_CXXFLAGS = $(AM_CXXFLAGS) $(PIE_FLAGS)
endif
diff --git a/src/Makefile.test.include b/src/Makefile.test.include
index bc0a263174..4d0894b711 100644
--- a/src/Makefile.test.include
+++ b/src/Makefile.test.include
@@ -35,7 +35,7 @@ GENERATED_TEST_FILES = $(JSON_TEST_FILES:.json=.json.h) $(RAW_TEST_FILES:.raw=.r
BITCOIN_TESTS =\
test/arith_uint256_tests.cpp \
- test/bignum.h \
+ test/scriptnum10.h \
test/addrman_tests.cpp \
test/alert_tests.cpp \
test/allocator_tests.cpp \
@@ -57,6 +57,7 @@ BITCOIN_TESTS =\
test/dbwrapper_tests.cpp \
test/main_tests.cpp \
test/mempool_tests.cpp \
+ test/merkle_tests.cpp \
test/miner_tests.cpp \
test/mruset_tests.cpp \
test/multisig_tests.cpp \
diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp
index 9564573657..58ced1ade9 100644
--- a/src/bitcoin-cli.cpp
+++ b/src/bitcoin-cli.cpp
@@ -22,6 +22,7 @@
using namespace std;
+static const char DEFAULT_RPCCONNECT[] = "127.0.0.1";
static const int DEFAULT_HTTP_CLIENT_TIMEOUT=900;
std::string HelpMessageCli()
@@ -29,10 +30,10 @@ std::string HelpMessageCli()
string strUsage;
strUsage += HelpMessageGroup(_("Options:"));
strUsage += HelpMessageOpt("-?", _("This help message"));
- strUsage += HelpMessageOpt("-conf=<file>", strprintf(_("Specify configuration file (default: %s)"), "bitcoin.conf"));
+ strUsage += HelpMessageOpt("-conf=<file>", strprintf(_("Specify configuration file (default: %s)"), BITCOIN_CONF_FILENAME));
strUsage += HelpMessageOpt("-datadir=<dir>", _("Specify data directory"));
AppendParamsHelpMessages(strUsage);
- strUsage += HelpMessageOpt("-rpcconnect=<ip>", strprintf(_("Send commands to node running on <ip> (default: %s)"), "127.0.0.1"));
+ strUsage += HelpMessageOpt("-rpcconnect=<ip>", strprintf(_("Send commands to node running on <ip> (default: %s)"), DEFAULT_RPCCONNECT));
strUsage += HelpMessageOpt("-rpcport=<port>", strprintf(_("Connect to JSON-RPC on <port> (default: %u or testnet: %u)"), 8332, 18332));
strUsage += HelpMessageOpt("-rpcwait", _("Wait for RPC server to start"));
strUsage += HelpMessageOpt("-rpcuser=<user>", _("Username for JSON-RPC connections"));
@@ -141,7 +142,7 @@ static void http_request_done(struct evhttp_request *req, void *ctx)
UniValue CallRPC(const string& strMethod, const UniValue& params)
{
- std::string host = GetArg("-rpcconnect", "127.0.0.1");
+ std::string host = GetArg("-rpcconnect", DEFAULT_RPCCONNECT);
int port = GetArg("-rpcport", BaseParams().RPCPort());
// Create event base
diff --git a/src/bitcoin-tx.cpp b/src/bitcoin-tx.cpp
index 48033cd8ad..9f8b2b98af 100644
--- a/src/bitcoin-tx.cpp
+++ b/src/bitcoin-tx.cpp
@@ -477,9 +477,15 @@ static void MutateTxSign(CMutableTransaction& tx, const string& flagStr)
class Secp256k1Init
{
+ ECCVerifyHandle globalVerifyHandle;
+
public:
- Secp256k1Init() { ECC_Start(); }
- ~Secp256k1Init() { ECC_Stop(); }
+ Secp256k1Init() {
+ ECC_Start();
+ }
+ ~Secp256k1Init() {
+ ECC_Stop();
+ }
};
static void MutateTx(CMutableTransaction& tx, const string& command,
diff --git a/src/bitcoind.cpp b/src/bitcoind.cpp
index addf0e6a26..4cee2d3cf0 100644
--- a/src/bitcoind.cpp
+++ b/src/bitcoind.cpp
@@ -151,6 +151,9 @@ bool AppInit(int argc, char* argv[])
#endif
SoftSetBoolArg("-server", true);
+ // Set this early so that parameter interactions go to console
+ InitLogging();
+ InitParameterInteraction();
fRet = AppInit2(threadGroup, scheduler);
}
catch (const std::exception& e) {
diff --git a/src/chain.cpp b/src/chain.cpp
index 5b8ce076c4..3450ed6c3f 100644
--- a/src/chain.cpp
+++ b/src/chain.cpp
@@ -51,6 +51,9 @@ CBlockLocator CChain::GetLocator(const CBlockIndex *pindex) const {
}
const CBlockIndex *CChain::FindFork(const CBlockIndex *pindex) const {
+ if (pindex == NULL) {
+ return NULL;
+ }
if (pindex->nHeight > Height())
pindex = pindex->GetAncestor(Height());
while (pindex && !Contains(pindex))
diff --git a/src/chainparams.cpp b/src/chainparams.cpp
index 5d6d1ef9d8..a46866a2be 100644
--- a/src/chainparams.cpp
+++ b/src/chainparams.cpp
@@ -4,6 +4,7 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "chainparams.h"
+#include "consensus/merkle.h"
#include "tinyformat.h"
#include "util.h"
@@ -32,7 +33,7 @@ static CBlock CreateGenesisBlock(const char* pszTimestamp, const CScript& genesi
genesis.nVersion = nVersion;
genesis.vtx.push_back(txNew);
genesis.hashPrevBlock.SetNull();
- genesis.hashMerkleRoot = genesis.ComputeMerkleRoot();
+ genesis.hashMerkleRoot = BlockMerkleRoot(genesis);
return genesis;
}
diff --git a/src/chainparams.h b/src/chainparams.h
index cb061d596e..8aa0c71d61 100644
--- a/src/chainparams.h
+++ b/src/chainparams.h
@@ -65,7 +65,7 @@ public:
/** Policy: Filter transactions that do not match well-defined patterns */
bool RequireStandard() const { return fRequireStandard; }
int64_t MaxTipAge() const { return nMaxTipAge; }
- int64_t PruneAfterHeight() const { return nPruneAfterHeight; }
+ uint64_t PruneAfterHeight() const { return nPruneAfterHeight; }
/** Make miner stop after a block is found. In RPC, don't return until nGenProcLimit blocks are generated */
bool MineBlocksOnDemand() const { return fMineBlocksOnDemand; }
/** In the future use NetworkIDString() for RPC fields */
diff --git a/src/coincontrol.h b/src/coincontrol.h
index bc965f9e19..3945644ce8 100644
--- a/src/coincontrol.h
+++ b/src/coincontrol.h
@@ -16,6 +16,8 @@ public:
bool fAllowOtherInputs;
//! Includes watch only addresses which match the ISMINE_WATCH_SOLVABLE criteria
bool fAllowWatchOnly;
+ //! Minimum absolute fee (not per kilobyte)
+ CAmount nMinimumTotalFee;
CCoinControl()
{
@@ -28,6 +30,7 @@ public:
fAllowOtherInputs = false;
fAllowWatchOnly = false;
setSelected.clear();
+ nMinimumTotalFee = 0;
}
bool HasSelected() const
diff --git a/src/coins.cpp b/src/coins.cpp
index f02949de53..723e114708 100644
--- a/src/coins.cpp
+++ b/src/coins.cpp
@@ -117,6 +117,15 @@ CCoinsModifier CCoinsViewCache::ModifyCoins(const uint256 &txid) {
return CCoinsModifier(*this, ret.first, cachedCoinUsage);
}
+CCoinsModifier CCoinsViewCache::ModifyNewCoins(const uint256 &txid) {
+ assert(!hasModifier);
+ std::pair<CCoinsMap::iterator, bool> ret = cacheCoins.insert(std::make_pair(txid, CCoinsCacheEntry()));
+ ret.first->second.coins.Clear();
+ ret.first->second.flags = CCoinsCacheEntry::FRESH;
+ ret.first->second.flags |= CCoinsCacheEntry::DIRTY;
+ return CCoinsModifier(*this, ret.first, 0);
+}
+
const CCoins* CCoinsViewCache::AccessCoins(const uint256 &txid) const {
CCoinsMap::const_iterator it = FetchCoins(txid);
if (it == cacheCoins.end()) {
@@ -151,18 +160,23 @@ bool CCoinsViewCache::BatchWrite(CCoinsMap &mapCoins, const uint256 &hashBlockIn
if (it->second.flags & CCoinsCacheEntry::DIRTY) { // Ignore non-dirty entries (optimization).
CCoinsMap::iterator itUs = cacheCoins.find(it->first);
if (itUs == cacheCoins.end()) {
- if (!it->second.coins.IsPruned()) {
- // The parent cache does not have an entry, while the child
- // cache does have (a non-pruned) one. Move the data up, and
- // mark it as fresh (if the grandparent did have it, we
- // would have pulled it in at first GetCoins).
- assert(it->second.flags & CCoinsCacheEntry::FRESH);
+ // The parent cache does not have an entry, while the child does
+ // We can ignore it if it's both FRESH and pruned in the child
+ if (!(it->second.flags & CCoinsCacheEntry::FRESH && it->second.coins.IsPruned())) {
+ // Otherwise we will need to create it in the parent
+ // and move the data up and mark it as dirty
CCoinsCacheEntry& entry = cacheCoins[it->first];
entry.coins.swap(it->second.coins);
cachedCoinsUsage += entry.coins.DynamicMemoryUsage();
- entry.flags = CCoinsCacheEntry::DIRTY | CCoinsCacheEntry::FRESH;
+ entry.flags = CCoinsCacheEntry::DIRTY;
+ // We can mark it FRESH in the parent if it was FRESH in the child
+ // Otherwise it might have just been flushed from the parent's cache
+ // and already exist in the grandparent
+ if (it->second.flags & CCoinsCacheEntry::FRESH)
+ entry.flags |= CCoinsCacheEntry::FRESH;
}
} else {
+ // Found the entry in the parent cache
if ((itUs->second.flags & CCoinsCacheEntry::FRESH) && it->second.coins.IsPruned()) {
// The grandparent does not have an entry, and the child is
// modified and being pruned. This means we can just delete
@@ -229,8 +243,9 @@ bool CCoinsViewCache::HaveInputs(const CTransaction& tx) const
return true;
}
-double CCoinsViewCache::GetPriority(const CTransaction &tx, int nHeight) const
+double CCoinsViewCache::GetPriority(const CTransaction &tx, int nHeight, CAmount &inChainInputValue) const
{
+ inChainInputValue = 0;
if (tx.IsCoinBase())
return 0.0;
double dResult = 0.0;
@@ -239,8 +254,9 @@ double CCoinsViewCache::GetPriority(const CTransaction &tx, int nHeight) const
const CCoins* coins = AccessCoins(txin.prevout.hash);
assert(coins);
if (!coins->IsAvailable(txin.prevout.n)) continue;
- if (coins->nHeight < nHeight) {
+ if (coins->nHeight <= nHeight) {
dResult += coins->vout[txin.prevout.n].nValue * (nHeight-coins->nHeight);
+ inChainInputValue += coins->vout[txin.prevout.n].nValue;
}
}
return tx.ComputePriority(dResult);
diff --git a/src/coins.h b/src/coins.h
index bf4a777b8a..d174422100 100644
--- a/src/coins.h
+++ b/src/coins.h
@@ -29,11 +29,11 @@
* - VARINT(nHeight)
*
* The nCode value consists of:
- * - bit 1: IsCoinBase()
- * - bit 2: vout[0] is not spent
- * - bit 4: vout[1] is not spent
+ * - bit 0: IsCoinBase()
+ * - bit 1: vout[0] is not spent
+ * - bit 2: vout[1] is not spent
* - The higher bits encode N, the number of non-zero bytes in the following bitvector.
- * - In case both bit 2 and bit 4 are unset, they encode N-1, as there must be at
+ * - In case both bit 1 and bit 2 are unset, they encode N-1, as there must be at
* least one non-spent output).
*
* Example: 0104835800816115944e077fe7c803cfa57f29b36bf87c1d358bb85e
@@ -58,7 +58,7 @@
*
* - version = 1
* - code = 9 (coinbase, neither vout[0] or vout[1] are unspent,
- * 2 (1, +1 because both bit 2 and bit 4 are unset) non-zero bitvector bytes follow)
+ * 2 (1, +1 because both bit 1 and bit 2 are unset) non-zero bitvector bytes follow)
* - unspentness bitvector: bits 2 (0x04) and 14 (0x4000) are set, so vout[2+2] and vout[14+2] are unspent
* - vout[4]: 86ef97d5790061b01caab50f1b8e9c50a5057eb43c2d9563a4ee
* * 86ef97d579: compact amount representation for 234925952 (2.35 BTC)
@@ -420,6 +420,17 @@ public:
CCoinsModifier ModifyCoins(const uint256 &txid);
/**
+ * Return a modifiable reference to a CCoins. Assumes that no entry with the given
+ * txid exists and creates a new one. This saves a database access in the case where
+ * the coins were to be wiped out by FromTx anyway. This should not be called with
+ * the 2 historical coinbase duplicate pairs because the new coins are marked fresh, and
+ * in the event the duplicate coinbase was spent before a flush, the now pruned coins
+ * would not properly overwrite the first coinbase of the pair. Simultaneous modifications
+ * are not allowed.
+ */
+ CCoinsModifier ModifyNewCoins(const uint256 &txid);
+
+ /**
* Push the modifications applied to this cache to its base.
* Failure to call this method before destruction will cause the changes to be forgotten.
* If false is returned, the state of this cache (and its backing view) will be undefined.
@@ -445,8 +456,12 @@ public:
//! Check whether all prevouts of the transaction are present in the UTXO set represented by this view
bool HaveInputs(const CTransaction& tx) const;
- //! Return priority of tx at height nHeight
- double GetPriority(const CTransaction &tx, int nHeight) const;
+ /**
+ * Return priority of tx at height nHeight. Also calculate the sum of the values of the inputs
+ * that are already in the chain. These are the inputs that will age and increase priority as
+ * new blocks are added to the chain.
+ */
+ double GetPriority(const CTransaction &tx, int nHeight, CAmount &inChainInputValue) const;
const CTxOut &GetOutputFor(const CTxIn& input) const;
diff --git a/src/consensus/merkle.cpp b/src/consensus/merkle.cpp
new file mode 100644
index 0000000000..9a8afa8a33
--- /dev/null
+++ b/src/consensus/merkle.cpp
@@ -0,0 +1,172 @@
+#include "merkle.h"
+#include "hash.h"
+#include "utilstrencodings.h"
+
+/* WARNING! If you're reading this because you're learning about crypto
+ and/or designing a new system that will use merkle trees, keep in mind
+ that the following merkle tree algorithm has a serious flaw related to
+ duplicate txids, resulting in a vulnerability (CVE-2012-2459).
+
+ The reason is that if the number of hashes in the list at a given time
+ is odd, the last one is duplicated before computing the next level (which
+ is unusual in Merkle trees). This results in certain sequences of
+ transactions leading to the same merkle root. For example, these two
+ trees:
+
+ A A
+ / \ / \
+ B C B C
+ / \ | / \ / \
+ D E F D E F F
+ / \ / \ / \ / \ / \ / \ / \
+ 1 2 3 4 5 6 1 2 3 4 5 6 5 6
+
+ for transaction lists [1,2,3,4,5,6] and [1,2,3,4,5,6,5,6] (where 5 and
+ 6 are repeated) result in the same root hash A (because the hash of both
+ of (F) and (F,F) is C).
+
+ The vulnerability results from being able to send a block with such a
+ transaction list, with the same merkle root, and the same block hash as
+ the original without duplication, resulting in failed validation. If the
+ receiving node proceeds to mark that block as permanently invalid
+ however, it will fail to accept further unmodified (and thus potentially
+ valid) versions of the same block. We defend against this by detecting
+ the case where we would hash two identical hashes at the end of the list
+ together, and treating that identically to the block having an invalid
+ merkle root. Assuming no double-SHA256 collisions, this will detect all
+ known ways of changing the transactions without affecting the merkle
+ root.
+*/
+
+/* This implements a constant-space merkle root/path calculator, limited to 2^32 leaves. */
+static void MerkleComputation(const std::vector<uint256>& leaves, uint256* proot, bool* pmutated, uint32_t branchpos, std::vector<uint256>* pbranch) {
+ if (pbranch) pbranch->clear();
+ if (leaves.size() == 0) {
+ if (pmutated) *pmutated = false;
+ if (proot) *proot = uint256();
+ return;
+ }
+ bool mutated = false;
+ // count is the number of leaves processed so far.
+ uint32_t count = 0;
+ // inner is an array of eagerly computed subtree hashes, indexed by tree
+ // level (0 being the leaves).
+ // For example, when count is 25 (11001 in binary), inner[4] is the hash of
+ // the first 16 leaves, inner[3] of the next 8 leaves, and inner[0] equal to
+ // the last leaf. The other inner entries are undefined.
+ uint256 inner[32];
+ // Which position in inner is a hash that depends on the matching leaf.
+ int matchlevel = -1;
+ // First process all leaves into 'inner' values.
+ while (count < leaves.size()) {
+ uint256 h = leaves[count];
+ bool matchh = count == branchpos;
+ count++;
+ int level;
+ // For each of the lower bits in count that are 0, do 1 step. Each
+ // corresponds to an inner value that existed before processing the
+ // current leaf, and each needs a hash to combine it.
+ for (level = 0; !(count & (((uint32_t)1) << level)); level++) {
+ if (pbranch) {
+ if (matchh) {
+ pbranch->push_back(inner[level]);
+ } else if (matchlevel == level) {
+ pbranch->push_back(h);
+ matchh = true;
+ }
+ }
+ mutated |= (inner[level] == h);
+ CHash256().Write(inner[level].begin(), 32).Write(h.begin(), 32).Finalize(h.begin());
+ }
+ // Store the resulting hash at inner position level.
+ inner[level] = h;
+ if (matchh) {
+ matchlevel = level;
+ }
+ }
+ // Do a final 'sweep' over the rightmost branch of the tree to process
+ // odd levels, and reduce everything to a single top value.
+ // Level is the level (counted from the bottom) up to which we've sweeped.
+ int level = 0;
+ // As long as bit number level in count is zero, skip it. It means there
+ // is nothing left at this level.
+ while (!(count & (((uint32_t)1) << level))) {
+ level++;
+ }
+ uint256 h = inner[level];
+ bool matchh = matchlevel == level;
+ while (count != (((uint32_t)1) << level)) {
+ // If we reach this point, h is an inner value that is not the top.
+ // We combine it with itself (Bitcoin's special rule for odd levels in
+ // the tree) to produce a higher level one.
+ if (pbranch && matchh) {
+ pbranch->push_back(h);
+ }
+ CHash256().Write(h.begin(), 32).Write(h.begin(), 32).Finalize(h.begin());
+ // Increment count to the value it would have if two entries at this
+ // level had existed.
+ count += (((uint32_t)1) << level);
+ level++;
+ // And propagate the result upwards accordingly.
+ while (!(count & (((uint32_t)1) << level))) {
+ if (pbranch) {
+ if (matchh) {
+ pbranch->push_back(inner[level]);
+ } else if (matchlevel == level) {
+ pbranch->push_back(h);
+ matchh = true;
+ }
+ }
+ CHash256().Write(inner[level].begin(), 32).Write(h.begin(), 32).Finalize(h.begin());
+ level++;
+ }
+ }
+ // Return result.
+ if (pmutated) *pmutated = mutated;
+ if (proot) *proot = h;
+}
+
+uint256 ComputeMerkleRoot(const std::vector<uint256>& leaves, bool* mutated) {
+ uint256 hash;
+ MerkleComputation(leaves, &hash, mutated, -1, NULL);
+ return hash;
+}
+
+std::vector<uint256> ComputeMerkleBranch(const std::vector<uint256>& leaves, uint32_t position) {
+ std::vector<uint256> ret;
+ MerkleComputation(leaves, NULL, NULL, position, &ret);
+ return ret;
+}
+
+uint256 ComputeMerkleRootFromBranch(const uint256& leaf, const std::vector<uint256>& vMerkleBranch, uint32_t nIndex) {
+ uint256 hash = leaf;
+ for (std::vector<uint256>::const_iterator it = vMerkleBranch.begin(); it != vMerkleBranch.end(); ++it) {
+ if (nIndex & 1) {
+ hash = Hash(BEGIN(*it), END(*it), BEGIN(hash), END(hash));
+ } else {
+ hash = Hash(BEGIN(hash), END(hash), BEGIN(*it), END(*it));
+ }
+ nIndex >>= 1;
+ }
+ return hash;
+}
+
+uint256 BlockMerkleRoot(const CBlock& block, bool* mutated)
+{
+ std::vector<uint256> leaves;
+ leaves.resize(block.vtx.size());
+ for (size_t s = 0; s < block.vtx.size(); s++) {
+ leaves[s] = block.vtx[s].GetHash();
+ }
+ return ComputeMerkleRoot(leaves, mutated);
+}
+
+std::vector<uint256> BlockMerkleBranch(const CBlock& block, uint32_t position)
+{
+ std::vector<uint256> leaves;
+ leaves.resize(block.vtx.size());
+ for (size_t s = 0; s < block.vtx.size(); s++) {
+ leaves[s] = block.vtx[s].GetHash();
+ }
+ return ComputeMerkleBranch(leaves, position);
+}
diff --git a/src/consensus/merkle.h b/src/consensus/merkle.h
new file mode 100644
index 0000000000..6ef59745ac
--- /dev/null
+++ b/src/consensus/merkle.h
@@ -0,0 +1,32 @@
+// Copyright (c) 2015 The Bitcoin Core developers
+// Distributed under the MIT software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
+#ifndef BITCOIN_MERKLE
+#define BITCOIN_MERKLE
+
+#include <stdint.h>
+#include <vector>
+
+#include "primitives/transaction.h"
+#include "primitives/block.h"
+#include "uint256.h"
+
+uint256 ComputeMerkleRoot(const std::vector<uint256>& leaves, bool* mutated = NULL);
+std::vector<uint256> ComputeMerkleBranch(const std::vector<uint256>& leaves, uint32_t position);
+uint256 ComputeMerkleRootFromBranch(const uint256& leaf, const std::vector<uint256>& branch, uint32_t position);
+
+/*
+ * Compute the Merkle root of the transactions in a block.
+ * *mutated is set to true if a duplicated subtree was found.
+ */
+uint256 BlockMerkleRoot(const CBlock& block, bool* mutated = NULL);
+
+/*
+ * Compute the Merkle branch for the tree of transactions in a block, for a
+ * given position.
+ * This can be verified using ComputeMerkleRootFromBranch.
+ */
+std::vector<uint256> BlockMerkleBranch(const CBlock& block, uint32_t position);
+
+#endif
diff --git a/src/eccryptoverify.cpp b/src/eccryptoverify.cpp
deleted file mode 100644
index e894e1122c..0000000000
--- a/src/eccryptoverify.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-// Copyright (c) 2009-2010 Satoshi Nakamoto
-// Copyright (c) 2009-2014 The Bitcoin Core developers
-// Distributed under the MIT software license, see the accompanying
-// file COPYING or http://www.opensource.org/licenses/mit-license.php.
-
-#include "eccryptoverify.h"
-
-namespace {
-
-int CompareBigEndian(const unsigned char *c1, size_t c1len, const unsigned char *c2, size_t c2len) {
- while (c1len > c2len) {
- if (*c1)
- return 1;
- c1++;
- c1len--;
- }
- while (c2len > c1len) {
- if (*c2)
- return -1;
- c2++;
- c2len--;
- }
- while (c1len > 0) {
- if (*c1 > *c2)
- return 1;
- if (*c2 > *c1)
- return -1;
- c1++;
- c2++;
- c1len--;
- }
- return 0;
-}
-
-/** Order of secp256k1's generator minus 1. */
-const unsigned char vchMaxModOrder[32] = {
- 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
- 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,
- 0xBA,0xAE,0xDC,0xE6,0xAF,0x48,0xA0,0x3B,
- 0xBF,0xD2,0x5E,0x8C,0xD0,0x36,0x41,0x40
-};
-
-/** Half of the order of secp256k1's generator minus 1. */
-const unsigned char vchMaxModHalfOrder[32] = {
- 0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
- 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
- 0x5D,0x57,0x6E,0x73,0x57,0xA4,0x50,0x1D,
- 0xDF,0xE9,0x2F,0x46,0x68,0x1B,0x20,0xA0
-};
-
-const unsigned char vchZero[1] = {0};
-} // anon namespace
-
-namespace eccrypto {
-
-bool Check(const unsigned char *vch) {
- return vch &&
- CompareBigEndian(vch, 32, vchZero, 0) > 0 &&
- CompareBigEndian(vch, 32, vchMaxModOrder, 32) <= 0;
-}
-
-bool CheckSignatureElement(const unsigned char *vch, int len, bool half) {
- return vch &&
- CompareBigEndian(vch, len, vchZero, 0) > 0 &&
- CompareBigEndian(vch, len, half ? vchMaxModHalfOrder : vchMaxModOrder, 32) <= 0;
-}
-
-} // namespace eccrypto
diff --git a/src/eccryptoverify.h b/src/eccryptoverify.h
deleted file mode 100644
index c67c1e44fc..0000000000
--- a/src/eccryptoverify.h
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright (c) 2009-2010 Satoshi Nakamoto
-// Copyright (c) 2009-2014 The Bitcoin Core developers
-// Distributed under the MIT software license, see the accompanying
-// file COPYING or http://www.opensource.org/licenses/mit-license.php.
-
-#ifndef BITCOIN_ECCRYPTOVERIFY_H
-#define BITCOIN_ECCRYPTOVERIFY_H
-
-#include <vector>
-#include <cstdlib>
-
-class uint256;
-
-namespace eccrypto {
-
-bool Check(const unsigned char *vch);
-bool CheckSignatureElement(const unsigned char *vch, int len, bool half);
-
-} // eccrypto namespace
-
-#endif // BITCOIN_ECCRYPTOVERIFY_H
diff --git a/src/ecwrapper.cpp b/src/ecwrapper.cpp
deleted file mode 100644
index f94bc954fd..0000000000
--- a/src/ecwrapper.cpp
+++ /dev/null
@@ -1,218 +0,0 @@
-// Copyright (c) 2009-2014 The Bitcoin Core developers
-// Distributed under the MIT software license, see the accompanying
-// file COPYING or http://www.opensource.org/licenses/mit-license.php.
-
-#include "ecwrapper.h"
-
-#include "serialize.h"
-#include "uint256.h"
-
-#include <openssl/bn.h>
-#include <openssl/ecdsa.h>
-#include <openssl/obj_mac.h>
-
-namespace {
-
-class ecgroup_order
-{
-public:
- static const EC_GROUP* get()
- {
- static const ecgroup_order wrapper;
- return wrapper.pgroup;
- }
-
-private:
- ecgroup_order()
- : pgroup(EC_GROUP_new_by_curve_name(NID_secp256k1))
- {
- }
-
- ~ecgroup_order()
- {
- EC_GROUP_free(pgroup);
- }
-
- EC_GROUP* pgroup;
-};
-
-/**
- * Perform ECDSA key recovery (see SEC1 4.1.6) for curves over (mod p)-fields
- * recid selects which key is recovered
- * if check is non-zero, additional checks are performed
- */
-int ECDSA_SIG_recover_key_GFp(EC_KEY *eckey, ECDSA_SIG *ecsig, const unsigned char *msg, int msglen, int recid, int check)
-{
- if (!eckey) return 0;
-
- int ret = 0;
- BN_CTX *ctx = NULL;
-
- BIGNUM *x = NULL;
- BIGNUM *e = NULL;
- BIGNUM *order = NULL;
- BIGNUM *sor = NULL;
- BIGNUM *eor = NULL;
- BIGNUM *field = NULL;
- EC_POINT *R = NULL;
- EC_POINT *O = NULL;
- EC_POINT *Q = NULL;
- BIGNUM *rr = NULL;
- BIGNUM *zero = NULL;
- int n = 0;
- int i = recid / 2;
-
- const EC_GROUP *group = EC_KEY_get0_group(eckey);
- if ((ctx = BN_CTX_new()) == NULL) { ret = -1; goto err; }
- BN_CTX_start(ctx);
- order = BN_CTX_get(ctx);
- if (!EC_GROUP_get_order(group, order, ctx)) { ret = -2; goto err; }
- x = BN_CTX_get(ctx);
- if (!BN_copy(x, order)) { ret=-1; goto err; }
- if (!BN_mul_word(x, i)) { ret=-1; goto err; }
- if (!BN_add(x, x, ecsig->r)) { ret=-1; goto err; }
- field = BN_CTX_get(ctx);
- if (!EC_GROUP_get_curve_GFp(group, field, NULL, NULL, ctx)) { ret=-2; goto err; }
- if (BN_cmp(x, field) >= 0) { ret=0; goto err; }
- if ((R = EC_POINT_new(group)) == NULL) { ret = -2; goto err; }
- if (!EC_POINT_set_compressed_coordinates_GFp(group, R, x, recid % 2, ctx)) { ret=0; goto err; }
- if (check)
- {
- if ((O = EC_POINT_new(group)) == NULL) { ret = -2; goto err; }
- if (!EC_POINT_mul(group, O, NULL, R, order, ctx)) { ret=-2; goto err; }
- if (!EC_POINT_is_at_infinity(group, O)) { ret = 0; goto err; }
- }
- if ((Q = EC_POINT_new(group)) == NULL) { ret = -2; goto err; }
- n = EC_GROUP_get_degree(group);
- e = BN_CTX_get(ctx);
- if (!BN_bin2bn(msg, msglen, e)) { ret=-1; goto err; }
- if (8*msglen > n) BN_rshift(e, e, 8-(n & 7));
- zero = BN_CTX_get(ctx);
- if (!BN_zero(zero)) { ret=-1; goto err; }
- if (!BN_mod_sub(e, zero, e, order, ctx)) { ret=-1; goto err; }
- rr = BN_CTX_get(ctx);
- if (!BN_mod_inverse(rr, ecsig->r, order, ctx)) { ret=-1; goto err; }
- sor = BN_CTX_get(ctx);
- if (!BN_mod_mul(sor, ecsig->s, rr, order, ctx)) { ret=-1; goto err; }
- eor = BN_CTX_get(ctx);
- if (!BN_mod_mul(eor, e, rr, order, ctx)) { ret=-1; goto err; }
- if (!EC_POINT_mul(group, Q, eor, R, sor, ctx)) { ret=-2; goto err; }
- if (!EC_KEY_set_public_key(eckey, Q)) { ret=-2; goto err; }
-
- ret = 1;
-
-err:
- if (ctx) {
- BN_CTX_end(ctx);
- BN_CTX_free(ctx);
- }
- if (R != NULL) EC_POINT_free(R);
- if (O != NULL) EC_POINT_free(O);
- if (Q != NULL) EC_POINT_free(Q);
- return ret;
-}
-
-} // anon namespace
-
-CECKey::CECKey() {
- pkey = EC_KEY_new();
- assert(pkey != NULL);
- int result = EC_KEY_set_group(pkey, ecgroup_order::get());
- assert(result);
-}
-
-CECKey::~CECKey() {
- EC_KEY_free(pkey);
-}
-
-void CECKey::GetPubKey(std::vector<unsigned char> &pubkey, bool fCompressed) {
- EC_KEY_set_conv_form(pkey, fCompressed ? POINT_CONVERSION_COMPRESSED : POINT_CONVERSION_UNCOMPRESSED);
- int nSize = i2o_ECPublicKey(pkey, NULL);
- assert(nSize);
- assert(nSize <= 65);
- pubkey.clear();
- pubkey.resize(nSize);
- unsigned char *pbegin(begin_ptr(pubkey));
- int nSize2 = i2o_ECPublicKey(pkey, &pbegin);
- assert(nSize == nSize2);
-}
-
-bool CECKey::SetPubKey(const unsigned char* pubkey, size_t size) {
- return o2i_ECPublicKey(&pkey, &pubkey, size) != NULL;
-}
-
-bool CECKey::Verify(const uint256 &hash, const std::vector<unsigned char>& vchSig) {
- if (vchSig.empty())
- return false;
-
- // New versions of OpenSSL will reject non-canonical DER signatures. de/re-serialize first.
- unsigned char *norm_der = NULL;
- ECDSA_SIG *norm_sig = ECDSA_SIG_new();
- const unsigned char* sigptr = &vchSig[0];
- assert(norm_sig);
- if (d2i_ECDSA_SIG(&norm_sig, &sigptr, vchSig.size()) == NULL)
- {
- /* As of OpenSSL 1.0.0p d2i_ECDSA_SIG frees and nulls the pointer on
- * error. But OpenSSL's own use of this function redundantly frees the
- * result. As ECDSA_SIG_free(NULL) is a no-op, and in the absence of a
- * clear contract for the function behaving the same way is more
- * conservative.
- */
- ECDSA_SIG_free(norm_sig);
- return false;
- }
- int derlen = i2d_ECDSA_SIG(norm_sig, &norm_der);
- ECDSA_SIG_free(norm_sig);
- if (derlen <= 0)
- return false;
-
- // -1 = error, 0 = bad sig, 1 = good
- bool ret = ECDSA_verify(0, (unsigned char*)&hash, sizeof(hash), norm_der, derlen, pkey) == 1;
- OPENSSL_free(norm_der);
- return ret;
-}
-
-bool CECKey::Recover(const uint256 &hash, const unsigned char *p64, int rec)
-{
- if (rec<0 || rec>=3)
- return false;
- ECDSA_SIG *sig = ECDSA_SIG_new();
- BN_bin2bn(&p64[0], 32, sig->r);
- BN_bin2bn(&p64[32], 32, sig->s);
- bool ret = ECDSA_SIG_recover_key_GFp(pkey, sig, (unsigned char*)&hash, sizeof(hash), rec, 0) == 1;
- ECDSA_SIG_free(sig);
- return ret;
-}
-
-bool CECKey::TweakPublic(const unsigned char vchTweak[32]) {
- bool ret = true;
- BN_CTX *ctx = BN_CTX_new();
- BN_CTX_start(ctx);
- BIGNUM *bnTweak = BN_CTX_get(ctx);
- BIGNUM *bnOrder = BN_CTX_get(ctx);
- BIGNUM *bnOne = BN_CTX_get(ctx);
- const EC_GROUP *group = EC_KEY_get0_group(pkey);
- EC_GROUP_get_order(group, bnOrder, ctx); // what a grossly inefficient way to get the (constant) group order...
- BN_bin2bn(vchTweak, 32, bnTweak);
- if (BN_cmp(bnTweak, bnOrder) >= 0)
- ret = false; // extremely unlikely
- EC_POINT *point = EC_POINT_dup(EC_KEY_get0_public_key(pkey), group);
- BN_one(bnOne);
- EC_POINT_mul(group, point, bnTweak, point, bnOne, ctx);
- if (EC_POINT_is_at_infinity(group, point))
- ret = false; // ridiculously unlikely
- EC_KEY_set_public_key(pkey, point);
- EC_POINT_free(point);
- BN_CTX_end(ctx);
- BN_CTX_free(ctx);
- return ret;
-}
-
-bool CECKey::SanityCheck()
-{
- const EC_GROUP *pgroup = ecgroup_order::get();
- if(pgroup == NULL)
- return false;
- // TODO Is there more EC functionality that could be missing?
- return true;
-}
diff --git a/src/ecwrapper.h b/src/ecwrapper.h
deleted file mode 100644
index efb6cd18a7..0000000000
--- a/src/ecwrapper.h
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright (c) 2009-2014 The Bitcoin Core developers
-// Distributed under the MIT software license, see the accompanying
-// file COPYING or http://www.opensource.org/licenses/mit-license.php.
-
-#ifndef BITCOIN_ECWRAPPER_H
-#define BITCOIN_ECWRAPPER_H
-
-#include <cstddef>
-#include <vector>
-
-#include <openssl/ec.h>
-
-class uint256;
-
-/** RAII Wrapper around OpenSSL's EC_KEY */
-class CECKey {
-private:
- EC_KEY *pkey;
-
-public:
- CECKey();
- ~CECKey();
-
- void GetPubKey(std::vector<unsigned char>& pubkey, bool fCompressed);
- bool SetPubKey(const unsigned char* pubkey, size_t size);
- bool Verify(const uint256 &hash, const std::vector<unsigned char>& vchSig);
-
- /**
- * reconstruct public key from a compact signature
- * This is only slightly more CPU intensive than just verifying it.
- * If this function succeeds, the recovered public key is guaranteed to be valid
- * (the signature is a valid signature of the given data for that key)
- */
- bool Recover(const uint256 &hash, const unsigned char *p64, int rec);
-
- bool TweakPublic(const unsigned char vchTweak[32]);
- static bool SanityCheck();
-};
-
-#endif // BITCOIN_ECWRAPPER_H
diff --git a/src/httprpc.cpp b/src/httprpc.cpp
index 98ac750bb1..2920aa26f7 100644
--- a/src/httprpc.cpp
+++ b/src/httprpc.cpp
@@ -10,8 +10,12 @@
#include "util.h"
#include "utilstrencodings.h"
#include "ui_interface.h"
+#include "crypto/hmac_sha256.h"
+#include <stdio.h>
+#include "utilstrencodings.h"
#include <boost/algorithm/string.hpp> // boost::trim
+#include <boost/foreach.hpp> //BOOST_FOREACH
/** Simple one-shot callback timer to be used by the RPC mechanism to e.g.
* re-lock the wellet.
@@ -72,6 +76,50 @@ static void JSONErrorReply(HTTPRequest* req, const UniValue& objError, const Uni
req->WriteReply(nStatus, strReply);
}
+//This function checks username and password against -rpcauth
+//entries from config file.
+static bool multiUserAuthorized(std::string strUserPass)
+{
+ if (strUserPass.find(":") == std::string::npos) {
+ return false;
+ }
+ std::string strUser = strUserPass.substr(0, strUserPass.find(":"));
+ std::string strPass = strUserPass.substr(strUserPass.find(":") + 1);
+
+ if (mapMultiArgs.count("-rpcauth") > 0) {
+ //Search for multi-user login/pass "rpcauth" from config
+ BOOST_FOREACH(std::string strRPCAuth, mapMultiArgs["-rpcauth"])
+ {
+ std::vector<std::string> vFields;
+ boost::split(vFields, strRPCAuth, boost::is_any_of(":$"));
+ if (vFields.size() != 3) {
+ //Incorrect formatting in config file
+ continue;
+ }
+
+ std::string strName = vFields[0];
+ if (!TimingResistantEqual(strName, strUser)) {
+ continue;
+ }
+
+ std::string strSalt = vFields[1];
+ std::string strHash = vFields[2];
+
+ unsigned int KEY_SIZE = 32;
+ unsigned char *out = new unsigned char[KEY_SIZE];
+
+ CHMAC_SHA256(reinterpret_cast<const unsigned char*>(strSalt.c_str()), strSalt.size()).Write(reinterpret_cast<const unsigned char*>(strPass.c_str()), strPass.size()).Finalize(out);
+ std::vector<unsigned char> hexvec(out, out+KEY_SIZE);
+ std::string strHashFromPass = HexStr(hexvec);
+
+ if (TimingResistantEqual(strHashFromPass, strHash)) {
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
static bool RPCAuthorized(const std::string& strAuth)
{
if (strRPCUserColonPass.empty()) // Belt-and-suspenders measure if InitRPCAuthentication was not called
@@ -81,7 +129,12 @@ static bool RPCAuthorized(const std::string& strAuth)
std::string strUserPass64 = strAuth.substr(6);
boost::trim(strUserPass64);
std::string strUserPass = DecodeBase64(strUserPass64);
- return TimingResistantEqual(strUserPass, strRPCUserColonPass);
+
+ //Check if authorized under single-user field
+ if (TimingResistantEqual(strUserPass, strRPCUserColonPass)) {
+ return true;
+ }
+ return multiUserAuthorized(strUserPass);
}
static bool HTTPReq_JSONRPC(HTTPRequest* req, const std::string &)
@@ -157,6 +210,7 @@ static bool InitRPCAuthentication()
return false;
}
} else {
+ LogPrintf("Config options rpcuser and rpcpassword will soon be deprecated. Locally-run instances may remove rpcuser to use cookie-based auth, or may be replaced with rpcauth. Please see share/rpcuser for rpcauth auth generation.");
strRPCUserColonPass = mapArgs["-rpcuser"] + ":" + mapArgs["-rpcpassword"];
}
return true;
diff --git a/src/httpserver.cpp b/src/httpserver.cpp
index 8698abb900..91518d7c5f 100644
--- a/src/httpserver.cpp
+++ b/src/httpserver.cpp
@@ -365,6 +365,10 @@ static void HTTPWorkQueueRun(WorkQueue<HTTPClosure>* queue)
/** libevent event log callback */
static void libevent_log_cb(int severity, const char *msg)
{
+#ifndef EVENT_LOG_WARN
+// EVENT_LOG_WARN was added in 2.0.19; but before then _EVENT_LOG_WARN existed.
+# define EVENT_LOG_WARN _EVENT_LOG_WARN
+#endif
if (severity >= EVENT_LOG_WARN) // Log warn messages and higher without debug category
LogPrintf("libevent: %s\n", msg);
else
@@ -438,15 +442,17 @@ bool InitHTTPServer()
return true;
}
-bool StartHTTPServer(boost::thread_group& threadGroup)
+boost::thread threadHTTP;
+
+bool StartHTTPServer()
{
LogPrint("http", "Starting HTTP server\n");
int rpcThreads = std::max((long)GetArg("-rpcthreads", DEFAULT_HTTP_THREADS), 1L);
LogPrintf("HTTP: starting %d worker threads\n", rpcThreads);
- threadGroup.create_thread(boost::bind(&ThreadHTTP, eventBase, eventHTTP));
+ threadHTTP = boost::thread(boost::bind(&ThreadHTTP, eventBase, eventHTTP));
for (int i = 0; i < rpcThreads; i++)
- threadGroup.create_thread(boost::bind(&HTTPWorkQueueRun, workQueue));
+ boost::thread(boost::bind(&HTTPWorkQueueRun, workQueue));
return true;
}
@@ -461,13 +467,6 @@ void InterruptHTTPServer()
// Reject requests on current connections
evhttp_set_gencb(eventHTTP, http_reject_request_cb, NULL);
}
- if (eventBase) {
- // Force-exit event loop after predefined time
- struct timeval tv;
- tv.tv_sec = 10;
- tv.tv_usec = 0;
- event_base_loopexit(eventBase, &tv);
- }
if (workQueue)
workQueue->Interrupt();
}
@@ -480,6 +479,24 @@ void StopHTTPServer()
workQueue->WaitExit();
delete workQueue;
}
+ if (eventBase) {
+ LogPrint("http", "Waiting for HTTP event thread to exit\n");
+ // Give event loop a few seconds to exit (to send back last RPC responses), then break it
+ // Before this was solved with event_base_loopexit, but that didn't work as expected in
+ // at least libevent 2.0.21 and always introduced a delay. In libevent
+ // master that appears to be solved, so in the future that solution
+ // could be used again (if desirable).
+ // (see discussion in https://github.com/bitcoin/bitcoin/pull/6990)
+#if BOOST_VERSION >= 105000
+ if (!threadHTTP.try_join_for(boost::chrono::milliseconds(2000))) {
+#else
+ if (!threadHTTP.timed_join(boost::posix_time::milliseconds(2000))) {
+#endif
+ LogPrintf("HTTP event loop did not exit within allotted time, sending loopbreak\n");
+ event_base_loopbreak(eventBase);
+ threadHTTP.join();
+ }
+ }
if (eventHTTP) {
evhttp_free(eventHTTP);
eventHTTP = 0;
@@ -488,6 +505,7 @@ void StopHTTPServer()
event_base_free(eventBase);
eventBase = 0;
}
+ LogPrint("http", "Stopped HTTP server\n");
}
struct event_base* EventBase()
diff --git a/src/httpserver.h b/src/httpserver.h
index b377dc19fc..20a119cc5c 100644
--- a/src/httpserver.h
+++ b/src/httpserver.h
@@ -28,7 +28,7 @@ bool InitHTTPServer();
* This is separate from InitHTTPServer to give users race-condition-free time
* to register their handlers between InitHTTPServer and StartHTTPServer.
*/
-bool StartHTTPServer(boost::thread_group& threadGroup);
+bool StartHTTPServer();
/** Interrupt HTTP server threads */
void InterruptHTTPServer();
/** Stop HTTP server */
diff --git a/src/init.cpp b/src/init.cpp
index a83a136fa5..3fd60abfc2 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -66,6 +66,10 @@ using namespace std;
CWallet* pwalletMain = NULL;
#endif
bool fFeeEstimatesInitialized = false;
+static const bool DEFAULT_PROXYRANDOMIZE = true;
+static const bool DEFAULT_REST_ENABLE = false;
+static const bool DEFAULT_DISABLE_SAFEMODE = false;
+static const bool DEFAULT_STOPAFTERBLOCKIMPORT = false;
#if ENABLE_ZMQ
static CZMQNotificationInterface* pzmqNotificationInterface = NULL;
@@ -154,6 +158,7 @@ public:
static CCoinsViewDB *pcoinsdbview = NULL;
static CCoinsViewErrorCatcher *pcoinscatcher = NULL;
+static boost::scoped_ptr<ECCVerifyHandle> globalVerifyHandle;
void Interrupt(boost::thread_group& threadGroup)
{
@@ -243,6 +248,7 @@ void Shutdown()
delete pwalletMain;
pwalletMain = NULL;
#endif
+ globalVerifyHandle.reset();
ECC_Stop();
LogPrintf("%s: done\n", __func__);
}
@@ -294,7 +300,7 @@ void OnRPCPreCommand(const CRPCCommand& cmd)
{
// Observe safe mode
string strWarning = GetWarnings("rpc");
- if (strWarning != "" && !GetBoolArg("-disablesafemode", false) &&
+ if (strWarning != "" && !GetBoolArg("-disablesafemode", DEFAULT_DISABLE_SAFEMODE) &&
!cmd.okSafeMode)
throw JSONRPCError(RPC_FORBIDDEN_BY_SAFE_MODE, string("Safe mode: ") + strWarning);
}
@@ -310,9 +316,11 @@ std::string HelpMessage(HelpMessageMode mode)
strUsage += HelpMessageOpt("-alerts", strprintf(_("Receive and display P2P network alerts (default: %u)"), DEFAULT_ALERTS));
strUsage += HelpMessageOpt("-alertnotify=<cmd>", _("Execute command when a relevant alert is received or we see a really long fork (%s in cmd is replaced by message)"));
strUsage += HelpMessageOpt("-blocknotify=<cmd>", _("Execute command when the best block changes (%s in cmd is replaced by block hash)"));
+ if (showDebug)
+ strUsage += HelpMessageOpt("-blocksonly", strprintf(_("Whether to operate in a blocks only mode (default: %u)"), DEFAULT_BLOCKSONLY));
strUsage += HelpMessageOpt("-checkblocks=<n>", strprintf(_("How many blocks to check at startup (default: %u, 0 = all)"), DEFAULT_CHECKBLOCKS));
strUsage += HelpMessageOpt("-checklevel=<n>", strprintf(_("How thorough the block verification of -checkblocks is (0-4, default: %u)"), DEFAULT_CHECKLEVEL));
- strUsage += HelpMessageOpt("-conf=<file>", strprintf(_("Specify configuration file (default: %s)"), "bitcoin.conf"));
+ strUsage += HelpMessageOpt("-conf=<file>", strprintf(_("Specify configuration file (default: %s)"), BITCOIN_CONF_FILENAME));
if (mode == HMM_BITCOIND)
{
#ifndef WIN32
@@ -328,7 +336,7 @@ std::string HelpMessage(HelpMessageMode mode)
strUsage += HelpMessageOpt("-par=<n>", strprintf(_("Set the number of script verification threads (%u to %d, 0 = auto, <0 = leave that many cores free, default: %d)"),
-GetNumCores(), MAX_SCRIPTCHECK_THREADS, DEFAULT_SCRIPTCHECK_THREADS));
#ifndef WIN32
- strUsage += HelpMessageOpt("-pid=<file>", strprintf(_("Specify pid file (default: %s)"), "bitcoind.pid"));
+ strUsage += HelpMessageOpt("-pid=<file>", strprintf(_("Specify pid file (default: %s)"), BITCOIN_PID_FILENAME));
#endif
strUsage += HelpMessageOpt("-prune=<n>", strprintf(_("Reduce storage requirements by pruning (deleting) old blocks. This mode is incompatible with -txindex and -rescan. "
"Warning: Reverting this setting requires re-downloading the entire blockchain. "
@@ -337,30 +345,33 @@ std::string HelpMessage(HelpMessageMode mode)
#ifndef WIN32
strUsage += HelpMessageOpt("-sysperms", _("Create new files with system default permissions, instead of umask 077 (only effective with disabled wallet functionality)"));
#endif
- strUsage += HelpMessageOpt("-txindex", strprintf(_("Maintain a full transaction index, used by the getrawtransaction rpc call (default: %u)"), 0));
+ strUsage += HelpMessageOpt("-txindex", strprintf(_("Maintain a full transaction index, used by the getrawtransaction rpc call (default: %u)"), DEFAULT_TXINDEX));
strUsage += HelpMessageGroup(_("Connection options:"));
strUsage += HelpMessageOpt("-addnode=<ip>", _("Add a node to connect to and attempt to keep the connection open"));
- strUsage += HelpMessageOpt("-banscore=<n>", strprintf(_("Threshold for disconnecting misbehaving peers (default: %u)"), 100));
- strUsage += HelpMessageOpt("-bantime=<n>", strprintf(_("Number of seconds to keep misbehaving peers from reconnecting (default: %u)"), 86400));
+ strUsage += HelpMessageOpt("-banscore=<n>", strprintf(_("Threshold for disconnecting misbehaving peers (default: %u)"), DEFAULT_BANSCORE_THRESHOLD));
+ strUsage += HelpMessageOpt("-bantime=<n>", strprintf(_("Number of seconds to keep misbehaving peers from reconnecting (default: %u)"), DEFAULT_MISBEHAVING_BANTIME));
strUsage += HelpMessageOpt("-bind=<addr>", _("Bind to given address and always listen on it. Use [host]:port notation for IPv6"));
strUsage += HelpMessageOpt("-connect=<ip>", _("Connect only to the specified node(s)"));
strUsage += HelpMessageOpt("-discover", _("Discover own IP addresses (default: 1 when listening and no -externalip or -proxy)"));
- strUsage += HelpMessageOpt("-dns", _("Allow DNS lookups for -addnode, -seednode and -connect") + " " + _("(default: 1)"));
+ strUsage += HelpMessageOpt("-dns", _("Allow DNS lookups for -addnode, -seednode and -connect") + " " + strprintf(_("(default: %u)"), DEFAULT_NAME_LOOKUP));
strUsage += HelpMessageOpt("-dnsseed", _("Query for peer addresses via DNS lookup, if low on addresses (default: 1 unless -connect)"));
strUsage += HelpMessageOpt("-externalip=<ip>", _("Specify your own public address"));
- strUsage += HelpMessageOpt("-forcednsseed", strprintf(_("Always query for peer addresses via DNS lookup (default: %u)"), 0));
+ strUsage += HelpMessageOpt("-forcednsseed", strprintf(_("Always query for peer addresses via DNS lookup (default: %u)"), DEFAULT_FORCEDNSSEED));
strUsage += HelpMessageOpt("-listen", _("Accept connections from outside (default: 1 if no -proxy or -connect)"));
strUsage += HelpMessageOpt("-listenonion", strprintf(_("Automatically create Tor hidden service (default: %d)"), DEFAULT_LISTEN_ONION));
strUsage += HelpMessageOpt("-maxconnections=<n>", strprintf(_("Maintain at most <n> connections to peers (default: %u)"), DEFAULT_MAX_PEER_CONNECTIONS));
- strUsage += HelpMessageOpt("-maxreceivebuffer=<n>", strprintf(_("Maximum per-connection receive buffer, <n>*1000 bytes (default: %u)"), 5000));
- strUsage += HelpMessageOpt("-maxsendbuffer=<n>", strprintf(_("Maximum per-connection send buffer, <n>*1000 bytes (default: %u)"), 1000));
+ strUsage += HelpMessageOpt("-maxreceivebuffer=<n>", strprintf(_("Maximum per-connection receive buffer, <n>*1000 bytes (default: %u)"), DEFAULT_MAXRECEIVEBUFFER));
+ strUsage += HelpMessageOpt("-maxsendbuffer=<n>", strprintf(_("Maximum per-connection send buffer, <n>*1000 bytes (default: %u)"), DEFAULT_MAXSENDBUFFER));
strUsage += HelpMessageOpt("-onion=<ip:port>", strprintf(_("Use separate SOCKS5 proxy to reach peers via Tor hidden services (default: %s)"), "-proxy"));
strUsage += HelpMessageOpt("-onlynet=<net>", _("Only connect to nodes in network <net> (ipv4, ipv6 or onion)"));
- strUsage += HelpMessageOpt("-permitbaremultisig", strprintf(_("Relay non-P2SH multisig (default: %u)"), 1));
- strUsage += HelpMessageOpt("-port=<port>", strprintf(_("Listen for connections on <port> (default: %u or testnet: %u)"), 8333, 18333));
+ strUsage += HelpMessageOpt("-permitbaremultisig", strprintf(_("Relay non-P2SH multisig (default: %u)"), DEFAULT_PERMIT_BAREMULTISIG));
+ strUsage += HelpMessageOpt("-peerbloomfilters", strprintf(_("Support filtering of blocks and transaction with bloom filters (default: %u)"), 1));
+ if (showDebug)
+ strUsage += HelpMessageOpt("-enforcenodebloom", strprintf("Enforce minimum protocol version to limit use of bloom filters (default: %u)", 0));
+ strUsage += HelpMessageOpt("-port=<port>", strprintf(_("Listen for connections on <port> (default: %u or testnet: %u)"), Params(CBaseChainParams::MAIN).GetDefaultPort(), Params(CBaseChainParams::TESTNET).GetDefaultPort()));
strUsage += HelpMessageOpt("-proxy=<ip:port>", _("Connect through SOCKS5 proxy"));
- strUsage += HelpMessageOpt("-proxyrandomize", strprintf(_("Randomize credentials for every proxy connection. This enables Tor stream isolation (default: %u)"), 1));
+ strUsage += HelpMessageOpt("-proxyrandomize", strprintf(_("Randomize credentials for every proxy connection. This enables Tor stream isolation (default: %u)"), DEFAULT_PROXYRANDOMIZE));
strUsage += HelpMessageOpt("-seednode=<ip>", _("Connect to a node to retrieve peer addresses, and disconnect"));
strUsage += HelpMessageOpt("-timeout=<n>", strprintf(_("Specify connection timeout in milliseconds (minimum: 1, default: %d)"), DEFAULT_CONNECT_TIMEOUT));
strUsage += HelpMessageOpt("-torcontrol=<ip>:<port>", strprintf(_("Tor control port to use if onion listening enabled (default: %s)"), DEFAULT_TOR_CONTROL));
@@ -375,12 +386,13 @@ std::string HelpMessage(HelpMessageMode mode)
strUsage += HelpMessageOpt("-whitebind=<addr>", _("Bind to given address and whitelist peers connecting to it. Use [host]:port notation for IPv6"));
strUsage += HelpMessageOpt("-whitelist=<netmask>", _("Whitelist peers connecting from the given netmask or IP address. Can be specified multiple times.") +
" " + _("Whitelisted peers cannot be DoS banned and their transactions are always relayed, even if they are already in the mempool, useful e.g. for a gateway"));
+ strUsage += HelpMessageOpt("-whitelistalwaysrelay", strprintf(_("Always relay transactions received from whitelisted peers (default: %d)"), DEFAULT_WHITELISTALWAYSRELAY));
strUsage += HelpMessageOpt("-maxuploadtarget=<n>", strprintf(_("Tries to keep outbound traffic under the given target (in MiB per 24h), 0 = no limit (default: %d)"), DEFAULT_MAX_UPLOAD_TARGET));
#ifdef ENABLE_WALLET
strUsage += HelpMessageGroup(_("Wallet options:"));
strUsage += HelpMessageOpt("-disablewallet", _("Do not load the wallet and disable wallet RPC calls"));
- strUsage += HelpMessageOpt("-keypool=<n>", strprintf(_("Set key pool size to <n> (default: %u)"), 100));
+ strUsage += HelpMessageOpt("-keypool=<n>", strprintf(_("Set key pool size to <n> (default: %u)"), DEFAULT_KEYPOOL_SIZE));
if (showDebug)
strUsage += HelpMessageOpt("-mintxfee=<amt>", strprintf("Fees (in %s/kB) smaller than this are considered zero fee for transaction creation (default: %s)",
CURRENCY_UNIT, FormatMoney(DEFAULT_TRANSACTION_MINFEE)));
@@ -388,14 +400,14 @@ std::string HelpMessage(HelpMessageMode mode)
CURRENCY_UNIT, FormatMoney(payTxFee.GetFeePerK())));
strUsage += HelpMessageOpt("-rescan", _("Rescan the block chain for missing wallet transactions on startup"));
strUsage += HelpMessageOpt("-salvagewallet", _("Attempt to recover private keys from a corrupt wallet.dat on startup"));
- strUsage += HelpMessageOpt("-sendfreetransactions", strprintf(_("Send transactions as zero-fee transactions if possible (default: %u)"), 0));
- strUsage += HelpMessageOpt("-spendzeroconfchange", strprintf(_("Spend unconfirmed change when sending transactions (default: %u)"), 1));
+ strUsage += HelpMessageOpt("-sendfreetransactions", strprintf(_("Send transactions as zero-fee transactions if possible (default: %u)"), DEFAULT_SEND_FREE_TRANSACTIONS));
+ strUsage += HelpMessageOpt("-spendzeroconfchange", strprintf(_("Spend unconfirmed change when sending transactions (default: %u)"), DEFAULT_SPEND_ZEROCONF_CHANGE));
strUsage += HelpMessageOpt("-txconfirmtarget=<n>", strprintf(_("If paytxfee is not set, include enough fee so transactions begin confirmation on average within n blocks (default: %u)"), DEFAULT_TX_CONFIRM_TARGET));
strUsage += HelpMessageOpt("-maxtxfee=<amt>", strprintf(_("Maximum total fees (in %s) to use in a single wallet transaction; setting this too low may abort large transactions (default: %s)"),
CURRENCY_UNIT, FormatMoney(DEFAULT_TRANSACTION_MAXFEE)));
strUsage += HelpMessageOpt("-upgradewallet", _("Upgrade wallet to latest format on startup"));
strUsage += HelpMessageOpt("-wallet=<file>", _("Specify wallet file (within data directory)") + " " + strprintf(_("(default: %s)"), "wallet.dat"));
- strUsage += HelpMessageOpt("-walletbroadcast", _("Make the wallet broadcast transactions") + " " + strprintf(_("(default: %u)"), true));
+ strUsage += HelpMessageOpt("-walletbroadcast", _("Make the wallet broadcast transactions") + " " + strprintf(_("(default: %u)"), DEFAULT_WALLETBROADCAST));
strUsage += HelpMessageOpt("-walletnotify=<cmd>", _("Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)"));
strUsage += HelpMessageOpt("-zapwallettxes=<mode>", _("Delete all wallet transactions and only recover those parts of the blockchain through -rescan on startup") +
" " + _("(1 = keep tx meta data e.g. account owner and payment request information, 2 = drop tx meta data)"));
@@ -404,46 +416,46 @@ std::string HelpMessage(HelpMessageMode mode)
#if ENABLE_ZMQ
strUsage += HelpMessageGroup(_("ZeroMQ notification options:"));
strUsage += HelpMessageOpt("-zmqpubhashblock=<address>", _("Enable publish hash block in <address>"));
- strUsage += HelpMessageOpt("-zmqpubhashtransaction=<address>", _("Enable publish hash transaction in <address>"));
+ strUsage += HelpMessageOpt("-zmqpubhashtx=<address>", _("Enable publish hash transaction in <address>"));
strUsage += HelpMessageOpt("-zmqpubrawblock=<address>", _("Enable publish raw block in <address>"));
- strUsage += HelpMessageOpt("-zmqpubrawtransaction=<address>", _("Enable publish raw transaction in <address>"));
+ strUsage += HelpMessageOpt("-zmqpubrawtx=<address>", _("Enable publish raw transaction in <address>"));
#endif
strUsage += HelpMessageGroup(_("Debugging/Testing options:"));
if (showDebug)
{
- strUsage += HelpMessageOpt("-checkpoints", strprintf("Disable expensive verification for known chain history (default: %u)", 1));
+ strUsage += HelpMessageOpt("-checkpoints", strprintf("Disable expensive verification for known chain history (default: %u)", DEFAULT_CHECKPOINTS_ENABLED));
#ifdef ENABLE_WALLET
strUsage += HelpMessageOpt("-dblogsize=<n>", strprintf("Flush wallet database activity from memory to disk log every <n> megabytes (default: %u)", DEFAULT_WALLET_DBLOGSIZE));
#endif
- strUsage += HelpMessageOpt("-disablesafemode", strprintf("Disable safemode, override a real safe mode event (default: %u)", 0));
- strUsage += HelpMessageOpt("-testsafemode", strprintf("Force safe mode (default: %u)", 0));
+ strUsage += HelpMessageOpt("-disablesafemode", strprintf("Disable safemode, override a real safe mode event (default: %u)", DEFAULT_DISABLE_SAFEMODE));
+ strUsage += HelpMessageOpt("-testsafemode", strprintf("Force safe mode (default: %u)", DEFAULT_TESTSAFEMODE));
strUsage += HelpMessageOpt("-dropmessagestest=<n>", "Randomly drop 1 of every <n> network messages");
strUsage += HelpMessageOpt("-fuzzmessagestest=<n>", "Randomly fuzz 1 of every <n> network messages");
#ifdef ENABLE_WALLET
- strUsage += HelpMessageOpt("-flushwallet", strprintf("Run a thread to flush wallet periodically (default: %u)", 1));
+ strUsage += HelpMessageOpt("-flushwallet", strprintf("Run a thread to flush wallet periodically (default: %u)", DEFAULT_FLUSHWALLET));
#endif
- strUsage += HelpMessageOpt("-stopafterblockimport", strprintf("Stop running after importing blocks from disk (default: %u)", 0));
+ strUsage += HelpMessageOpt("-stopafterblockimport", strprintf("Stop running after importing blocks from disk (default: %u)", DEFAULT_STOPAFTERBLOCKIMPORT));
strUsage += HelpMessageOpt("-limitancestorcount=<n>", strprintf("Do not accept transactions if number of in-mempool ancestors is <n> or more (default: %u)", DEFAULT_ANCESTOR_LIMIT));
strUsage += HelpMessageOpt("-limitancestorsize=<n>", strprintf("Do not accept transactions whose size with all in-mempool ancestors exceeds <n> kilobytes (default: %u)", DEFAULT_ANCESTOR_SIZE_LIMIT));
strUsage += HelpMessageOpt("-limitdescendantcount=<n>", strprintf("Do not accept transactions if any ancestor would have <n> or more in-mempool descendants (default: %u)", DEFAULT_DESCENDANT_LIMIT));
strUsage += HelpMessageOpt("-limitdescendantsize=<n>", strprintf("Do not accept transactions if any ancestor would have more than <n> kilobytes of in-mempool descendants (default: %u).", DEFAULT_DESCENDANT_SIZE_LIMIT));
}
- string debugCategories = "addrman, alert, bench, coindb, db, lock, rand, rpc, selectcoins, mempool, mempoolrej, net, proxy, prune, http, libevent"; // Don't translate these and qt below
+ string debugCategories = "addrman, alert, bench, coindb, db, lock, rand, rpc, selectcoins, mempool, mempoolrej, net, proxy, prune, http, libevent, tor, zmq"; // Don't translate these and qt below
if (mode == HMM_BITCOIN_QT)
debugCategories += ", qt";
strUsage += HelpMessageOpt("-debug=<category>", strprintf(_("Output debugging information (default: %u, supplying <category> is optional)"), 0) + ". " +
_("If <category> is not supplied or if <category> = 1, output all debugging information.") + _("<category> can be:") + " " + debugCategories + ".");
- strUsage += HelpMessageOpt("-gen", strprintf(_("Generate coins (default: %u)"), 0));
+ strUsage += HelpMessageOpt("-gen", strprintf(_("Generate coins (default: %u)"), DEFAULT_GENERATE));
strUsage += HelpMessageOpt("-genproclimit=<n>", strprintf(_("Set the number of threads for coin generation if enabled (-1 = all cores, default: %d)"), DEFAULT_GENERATE_THREADS));
strUsage += HelpMessageOpt("-help-debug", _("Show all debugging options (usage: --help -help-debug)"));
- strUsage += HelpMessageOpt("-logips", strprintf(_("Include IP addresses in debug output (default: %u)"), 0));
- strUsage += HelpMessageOpt("-logtimestamps", strprintf(_("Prepend debug output with timestamp (default: %u)"), 1));
+ strUsage += HelpMessageOpt("-logips", strprintf(_("Include IP addresses in debug output (default: %u)"), DEFAULT_LOGIPS));
+ strUsage += HelpMessageOpt("-logtimestamps", strprintf(_("Prepend debug output with timestamp (default: %u)"), DEFAULT_LOGTIMESTAMPS));
if (showDebug)
{
strUsage += HelpMessageOpt("-logtimemicros", strprintf("Add microsecond precision to debug timestamps (default: %u)", DEFAULT_LOGTIMEMICROS));
- strUsage += HelpMessageOpt("-limitfreerelay=<n>", strprintf("Continuously rate-limit free transactions to <n>*1000 bytes per minute (default: %u)", 15));
- strUsage += HelpMessageOpt("-relaypriority", strprintf("Require high priority for relaying free or low-fee transactions (default: %u)", 1));
+ strUsage += HelpMessageOpt("-limitfreerelay=<n>", strprintf("Continuously rate-limit free transactions to <n>*1000 bytes per minute (default: %u)", DEFAULT_LIMITFREERELAY));
+ strUsage += HelpMessageOpt("-relaypriority", strprintf("Require high priority for relaying free or low-fee transactions (default: %u)", DEFAULT_RELAYPRIORITY));
strUsage += HelpMessageOpt("-maxsigcachesize=<n>", strprintf("Limit size of signature cache to <n> MiB (default: %u)", DEFAULT_MAX_SIG_CACHE_SIZE));
}
strUsage += HelpMessageOpt("-minrelaytxfee=<amt>", strprintf(_("Fees (in %s/kB) smaller than this are considered zero fee for relaying, mining and transaction creation (default: %s)"),
@@ -451,8 +463,10 @@ std::string HelpMessage(HelpMessageMode mode)
strUsage += HelpMessageOpt("-printtoconsole", _("Send trace/debug info to console instead of debug.log file"));
if (showDebug)
{
- strUsage += HelpMessageOpt("-printpriority", strprintf("Log transaction priority and fee per kB when mining blocks (default: %u)", 0));
- strUsage += HelpMessageOpt("-privdb", strprintf("Sets the DB_PRIVATE flag in the wallet db environment (default: %u)", 1));
+ strUsage += HelpMessageOpt("-printpriority", strprintf("Log transaction priority and fee per kB when mining blocks (default: %u)", DEFAULT_PRINTPRIORITY));
+#ifdef ENABLE_WALLET
+ strUsage += HelpMessageOpt("-privdb", strprintf("Sets the DB_PRIVATE flag in the wallet db environment (default: %u)", DEFAULT_WALLET_PRIVDB));
+#endif
}
strUsage += HelpMessageOpt("-shrinkdebugfile", _("Shrink debug.log file on client startup (default: 1 when no -debug)"));
@@ -461,11 +475,11 @@ std::string HelpMessage(HelpMessageMode mode)
strUsage += HelpMessageGroup(_("Node relay options:"));
if (showDebug)
strUsage += HelpMessageOpt("-acceptnonstdtxn", strprintf("Relay and mine \"non-standard\" transactions (%sdefault: %u)", "testnet/regtest only; ", !Params(CBaseChainParams::TESTNET).RequireStandard()));
- strUsage += HelpMessageOpt("-datacarrier", strprintf(_("Relay and mine data carrier transactions (default: %u)"), 1));
+ strUsage += HelpMessageOpt("-datacarrier", strprintf(_("Relay and mine data carrier transactions (default: %u)"), DEFAULT_ACCEPT_DATACARRIER));
strUsage += HelpMessageOpt("-datacarriersize", strprintf(_("Maximum size of data in data carrier transactions we relay and mine (default: %u)"), MAX_OP_RETURN_RELAY));
strUsage += HelpMessageGroup(_("Block creation options:"));
- strUsage += HelpMessageOpt("-blockminsize=<n>", strprintf(_("Set minimum block size in bytes (default: %u)"), 0));
+ strUsage += HelpMessageOpt("-blockminsize=<n>", strprintf(_("Set minimum block size in bytes (default: %u)"), DEFAULT_BLOCK_MIN_SIZE));
strUsage += HelpMessageOpt("-blockmaxsize=<n>", strprintf(_("Set maximum block size in bytes (default: %d)"), DEFAULT_BLOCK_MAX_SIZE));
strUsage += HelpMessageOpt("-blockprioritysize=<n>", strprintf(_("Set maximum size of high-priority/low-fee transactions in bytes (default: %d)"), DEFAULT_BLOCK_PRIORITY_SIZE));
if (showDebug)
@@ -473,10 +487,11 @@ std::string HelpMessage(HelpMessageMode mode)
strUsage += HelpMessageGroup(_("RPC server options:"));
strUsage += HelpMessageOpt("-server", _("Accept command line and JSON-RPC commands"));
- strUsage += HelpMessageOpt("-rest", strprintf(_("Accept public REST requests (default: %u)"), 0));
+ strUsage += HelpMessageOpt("-rest", strprintf(_("Accept public REST requests (default: %u)"), DEFAULT_REST_ENABLE));
strUsage += HelpMessageOpt("-rpcbind=<addr>", _("Bind to given address to listen for JSON-RPC connections. Use [host]:port notation for IPv6. This option can be specified multiple times (default: bind to all interfaces)"));
strUsage += HelpMessageOpt("-rpcuser=<user>", _("Username for JSON-RPC connections"));
strUsage += HelpMessageOpt("-rpcpassword=<pw>", _("Password for JSON-RPC connections"));
+ strUsage += HelpMessageOpt("-rpcauth=<userpw>", _("Username and hashed password for JSON-RPC connections. The field <userpw> comes in the format: <USERNAME>:<SALT>$<HASH>. A canonical python script is included in share/rpcuser. This option can be specified multiple times"));
strUsage += HelpMessageOpt("-rpcport=<port>", strprintf(_("Listen for JSON-RPC connections on <port> (default: %u or testnet: %u)"), 8332, 18332));
strUsage += HelpMessageOpt("-rpcallowip=<ip>", _("Allow JSON-RPC connections from specified source. Valid for <ip> are a single IP (e.g. 1.2.3.4), a network/netmask (e.g. 1.2.3.4/255.255.255.0) or a network/CIDR (e.g. 1.2.3.4/24). This option can be specified multiple times"));
strUsage += HelpMessageOpt("-rpcthreads=<n>", strprintf(_("Set the number of threads to service RPC calls (default: %d)"), DEFAULT_HTTP_THREADS));
@@ -485,22 +500,6 @@ std::string HelpMessage(HelpMessageMode mode)
strUsage += HelpMessageOpt("-rpcservertimeout=<n>", strprintf("Timeout during HTTP requests (default: %d)", DEFAULT_HTTP_SERVER_TIMEOUT));
}
- if (mode == HMM_BITCOIN_QT)
- {
- strUsage += HelpMessageGroup(_("UI Options:"));
- if (showDebug) {
- strUsage += HelpMessageOpt("-allowselfsignedrootcertificates", "Allow self signed root certificates (default: 0)");
- }
- strUsage += HelpMessageOpt("-choosedatadir", _("Choose data directory on startup (default: 0)"));
- strUsage += HelpMessageOpt("-lang=<lang>", _("Set language, for example \"de_DE\" (default: system locale)"));
- strUsage += HelpMessageOpt("-min", _("Start minimized"));
- strUsage += HelpMessageOpt("-rootcertificates=<file>", _("Set SSL root certificates for payment request (default: -system-)"));
- strUsage += HelpMessageOpt("-splash", _("Show splash screen on startup (default: 1)"));
- if (showDebug) {
- strUsage += HelpMessageOpt("-uiplatform", "Select platform to customize UI for (one of windows, macosx, other; default: platform compiled on)");
- }
- }
-
return strUsage;
}
@@ -517,11 +516,14 @@ std::string LicenseInfo()
"\n";
}
-static void BlockNotifyCallback(const uint256& hashNewTip)
+static void BlockNotifyCallback(bool initialSync, const CBlockIndex *pBlockIndex)
{
+ if (initialSync || !pBlockIndex)
+ return;
+
std::string strCmd = GetArg("-blocknotify", "");
- boost::replace_all(strCmd, "%s", hashNewTip.GetHex());
+ boost::replace_all(strCmd, "%s", pBlockIndex->GetBlockHash().GetHex());
boost::thread t(runCommand, strCmd); // thread runs free
}
@@ -583,6 +585,7 @@ void CleanupBlockRevFiles()
void ThreadImport(std::vector<boost::filesystem::path> vImportFiles)
{
+ const CChainParams& chainparams = Params();
RenameThread("bitcoin-loadblk");
// -reindex
if (fReindex) {
@@ -596,14 +599,14 @@ void ThreadImport(std::vector<boost::filesystem::path> vImportFiles)
if (!file)
break; // This error is logged in OpenBlockFile
LogPrintf("Reindexing block file blk%05u.dat...\n", (unsigned int)nFile);
- LoadExternalBlockFile(file, &pos);
+ LoadExternalBlockFile(chainparams, file, &pos);
nFile++;
}
pblocktree->WriteReindexing(false);
fReindex = false;
LogPrintf("Reindexing finished\n");
// To avoid ending up in a situation without genesis block, re-try initializing (no-op if reindexing worked):
- InitBlockIndex();
+ InitBlockIndex(chainparams);
}
// hardcoded $DATADIR/bootstrap.dat
@@ -614,7 +617,7 @@ void ThreadImport(std::vector<boost::filesystem::path> vImportFiles)
CImportingNow imp;
boost::filesystem::path pathBootstrapOld = GetDataDir() / "bootstrap.dat.old";
LogPrintf("Importing bootstrap.dat...\n");
- LoadExternalBlockFile(file);
+ LoadExternalBlockFile(chainparams, file);
RenameOver(pathBootstrap, pathBootstrapOld);
} else {
LogPrintf("Warning: Could not open bootstrap file %s\n", pathBootstrap.string());
@@ -627,13 +630,13 @@ void ThreadImport(std::vector<boost::filesystem::path> vImportFiles)
if (file) {
CImportingNow imp;
LogPrintf("Importing blocks file %s...\n", path.string());
- LoadExternalBlockFile(file);
+ LoadExternalBlockFile(chainparams, file);
} else {
LogPrintf("Warning: Could not open blocks file %s\n", path.string());
}
}
- if (GetBoolArg("-stopafterblockimport", false)) {
+ if (GetBoolArg("-stopafterblockimport", DEFAULT_STOPAFTERBLOCKIMPORT)) {
LogPrintf("Stopping after block import\n");
StartShutdown();
}
@@ -646,8 +649,7 @@ void ThreadImport(std::vector<boost::filesystem::path> vImportFiles)
bool InitSanityCheck(void)
{
if(!ECC_InitSanityCheck()) {
- InitError("OpenSSL appears to lack support for elliptic curve cryptography. For more "
- "information, visit https://en.bitcoin.it/wiki/OpenSSL_and_EC_Libraries");
+ InitError("Elliptic curve cryptography sanity check failure. Aborting.");
return false;
}
if (!glibc_sanity_test() || !glibcxx_sanity_test())
@@ -666,13 +668,98 @@ bool AppInitServers(boost::thread_group& threadGroup)
return false;
if (!StartHTTPRPC())
return false;
- if (GetBoolArg("-rest", false) && !StartREST())
+ if (GetBoolArg("-rest", DEFAULT_REST_ENABLE) && !StartREST())
return false;
- if (!StartHTTPServer(threadGroup))
+ if (!StartHTTPServer())
return false;
return true;
}
+// Parameter interaction based on rules
+void InitParameterInteraction()
+{
+ // when specifying an explicit binding address, you want to listen on it
+ // even when -connect or -proxy is specified
+ if (mapArgs.count("-bind")) {
+ if (SoftSetBoolArg("-listen", true))
+ LogPrintf("%s: parameter interaction: -bind set -> setting -listen=1\n", __func__);
+ }
+ if (mapArgs.count("-whitebind")) {
+ if (SoftSetBoolArg("-listen", true))
+ LogPrintf("%s: parameter interaction: -whitebind set -> setting -listen=1\n", __func__);
+ }
+
+ if (mapArgs.count("-connect") && mapMultiArgs["-connect"].size() > 0) {
+ // when only connecting to trusted nodes, do not seed via DNS, or listen by default
+ if (SoftSetBoolArg("-dnsseed", false))
+ LogPrintf("%s: parameter interaction: -connect set -> setting -dnsseed=0\n", __func__);
+ if (SoftSetBoolArg("-listen", false))
+ LogPrintf("%s: parameter interaction: -connect set -> setting -listen=0\n", __func__);
+ }
+
+ if (mapArgs.count("-proxy")) {
+ // to protect privacy, do not listen by default if a default proxy server is specified
+ if (SoftSetBoolArg("-listen", false))
+ LogPrintf("%s: parameter interaction: -proxy set -> setting -listen=0\n", __func__);
+ // to protect privacy, do not use UPNP when a proxy is set. The user may still specify -listen=1
+ // to listen locally, so don't rely on this happening through -listen below.
+ if (SoftSetBoolArg("-upnp", false))
+ LogPrintf("%s: parameter interaction: -proxy set -> setting -upnp=0\n", __func__);
+ // to protect privacy, do not discover addresses by default
+ if (SoftSetBoolArg("-discover", false))
+ LogPrintf("%s: parameter interaction: -proxy set -> setting -discover=0\n", __func__);
+ }
+
+ if (!GetBoolArg("-listen", DEFAULT_LISTEN)) {
+ // do not map ports or try to retrieve public IP when not listening (pointless)
+ if (SoftSetBoolArg("-upnp", false))
+ LogPrintf("%s: parameter interaction: -listen=0 -> setting -upnp=0\n", __func__);
+ if (SoftSetBoolArg("-discover", false))
+ LogPrintf("%s: parameter interaction: -listen=0 -> setting -discover=0\n", __func__);
+ if (SoftSetBoolArg("-listenonion", false))
+ LogPrintf("%s: parameter interaction: -listen=0 -> setting -listenonion=0\n", __func__);
+ }
+
+ if (mapArgs.count("-externalip")) {
+ // if an explicit public IP is specified, do not try to find others
+ if (SoftSetBoolArg("-discover", false))
+ LogPrintf("%s: parameter interaction: -externalip set -> setting -discover=0\n", __func__);
+ }
+
+ if (GetBoolArg("-salvagewallet", false)) {
+ // Rewrite just private keys: rescan to find transactions
+ if (SoftSetBoolArg("-rescan", true))
+ LogPrintf("%s: parameter interaction: -salvagewallet=1 -> setting -rescan=1\n", __func__);
+ }
+
+ // -zapwallettx implies a rescan
+ if (GetBoolArg("-zapwallettxes", false)) {
+ if (SoftSetBoolArg("-rescan", true))
+ LogPrintf("%s: parameter interaction: -zapwallettxes=<mode> -> setting -rescan=1\n", __func__);
+ }
+
+ // disable walletbroadcast and whitelistalwaysrelay in blocksonly mode
+ if (GetBoolArg("-blocksonly", DEFAULT_BLOCKSONLY)) {
+ if (SoftSetBoolArg("-whitelistalwaysrelay", false))
+ LogPrintf("%s: parameter interaction: -blocksonly=1 -> setting -whitelistalwaysrelay=0\n", __func__);
+#ifdef ENABLE_WALLET
+ if (SoftSetBoolArg("-walletbroadcast", false))
+ LogPrintf("%s: parameter interaction: -blocksonly=1 -> setting -walletbroadcast=0\n", __func__);
+#endif
+ }
+}
+
+void InitLogging()
+{
+ fPrintToConsole = GetBoolArg("-printtoconsole", false);
+ fLogTimestamps = GetBoolArg("-logtimestamps", DEFAULT_LOGTIMESTAMPS);
+ fLogTimeMicros = GetBoolArg("-logtimemicros", DEFAULT_LOGTIMEMICROS);
+ fLogIPs = GetBoolArg("-logips", DEFAULT_LOGIPS);
+
+ LogPrintf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
+ LogPrintf("Bitcoin version %s (%s)\n", FormatFullVersion(), CLIENT_DATE);
+}
+
/** Initialize bitcoin.
* @pre Parameters should be parsed and config file should be read.
*/
@@ -737,78 +824,11 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
// ********************************************************* Step 2: parameter interactions
const CChainParams& chainparams = Params();
- // Set this early so that parameter interactions go to console
- fPrintToConsole = GetBoolArg("-printtoconsole", false);
- fLogTimestamps = GetBoolArg("-logtimestamps", true);
- fLogTimeMicros = GetBoolArg("-logtimemicros", DEFAULT_LOGTIMEMICROS);
- fLogIPs = GetBoolArg("-logips", false);
-
- LogPrintf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
- LogPrintf("Bitcoin version %s (%s)\n", FormatFullVersion(), CLIENT_DATE);
-
- // when specifying an explicit binding address, you want to listen on it
- // even when -connect or -proxy is specified
- if (mapArgs.count("-bind")) {
- if (SoftSetBoolArg("-listen", true))
- LogPrintf("%s: parameter interaction: -bind set -> setting -listen=1\n", __func__);
- }
- if (mapArgs.count("-whitebind")) {
- if (SoftSetBoolArg("-listen", true))
- LogPrintf("%s: parameter interaction: -whitebind set -> setting -listen=1\n", __func__);
- }
-
- if (mapArgs.count("-connect") && mapMultiArgs["-connect"].size() > 0) {
- // when only connecting to trusted nodes, do not seed via DNS, or listen by default
- if (SoftSetBoolArg("-dnsseed", false))
- LogPrintf("%s: parameter interaction: -connect set -> setting -dnsseed=0\n", __func__);
- if (SoftSetBoolArg("-listen", false))
- LogPrintf("%s: parameter interaction: -connect set -> setting -listen=0\n", __func__);
- }
-
- if (mapArgs.count("-proxy")) {
- // to protect privacy, do not listen by default if a default proxy server is specified
- if (SoftSetBoolArg("-listen", false))
- LogPrintf("%s: parameter interaction: -proxy set -> setting -listen=0\n", __func__);
- // to protect privacy, do not use UPNP when a proxy is set. The user may still specify -listen=1
- // to listen locally, so don't rely on this happening through -listen below.
- if (SoftSetBoolArg("-upnp", false))
- LogPrintf("%s: parameter interaction: -proxy set -> setting -upnp=0\n", __func__);
- // to protect privacy, do not discover addresses by default
- if (SoftSetBoolArg("-discover", false))
- LogPrintf("%s: parameter interaction: -proxy set -> setting -discover=0\n", __func__);
- }
-
- if (!GetBoolArg("-listen", DEFAULT_LISTEN)) {
- // do not map ports or try to retrieve public IP when not listening (pointless)
- if (SoftSetBoolArg("-upnp", false))
- LogPrintf("%s: parameter interaction: -listen=0 -> setting -upnp=0\n", __func__);
- if (SoftSetBoolArg("-discover", false))
- LogPrintf("%s: parameter interaction: -listen=0 -> setting -discover=0\n", __func__);
- if (SoftSetBoolArg("-listenonion", false))
- LogPrintf("%s: parameter interaction: -listen=0 -> setting -listenonion=0\n", __func__);
- }
-
- if (mapArgs.count("-externalip")) {
- // if an explicit public IP is specified, do not try to find others
- if (SoftSetBoolArg("-discover", false))
- LogPrintf("%s: parameter interaction: -externalip set -> setting -discover=0\n", __func__);
- }
-
- if (GetBoolArg("-salvagewallet", false)) {
- // Rewrite just private keys: rescan to find transactions
- if (SoftSetBoolArg("-rescan", true))
- LogPrintf("%s: parameter interaction: -salvagewallet=1 -> setting -rescan=1\n", __func__);
- }
-
- // -zapwallettx implies a rescan
- if (GetBoolArg("-zapwallettxes", false)) {
- if (SoftSetBoolArg("-rescan", true))
- LogPrintf("%s: parameter interaction: -zapwallettxes=<mode> -> setting -rescan=1\n", __func__);
- }
+ // also see: InitParameterInteraction()
// if using block pruning, then disable txindex
if (GetArg("-prune", 0)) {
- if (GetBoolArg("-txindex", false))
+ if (GetBoolArg("-txindex", DEFAULT_TXINDEX))
return InitError(_("Prune mode is incompatible with -txindex."));
#ifdef ENABLE_WALLET
if (GetBoolArg("-rescan", false)) {
@@ -816,7 +836,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
}
#endif
}
-
+
// Make sure enough file descriptors are available
int nBind = std::max((int)mapArgs.count("-bind") + (int)mapArgs.count("-whitebind"), 1);
int nUserMaxConnections = GetArg("-maxconnections", DEFAULT_MAX_PEER_CONNECTIONS);
@@ -859,13 +879,13 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
mempool.setSanityCheck(1.0 / ratio);
}
fCheckBlockIndex = GetBoolArg("-checkblockindex", chainparams.DefaultConsistencyChecks());
- fCheckpointsEnabled = GetBoolArg("-checkpoints", true);
+ fCheckpointsEnabled = GetBoolArg("-checkpoints", DEFAULT_CHECKPOINTS_ENABLED);
- // -mempoollimit limits
- int64_t nMempoolSizeLimit = GetArg("-maxmempool", DEFAULT_MAX_MEMPOOL_SIZE) * 1000000;
- int64_t nMempoolDescendantSizeLimit = GetArg("-limitdescendantsize", DEFAULT_DESCENDANT_SIZE_LIMIT) * 1000;
- if (nMempoolSizeLimit < 0 || nMempoolSizeLimit < nMempoolDescendantSizeLimit * 40)
- return InitError(strprintf(_("-maxmempool must be at least %d MB"), GetArg("-limitdescendantsize", DEFAULT_DESCENDANT_SIZE_LIMIT) / 25));
+ // mempool limits
+ int64_t nMempoolSizeMax = GetArg("-maxmempool", DEFAULT_MAX_MEMPOOL_SIZE) * 1000000;
+ int64_t nMempoolSizeMin = GetArg("-limitdescendantsize", DEFAULT_DESCENDANT_SIZE_LIMIT) * 1000 * 40;
+ if (nMempoolSizeMax < 0 || nMempoolSizeMax < nMempoolSizeMin)
+ return InitError(strprintf(_("-maxmempool must be at least %d MB"), std::ceil(nMempoolSizeMin / 1000000.0)));
// -par=0 means autodetect, but nScriptCheckThreads==0 means no concurrency
nScriptCheckThreads = GetArg("-par", DEFAULT_SCRIPTCHECK_THREADS);
@@ -957,13 +977,14 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
}
}
nTxConfirmTarget = GetArg("-txconfirmtarget", DEFAULT_TX_CONFIRM_TARGET);
- bSpendZeroConfChange = GetBoolArg("-spendzeroconfchange", true);
- fSendFreeTransactions = GetBoolArg("-sendfreetransactions", false);
+ bSpendZeroConfChange = GetBoolArg("-spendzeroconfchange", DEFAULT_SPEND_ZEROCONF_CHANGE);
+ fSendFreeTransactions = GetBoolArg("-sendfreetransactions", DEFAULT_SEND_FREE_TRANSACTIONS);
std::string strWalletFile = GetArg("-wallet", "wallet.dat");
#endif // ENABLE_WALLET
- fIsBareMultisigStd = GetBoolArg("-permitbaremultisig", true);
+ fIsBareMultisigStd = GetBoolArg("-permitbaremultisig", DEFAULT_PERMIT_BAREMULTISIG);
+ fAcceptDatacarrier = GetBoolArg("-datacarrier", DEFAULT_ACCEPT_DATACARRIER);
nMaxDatacarrierBytes = GetArg("-datacarriersize", nMaxDatacarrierBytes);
fAlerts = GetBoolArg("-alerts", DEFAULT_ALERTS);
@@ -978,6 +999,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
// Initialize elliptic curve code
ECC_Start();
+ globalVerifyHandle.reset(new ECCVerifyHandle());
// Sanity check
if (!InitSanityCheck())
@@ -1011,7 +1033,12 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
if (fPrintToDebugLog)
OpenDebugLog();
+#if (OPENSSL_VERSION_NUMBER < 0x10100000L)
LogPrintf("Using OpenSSL version %s\n", SSLeay_version(SSLEAY_VERSION));
+#else
+ LogPrintf("Using OpenSSL version %s\n", OpenSSL_version(OPENSSL_VERSION));
+#endif
+
#ifdef ENABLE_WALLET
LogPrintf("Using BerkeleyDB version %s\n", DbEnv::version(0, 0, 0));
#endif
@@ -1108,7 +1135,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
}
}
- bool proxyRandomize = GetBoolArg("-proxyrandomize", true);
+ bool proxyRandomize = GetBoolArg("-proxyrandomize", DEFAULT_PROXYRANDOMIZE);
// -proxy sets a proxy for all outgoing network traffic
// -noproxy (or -proxy=0) as well as the empty string can be used to not set a proxy, this is the default
std::string proxyArg = GetArg("-proxy", "");
@@ -1143,7 +1170,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
// see Step 2: parameter interactions for more information about these
fListen = GetBoolArg("-listen", DEFAULT_LISTEN);
fDiscover = GetBoolArg("-discover", true);
- fNameLookup = GetBoolArg("-dns", true);
+ fNameLookup = GetBoolArg("-dns", DEFAULT_NAME_LOOKUP);
bool fBound = false;
if (fListen) {
@@ -1232,7 +1259,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
nTotalCache = std::max(nTotalCache, nMinDbCache << 20); // total cache cannot be less than nMinDbCache
nTotalCache = std::min(nTotalCache, nMaxDbCache << 20); // total cache cannot be greated than nMaxDbcache
int64_t nBlockTreeDBCache = nTotalCache / 8;
- if (nBlockTreeDBCache > (1 << 21) && !GetBoolArg("-txindex", false))
+ if (nBlockTreeDBCache > (1 << 21) && !GetBoolArg("-txindex", DEFAULT_TXINDEX))
nBlockTreeDBCache = (1 << 21); // block tree db cache shouldn't be larger than 2 MiB
nTotalCache -= nBlockTreeDBCache;
int64_t nCoinDBCache = std::min(nTotalCache / 2, (nTotalCache / 4) + (1 << 23)); // use 25%-50% of the remainder for disk cache
@@ -1282,13 +1309,13 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
return InitError(_("Incorrect or no genesis block found. Wrong datadir for network?"));
// Initialize the block index (no-op if non-empty database was already loaded)
- if (!InitBlockIndex()) {
+ if (!InitBlockIndex(chainparams)) {
strLoadError = _("Error initializing block database");
break;
}
// Check for changed -txindex state
- if (fTxIndex != GetBoolArg("-txindex", false)) {
+ if (fTxIndex != GetBoolArg("-txindex", DEFAULT_TXINDEX)) {
strLoadError = _("You need to rebuild the database using -reindex to change -txindex");
break;
}
@@ -1317,7 +1344,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
}
}
- if (!CVerifyDB().VerifyDB(pcoinsdbview, GetArg("-checklevel", DEFAULT_CHECKLEVEL),
+ if (!CVerifyDB().VerifyDB(chainparams, pcoinsdbview, GetArg("-checklevel", DEFAULT_CHECKLEVEL),
GetArg("-checkblocks", DEFAULT_CHECKBLOCKS))) {
strLoadError = _("Corrupted block database detected");
break;
@@ -1514,7 +1541,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
}
}
}
- pwalletMain->SetBroadcastTransactions(GetBoolArg("-walletbroadcast", true));
+ pwalletMain->SetBroadcastTransactions(GetBoolArg("-walletbroadcast", DEFAULT_WALLETBROADCAST));
} // (!fDisableWallet)
#else // ENABLE_WALLET
LogPrintf("No wallet support compiled in!\n");
@@ -1541,7 +1568,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
uiInterface.InitMessage(_("Activating best chain..."));
// scan for better chains in the block chain database, that are not yet connected in the active best chain
CValidationState state;
- if (!ActivateBestChain(state))
+ if (!ActivateBestChain(state, chainparams))
strErrors << "Failed to connect best block";
std::vector<boost::filesystem::path> vImportFiles;
@@ -1588,7 +1615,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
scheduler.scheduleEvery(f, nPowTargetSpacing);
// Generate coins in the background
- GenerateBitcoins(GetBoolArg("-gen", false), GetArg("-genproclimit", DEFAULT_GENERATE_THREADS), Params());
+ GenerateBitcoins(GetBoolArg("-gen", DEFAULT_GENERATE), GetArg("-genproclimit", DEFAULT_GENERATE_THREADS), chainparams);
// ********************************************************* Step 12: finished
diff --git a/src/init.h b/src/init.h
index 8cd51b0286..d4872e7794 100644
--- a/src/init.h
+++ b/src/init.h
@@ -23,6 +23,10 @@ bool ShutdownRequested();
/** Interrupt threads */
void Interrupt(boost::thread_group& threadGroup);
void Shutdown();
+//!Initialize the logging infrastructure
+void InitLogging();
+//!Parameter interaction: change current parameters depending on various rules
+void InitParameterInteraction();
bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler);
/** The help message mode determines what help message to show */
diff --git a/src/main.cpp b/src/main.cpp
index 5208fbb031..eea53a58de 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -12,6 +12,7 @@
#include "checkpoints.h"
#include "checkqueue.h"
#include "consensus/consensus.h"
+#include "consensus/merkle.h"
#include "consensus/validation.h"
#include "hash.h"
#include "init.h"
@@ -66,10 +67,10 @@ bool fReindex = false;
bool fTxIndex = false;
bool fHavePruned = false;
bool fPruneMode = false;
-bool fIsBareMultisigStd = true;
+bool fIsBareMultisigStd = DEFAULT_PERMIT_BAREMULTISIG;
bool fRequireStandard = true;
bool fCheckBlockIndex = false;
-bool fCheckpointsEnabled = true;
+bool fCheckpointsEnabled = DEFAULT_CHECKPOINTS_ENABLED;
size_t nCoinCacheUsage = 5000 * 300;
uint64_t nPruneTarget = 0;
bool fAlerts = DEFAULT_ALERTS;
@@ -246,6 +247,8 @@ struct CNodeState {
uint256 hashLastUnknownBlock;
//! The last full block we both have.
CBlockIndex *pindexLastCommonBlock;
+ //! The best header we have sent our peer.
+ CBlockIndex *pindexBestHeaderSent;
//! Whether we've started headers synchronization with this peer.
bool fSyncStarted;
//! Since when we're stalling block download progress (in microseconds), or 0.
@@ -255,6 +258,8 @@ struct CNodeState {
int nBlocksInFlightValidHeaders;
//! Whether we consider this a preferred download peer.
bool fPreferredDownload;
+ //! Whether this peer wants invs or headers (when possible) for block announcements.
+ bool fPreferHeaders;
CNodeState() {
fCurrentlyConnected = false;
@@ -263,11 +268,13 @@ struct CNodeState {
pindexBestKnownBlock = NULL;
hashLastUnknownBlock.SetNull();
pindexLastCommonBlock = NULL;
+ pindexBestHeaderSent = NULL;
fSyncStarted = false;
nStallingSince = 0;
nBlocksInFlight = 0;
nBlocksInFlightValidHeaders = 0;
fPreferredDownload = false;
+ fPreferHeaders = false;
}
};
@@ -397,6 +404,22 @@ void UpdateBlockAvailability(NodeId nodeid, const uint256 &hash) {
}
}
+// Requires cs_main
+bool CanDirectFetch(const Consensus::Params &consensusParams)
+{
+ return chainActive.Tip()->GetBlockTime() > GetAdjustedTime() - consensusParams.nPowTargetSpacing * 20;
+}
+
+// Requires cs_main
+bool PeerHasHeader(CNodeState *state, CBlockIndex *pindex)
+{
+ if (state->pindexBestKnownBlock && pindex == state->pindexBestKnownBlock->GetAncestor(pindex->nHeight))
+ return true;
+ if (state->pindexBestHeaderSent && pindex == state->pindexBestHeaderSent->GetAncestor(pindex->nHeight))
+ return true;
+ return false;
+}
+
/** Find the last common ancestor two blocks have.
* Both pa and pb must be non-NULL. */
CBlockIndex* LastCommonAncestor(CBlockIndex* pa, CBlockIndex* pb) {
@@ -670,10 +693,11 @@ bool CheckFinalTx(const CTransaction &tx, int flags)
// IsFinalTx() with one more than chainActive.Height().
const int nBlockHeight = chainActive.Height() + 1;
- // Timestamps on the other hand don't get any special treatment,
- // because we can't know what timestamp the next block will have,
- // and there aren't timestamp applications where it matters.
- // However this changes once median past time-locks are enforced:
+ // BIP113 will require that time-locked transactions have nLockTime set to
+ // less than the median time of the previous block they're contained in.
+ // When the next block is created its previous block will be the current
+ // chain tip, so we use that to calculate the median time passed to
+ // IsFinalTx() if LOCKTIME_MEDIAN_TIME_PAST is set.
const int64_t nBlockTime = (flags & LOCKTIME_MEDIAN_TIME_PAST)
? chainActive.Tip()->GetMedianTimePast()
: GetAdjustedTime();
@@ -831,15 +855,42 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
return state.Invalid(false, REJECT_ALREADY_KNOWN, "txn-already-in-mempool");
// Check for conflicts with in-memory transactions
+ set<uint256> setConflicts;
{
LOCK(pool.cs); // protect pool.mapNextTx
- for (unsigned int i = 0; i < tx.vin.size(); i++)
+ BOOST_FOREACH(const CTxIn &txin, tx.vin)
{
- COutPoint outpoint = tx.vin[i].prevout;
- if (pool.mapNextTx.count(outpoint))
+ if (pool.mapNextTx.count(txin.prevout))
{
- // Disable replacement feature for now
- return state.Invalid(false, REJECT_CONFLICT, "txn-mempool-conflict");
+ const CTransaction *ptxConflicting = pool.mapNextTx[txin.prevout].ptx;
+ if (!setConflicts.count(ptxConflicting->GetHash()))
+ {
+ // Allow opt-out of transaction replacement by setting
+ // nSequence >= maxint-1 on all inputs.
+ //
+ // maxint-1 is picked to still allow use of nLockTime by
+ // non-replacable transactions. All inputs rather than just one
+ // is for the sake of multi-party protocols, where we don't
+ // want a single party to be able to disable replacement.
+ //
+ // The opt-out ignores descendants as anyone relying on
+ // first-seen mempool behavior should be checking all
+ // unconfirmed ancestors anyway; doing otherwise is hopelessly
+ // insecure.
+ bool fReplacementOptOut = true;
+ BOOST_FOREACH(const CTxIn &txin, ptxConflicting->vin)
+ {
+ if (txin.nSequence < std::numeric_limits<unsigned int>::max()-1)
+ {
+ fReplacementOptOut = false;
+ break;
+ }
+ }
+ if (fReplacementOptOut)
+ return state.Invalid(false, REJECT_CONFLICT, "txn-mempool-conflict");
+
+ setConflicts.insert(ptxConflicting->GetHash());
+ }
}
}
}
@@ -899,9 +950,10 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
CAmount nValueOut = tx.GetValueOut();
CAmount nFees = nValueIn-nValueOut;
- double dPriority = view.GetPriority(tx, chainActive.Height());
+ CAmount inChainInputValue;
+ double dPriority = view.GetPriority(tx, chainActive.Height(), inChainInputValue);
- CTxMemPoolEntry entry(tx, nFees, GetTime(), dPriority, chainActive.Height(), pool.HasNoInputsOf(tx));
+ CTxMemPoolEntry entry(tx, nFees, GetTime(), dPriority, chainActive.Height(), pool.HasNoInputsOf(tx), inChainInputValue);
unsigned int nSize = entry.GetTxSize();
// Don't accept it if it can't get into a block
@@ -913,7 +965,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
CAmount mempoolRejectFee = pool.GetMinFee(GetArg("-maxmempool", DEFAULT_MAX_MEMPOOL_SIZE) * 1000000).GetFee(nSize);
if (mempoolRejectFee > 0 && nFees < mempoolRejectFee) {
return state.DoS(0, false, REJECT_INSUFFICIENTFEE, "mempool min fee not met", false, strprintf("%d < %d", nFees, mempoolRejectFee));
- } else if (GetBoolArg("-relaypriority", true) && nFees < ::minRelayTxFee.GetFee(nSize) && !AllowFree(view.GetPriority(tx, chainActive.Height() + 1))) {
+ } else if (GetBoolArg("-relaypriority", DEFAULT_RELAYPRIORITY) && nFees < ::minRelayTxFee.GetFee(nSize) && !AllowFree(entry.GetPriority(chainActive.Height() + 1))) {
// Require that free transactions have sufficient priority to be mined in the next block.
return state.DoS(0, false, REJECT_INSUFFICIENTFEE, "insufficient priority");
}
@@ -935,7 +987,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
nLastTime = nNow;
// -limitfreerelay unit is thousand-bytes-per-minute
// At default rate it would take over a month to fill 1GB
- if (dFreeCount >= GetArg("-limitfreerelay", 15)*10*1000)
+ if (dFreeCount >= GetArg("-limitfreerelay", DEFAULT_LIMITFREERELAY) * 10 * 1000)
return state.DoS(0, false, REJECT_INSUFFICIENTFEE, "rate limited free transaction");
LogPrint("mempool", "Rate limit dFreeCount: %g => %g\n", dFreeCount, dFreeCount+nSize);
dFreeCount += nSize;
@@ -957,6 +1009,160 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
return state.DoS(0, false, REJECT_NONSTANDARD, "too-long-mempool-chain", false, errString);
}
+ // A transaction that spends outputs that would be replaced by it is invalid. Now
+ // that we have the set of all ancestors we can detect this
+ // pathological case by making sure setConflicts and setAncestors don't
+ // intersect.
+ BOOST_FOREACH(CTxMemPool::txiter ancestorIt, setAncestors)
+ {
+ const uint256 &hashAncestor = ancestorIt->GetTx().GetHash();
+ if (setConflicts.count(hashAncestor))
+ {
+ return state.DoS(10, error("AcceptToMemoryPool: %s spends conflicting transaction %s",
+ hash.ToString(),
+ hashAncestor.ToString()),
+ REJECT_INVALID, "bad-txns-spends-conflicting-tx");
+ }
+ }
+
+ // Check if it's economically rational to mine this transaction rather
+ // than the ones it replaces.
+ CAmount nConflictingFees = 0;
+ size_t nConflictingSize = 0;
+ uint64_t nConflictingCount = 0;
+ CTxMemPool::setEntries allConflicting;
+
+ // If we don't hold the lock allConflicting might be incomplete; the
+ // subsequent RemoveStaged() and addUnchecked() calls don't guarantee
+ // mempool consistency for us.
+ LOCK(pool.cs);
+ if (setConflicts.size())
+ {
+ CFeeRate newFeeRate(nFees, nSize);
+ set<uint256> setConflictsParents;
+ const int maxDescendantsToVisit = 100;
+ CTxMemPool::setEntries setIterConflicting;
+ BOOST_FOREACH(const uint256 &hashConflicting, setConflicts)
+ {
+ CTxMemPool::txiter mi = pool.mapTx.find(hashConflicting);
+ if (mi == pool.mapTx.end())
+ continue;
+
+ // Save these to avoid repeated lookups
+ setIterConflicting.insert(mi);
+
+ // If this entry is "dirty", then we don't have descendant
+ // state for this transaction, which means we probably have
+ // lots of in-mempool descendants.
+ // Don't allow replacements of dirty transactions, to ensure
+ // that we don't spend too much time walking descendants.
+ // This should be rare.
+ if (mi->IsDirty()) {
+ return state.DoS(0,
+ error("AcceptToMemoryPool: rejecting replacement %s; cannot replace tx %s with untracked descendants",
+ hash.ToString(),
+ mi->GetTx().GetHash().ToString()),
+ REJECT_NONSTANDARD, "too many potential replacements");
+ }
+
+ // Don't allow the replacement to reduce the feerate of the
+ // mempool.
+ //
+ // We usually don't want to accept replacements with lower
+ // feerates than what they replaced as that would lower the
+ // feerate of the next block. Requiring that the feerate always
+ // be increased is also an easy-to-reason about way to prevent
+ // DoS attacks via replacements.
+ //
+ // The mining code doesn't (currently) take children into
+ // account (CPFP) so we only consider the feerates of
+ // transactions being directly replaced, not their indirect
+ // descendants. While that does mean high feerate children are
+ // ignored when deciding whether or not to replace, we do
+ // require the replacement to pay more overall fees too,
+ // mitigating most cases.
+ CFeeRate oldFeeRate(mi->GetFee(), mi->GetTxSize());
+ if (newFeeRate <= oldFeeRate)
+ {
+ return state.DoS(0,
+ error("AcceptToMemoryPool: rejecting replacement %s; new feerate %s <= old feerate %s",
+ hash.ToString(),
+ newFeeRate.ToString(),
+ oldFeeRate.ToString()),
+ REJECT_INSUFFICIENTFEE, "insufficient fee");
+ }
+
+ BOOST_FOREACH(const CTxIn &txin, mi->GetTx().vin)
+ {
+ setConflictsParents.insert(txin.prevout.hash);
+ }
+
+ nConflictingCount += mi->GetCountWithDescendants();
+ }
+ // This potentially overestimates the number of actual descendants
+ // but we just want to be conservative to avoid doing too much
+ // work.
+ if (nConflictingCount <= maxDescendantsToVisit) {
+ // If not too many to replace, then calculate the set of
+ // transactions that would have to be evicted
+ BOOST_FOREACH(CTxMemPool::txiter it, setIterConflicting) {
+ pool.CalculateDescendants(it, allConflicting);
+ }
+ BOOST_FOREACH(CTxMemPool::txiter it, allConflicting) {
+ nConflictingFees += it->GetFee();
+ nConflictingSize += it->GetTxSize();
+ }
+ } else {
+ return state.DoS(0,
+ error("AcceptToMemoryPool: rejecting replacement %s; too many potential replacements (%d > %d)\n",
+ hash.ToString(),
+ nConflictingCount,
+ maxDescendantsToVisit),
+ REJECT_NONSTANDARD, "too many potential replacements");
+ }
+
+ for (unsigned int j = 0; j < tx.vin.size(); j++)
+ {
+ // We don't want to accept replacements that require low
+ // feerate junk to be mined first. Ideally we'd keep track of
+ // the ancestor feerates and make the decision based on that,
+ // but for now requiring all new inputs to be confirmed works.
+ if (!setConflictsParents.count(tx.vin[j].prevout.hash))
+ {
+ // Rather than check the UTXO set - potentially expensive -
+ // it's cheaper to just check if the new input refers to a
+ // tx that's in the mempool.
+ if (pool.mapTx.find(tx.vin[j].prevout.hash) != pool.mapTx.end())
+ return state.DoS(0, error("AcceptToMemoryPool: replacement %s adds unconfirmed input, idx %d",
+ hash.ToString(), j),
+ REJECT_NONSTANDARD, "replacement-adds-unconfirmed");
+ }
+ }
+
+ // The replacement must pay greater fees than the transactions it
+ // replaces - if we did the bandwidth used by those conflicting
+ // transactions would not be paid for.
+ if (nFees < nConflictingFees)
+ {
+ return state.DoS(0, error("AcceptToMemoryPool: rejecting replacement %s, less fees than conflicting txs; %s < %s",
+ hash.ToString(), FormatMoney(nFees), FormatMoney(nConflictingFees)),
+ REJECT_INSUFFICIENTFEE, "insufficient fee");
+ }
+
+ // Finally in addition to paying more fees than the conflicts the
+ // new transaction must pay for its own bandwidth.
+ CAmount nDeltaFees = nFees - nConflictingFees;
+ if (nDeltaFees < ::minRelayTxFee.GetFee(nSize))
+ {
+ return state.DoS(0,
+ error("AcceptToMemoryPool: rejecting replacement %s, not enough additional fees to relay; %s < %s",
+ hash.ToString(),
+ FormatMoney(nDeltaFees),
+ FormatMoney(::minRelayTxFee.GetFee(nSize))),
+ REJECT_INSUFFICIENTFEE, "insufficient fee");
+ }
+ }
+
// Check against previous transactions
// This is done last to help prevent CPU exhaustion denial-of-service attacks.
if (!CheckInputs(tx, state, view, true, STANDARD_SCRIPT_VERIFY_FLAGS, true))
@@ -977,6 +1183,17 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
__func__, hash.ToString(), FormatStateMessage(state));
}
+ // Remove conflicting transactions from the mempool
+ BOOST_FOREACH(const CTxMemPool::txiter it, allConflicting)
+ {
+ LogPrint("mempool", "replacing tx %s with %s for %s BTC additional fees, %d delta bytes\n",
+ it->GetTx().GetHash().ToString(),
+ hash.ToString(),
+ FormatMoney(nFees - nConflictingFees),
+ (int)nSize - (int)nConflictingSize);
+ }
+ pool.RemoveStaged(allConflicting);
+
// Store transaction in memory
pool.addUnchecked(hash, entry, setAncestors, !IsInitialBlockDownload());
@@ -1243,7 +1460,7 @@ void Misbehaving(NodeId pnode, int howmuch)
return;
state->nMisbehavior += howmuch;
- int banscore = GetArg("-banscore", 100);
+ int banscore = GetArg("-banscore", DEFAULT_BANSCORE_THRESHOLD);
if (state->nMisbehavior >= banscore && state->nMisbehavior - howmuch < banscore)
{
LogPrintf("%s: %s (%d -> %d) BAN THRESHOLD EXCEEDED\n", __func__, state->name, state->nMisbehavior-howmuch, state->nMisbehavior);
@@ -1310,10 +1527,17 @@ void UpdateCoins(const CTransaction& tx, CValidationState &state, CCoinsViewCach
undo.nVersion = coins->nVersion;
}
}
+ // add outputs
+ inputs.ModifyNewCoins(tx.GetHash())->FromTx(tx, nHeight);
+ }
+ else {
+ // add outputs for coinbase tx
+ // In this case call the full ModifyCoins which will do a database
+ // lookup to be sure the coins do not already exist otherwise we do not
+ // know whether to mark them fresh or not. We want the duplicate coinbases
+ // before BIP30 to still be properly overwritten.
+ inputs.ModifyCoins(tx.GetHash())->FromTx(tx, nHeight);
}
-
- // add outputs
- inputs.ModifyCoins(tx.GetHash())->FromTx(tx, nHeight);
}
void UpdateCoins(const CTransaction& tx, CValidationState &state, CCoinsViewCache &inputs, int nHeight)
@@ -1939,6 +2163,7 @@ enum FlushStateMode {
* or always and in all cases if we're in prune mode and are deleting files.
*/
bool static FlushStateToDisk(CValidationState &state, FlushStateMode mode) {
+ const CChainParams& chainparams = Params();
LOCK2(cs_main, cs_LastBlockFile);
static int64_t nLastWrite = 0;
static int64_t nLastFlush = 0;
@@ -1947,7 +2172,7 @@ bool static FlushStateToDisk(CValidationState &state, FlushStateMode mode) {
bool fFlushForPrune = false;
try {
if (fPruneMode && fCheckForPruning && !fReindex) {
- FindFilesToPrune(setFilesToPrune);
+ FindFilesToPrune(setFilesToPrune, chainparams.PruneAfterHeight());
fCheckForPruning = false;
if (!setFilesToPrune.empty()) {
fFlushForPrune = true;
@@ -2147,8 +2372,8 @@ static int64_t nTimePostConnect = 0;
* Connect a new block to chainActive. pblock is either NULL or a pointer to a CBlock
* corresponding to pindexNew, to bypass loading it again from disk.
*/
-bool static ConnectTip(CValidationState &state, CBlockIndex *pindexNew, const CBlock *pblock) {
- const CChainParams& chainparams = Params();
+bool static ConnectTip(CValidationState& state, const CChainParams& chainparams, CBlockIndex* pindexNew, const CBlock* pblock)
+{
assert(pindexNew->pprev == chainActive.Tip());
mempool.check(pcoinsTip);
// Read block from disk.
@@ -2280,8 +2505,8 @@ static void PruneBlockIndexCandidates() {
* Try to make some progress towards making pindexMostWork the active block.
* pblock is either NULL or a pointer to a CBlock corresponding to pindexMostWork.
*/
-static bool ActivateBestChainStep(CValidationState &state, CBlockIndex *pindexMostWork, const CBlock *pblock) {
- const CChainParams& chainparams = Params();
+static bool ActivateBestChainStep(CValidationState& state, const CChainParams& chainparams, CBlockIndex* pindexMostWork, const CBlock* pblock)
+{
AssertLockHeld(cs_main);
bool fInvalidFound = false;
const CBlockIndex *pindexOldTip = chainActive.Tip();
@@ -2314,7 +2539,7 @@ static bool ActivateBestChainStep(CValidationState &state, CBlockIndex *pindexMo
// Connect new blocks.
BOOST_REVERSE_FOREACH(CBlockIndex *pindexConnect, vpindexToConnect) {
- if (!ConnectTip(state, pindexConnect, pindexConnect == pindexMostWork ? pblock : NULL)) {
+ if (!ConnectTip(state, chainparams, pindexConnect, pindexConnect == pindexMostWork ? pblock : NULL)) {
if (state.IsInvalid()) {
// The block violates a consensus rule.
if (!state.CorruptionPossible())
@@ -2355,46 +2580,69 @@ static bool ActivateBestChainStep(CValidationState &state, CBlockIndex *pindexMo
* or an activated best chain. pblock is either NULL or a pointer to a block
* that is already loaded (to avoid loading it again from disk).
*/
-bool ActivateBestChain(CValidationState &state, const CBlock *pblock) {
- CBlockIndex *pindexNewTip = NULL;
+bool ActivateBestChain(CValidationState &state, const CChainParams& chainparams, const CBlock *pblock) {
CBlockIndex *pindexMostWork = NULL;
- const CChainParams& chainparams = Params();
do {
boost::this_thread::interruption_point();
+ CBlockIndex *pindexNewTip = NULL;
+ const CBlockIndex *pindexFork;
bool fInitialDownload;
{
LOCK(cs_main);
+ CBlockIndex *pindexOldTip = chainActive.Tip();
pindexMostWork = FindMostWorkChain();
// Whether we have anything to do at all.
if (pindexMostWork == NULL || pindexMostWork == chainActive.Tip())
return true;
- if (!ActivateBestChainStep(state, pindexMostWork, pblock && pblock->GetHash() == pindexMostWork->GetBlockHash() ? pblock : NULL))
+ if (!ActivateBestChainStep(state, chainparams, pindexMostWork, pblock && pblock->GetHash() == pindexMostWork->GetBlockHash() ? pblock : NULL))
return false;
pindexNewTip = chainActive.Tip();
+ pindexFork = chainActive.FindFork(pindexOldTip);
fInitialDownload = IsInitialBlockDownload();
}
// When we reach this point, we switched to a new tip (stored in pindexNewTip).
// Notifications/callbacks that can run without cs_main
- if (!fInitialDownload) {
- uint256 hashNewTip = pindexNewTip->GetBlockHash();
- // Relay inventory, but don't relay old inventory during initial block download.
- int nBlockEstimate = 0;
- if (fCheckpointsEnabled)
- nBlockEstimate = Checkpoints::GetTotalBlocksEstimate(chainparams.Checkpoints());
- {
- LOCK(cs_vNodes);
- BOOST_FOREACH(CNode* pnode, vNodes)
- if (chainActive.Height() > (pnode->nStartingHeight != -1 ? pnode->nStartingHeight - 2000 : nBlockEstimate))
- pnode->PushInventory(CInv(MSG_BLOCK, hashNewTip));
+ // Always notify the UI if a new block tip was connected
+ if (pindexFork != pindexNewTip) {
+ uiInterface.NotifyBlockTip(fInitialDownload, pindexNewTip);
+
+ if (!fInitialDownload) {
+ // Find the hashes of all blocks that weren't previously in the best chain.
+ std::vector<uint256> vHashes;
+ CBlockIndex *pindexToAnnounce = pindexNewTip;
+ while (pindexToAnnounce != pindexFork) {
+ vHashes.push_back(pindexToAnnounce->GetBlockHash());
+ pindexToAnnounce = pindexToAnnounce->pprev;
+ if (vHashes.size() == MAX_BLOCKS_TO_ANNOUNCE) {
+ // Limit announcements in case of a huge reorganization.
+ // Rely on the peer's synchronization mechanism in that case.
+ break;
+ }
+ }
+ // Relay inventory, but don't relay old inventory during initial block download.
+ int nBlockEstimate = 0;
+ if (fCheckpointsEnabled)
+ nBlockEstimate = Checkpoints::GetTotalBlocksEstimate(chainparams.Checkpoints());
+ {
+ LOCK(cs_vNodes);
+ BOOST_FOREACH(CNode* pnode, vNodes) {
+ if (chainActive.Height() > (pnode->nStartingHeight != -1 ? pnode->nStartingHeight - 2000 : nBlockEstimate)) {
+ BOOST_REVERSE_FOREACH(const uint256& hash, vHashes) {
+ pnode->PushBlockHash(hash);
+ }
+ }
+ }
+ }
+ // Notify external listeners about the new tip.
+ if (!vHashes.empty()) {
+ GetMainSignals().UpdatedBlockTip(pindexNewTip);
+ }
}
- // Notify external listeners about the new tip.
- GetMainSignals().UpdatedBlockTip(pindexNewTip);
- uiInterface.NotifyBlockTip(hashNewTip);
}
} while(pindexMostWork != chainActive.Tip());
CheckBlockIndex(chainparams.GetConsensus());
@@ -2577,9 +2825,9 @@ bool FindBlockPos(CValidationState &state, CDiskBlockPos &pos, unsigned int nAdd
pos.nPos = vinfoBlockFile[nFile].nSize;
}
- if (nFile != nLastBlockFile) {
+ if ((int)nFile != nLastBlockFile) {
if (!fKnown) {
- LogPrintf("Leaving block file %i: %s\n", nFile, vinfoBlockFile[nFile].ToString());
+ LogPrintf("Leaving block file %i: %s\n", nLastBlockFile, vinfoBlockFile[nLastBlockFile].ToString());
}
FlushBlockFile(!fKnown);
nLastBlockFile = nFile;
@@ -2675,7 +2923,7 @@ bool CheckBlock(const CBlock& block, CValidationState& state, bool fCheckPOW, bo
// Check the merkle root.
if (fCheckMerkleRoot) {
bool mutated;
- uint256 hashMerkleRoot2 = block.ComputeMerkleRoot(&mutated);
+ uint256 hashMerkleRoot2 = BlockMerkleRoot(block, &mutated);
if (block.hashMerkleRoot != hashMerkleRoot2)
return state.DoS(100, error("CheckBlock(): hashMerkleRoot mismatch"),
REJECT_INVALID, "bad-txnmrklroot", true);
@@ -2850,9 +3098,9 @@ static bool AcceptBlockHeader(const CBlockHeader& block, CValidationState& state
return true;
}
-bool AcceptBlock(const CBlock& block, CValidationState& state, CBlockIndex** ppindex, bool fRequested, CDiskBlockPos* dbp)
+/** Store block on disk. If dbp is non-NULL, the file is known to already reside on disk */
+static bool AcceptBlock(const CBlock& block, CValidationState& state, const CChainParams& chainparams, CBlockIndex** ppindex, bool fRequested, CDiskBlockPos* dbp)
{
- const CChainParams& chainparams = Params();
AssertLockHeld(cs_main);
CBlockIndex *&pindex = *ppindex;
@@ -2927,9 +3175,8 @@ static bool IsSuperMajority(int minVersion, const CBlockIndex* pstart, unsigned
}
-bool ProcessNewBlock(CValidationState &state, const CNode* pfrom, const CBlock* pblock, bool fForceProcessing, CDiskBlockPos *dbp)
+bool ProcessNewBlock(CValidationState& state, const CChainParams& chainparams, const CNode* pfrom, const CBlock* pblock, bool fForceProcessing, CDiskBlockPos* dbp)
{
- const CChainParams& chainparams = Params();
// Preliminary checks
bool checked = CheckBlock(*pblock, state);
@@ -2943,7 +3190,7 @@ bool ProcessNewBlock(CValidationState &state, const CNode* pfrom, const CBlock*
// Store to disk
CBlockIndex *pindex = NULL;
- bool ret = AcceptBlock(*pblock, state, &pindex, fRequested, dbp);
+ bool ret = AcceptBlock(*pblock, state, chainparams, &pindex, fRequested, dbp);
if (pindex && pfrom) {
mapBlockSource[pindex->GetBlockHash()] = pfrom->GetId();
}
@@ -2952,15 +3199,14 @@ bool ProcessNewBlock(CValidationState &state, const CNode* pfrom, const CBlock*
return error("%s: AcceptBlock FAILED", __func__);
}
- if (!ActivateBestChain(state, pblock))
+ if (!ActivateBestChain(state, chainparams, pblock))
return error("%s: ActivateBestChain failed", __func__);
return true;
}
-bool TestBlockValidity(CValidationState &state, const CBlock& block, CBlockIndex * const pindexPrev, bool fCheckPOW, bool fCheckMerkleRoot)
+bool TestBlockValidity(CValidationState& state, const CChainParams& chainparams, const CBlock& block, CBlockIndex* pindexPrev, bool fCheckPOW, bool fCheckMerkleRoot)
{
- const CChainParams& chainparams = Params();
AssertLockHeld(cs_main);
assert(pindexPrev && pindexPrev == chainActive.Tip());
if (fCheckpointsEnabled && !CheckIndexAgainstCheckpoint(pindexPrev, state, chainparams, block.GetHash()))
@@ -3043,13 +3289,13 @@ void UnlinkPrunedFiles(std::set<int>& setFilesToPrune)
}
/* Calculate the block/rev files that should be deleted to remain under target*/
-void FindFilesToPrune(std::set<int>& setFilesToPrune)
+void FindFilesToPrune(std::set<int>& setFilesToPrune, uint64_t nPruneAfterHeight)
{
LOCK2(cs_main, cs_LastBlockFile);
if (chainActive.Tip() == NULL || nPruneTarget == 0) {
return;
}
- if (chainActive.Tip()->nHeight <= Params().PruneAfterHeight()) {
+ if ((uint64_t)chainActive.Tip()->nHeight <= nPruneAfterHeight) {
return;
}
@@ -3277,9 +3523,8 @@ CVerifyDB::~CVerifyDB()
uiInterface.ShowProgress("", 100);
}
-bool CVerifyDB::VerifyDB(CCoinsView *coinsview, int nCheckLevel, int nCheckDepth)
+bool CVerifyDB::VerifyDB(const CChainParams& chainparams, CCoinsView *coinsview, int nCheckLevel, int nCheckDepth)
{
- const CChainParams& chainparams = Params();
LOCK(cs_main);
if (chainActive.Tip() == NULL || chainActive.Tip()->pprev == NULL)
return true;
@@ -3395,9 +3640,8 @@ bool LoadBlockIndex()
return true;
}
-
-bool InitBlockIndex() {
- const CChainParams& chainparams = Params();
+bool InitBlockIndex(const CChainParams& chainparams)
+{
LOCK(cs_main);
// Initialize global variables that cannot be constructed at startup.
@@ -3408,14 +3652,14 @@ bool InitBlockIndex() {
return true;
// Use the provided setting for -txindex in the new database
- fTxIndex = GetBoolArg("-txindex", false);
+ fTxIndex = GetBoolArg("-txindex", DEFAULT_TXINDEX);
pblocktree->WriteFlag("txindex", fTxIndex);
LogPrintf("Initializing databases...\n");
// Only add the genesis block if not reindexing (in which case we reuse the one already on disk)
if (!fReindex) {
try {
- CBlock &block = const_cast<CBlock&>(Params().GenesisBlock());
+ CBlock &block = const_cast<CBlock&>(chainparams.GenesisBlock());
// Start new block file
unsigned int nBlockSize = ::GetSerializeSize(block, SER_DISK, CLIENT_VERSION);
CDiskBlockPos blockPos;
@@ -3427,7 +3671,7 @@ bool InitBlockIndex() {
CBlockIndex *pindex = AddToBlockIndex(block);
if (!ReceivedBlockTransactions(block, state, pindex, blockPos))
return error("LoadBlockIndex(): genesis block not accepted");
- if (!ActivateBestChain(state, &block))
+ if (!ActivateBestChain(state, chainparams, &block))
return error("LoadBlockIndex(): genesis block cannot be activated");
// Force a chainstate write so that when we VerifyDB in a moment, it doesn't check stale data
return FlushStateToDisk(state, FLUSH_STATE_ALWAYS);
@@ -3439,11 +3683,8 @@ bool InitBlockIndex() {
return true;
}
-
-
-bool LoadExternalBlockFile(FILE* fileIn, CDiskBlockPos *dbp)
+bool LoadExternalBlockFile(const CChainParams& chainparams, FILE* fileIn, CDiskBlockPos *dbp)
{
- const CChainParams& chainparams = Params();
// Map of disk positions for blocks with unknown parent (only used for reindex)
static std::multimap<uint256, CDiskBlockPos> mapBlocksUnknownParent;
int64_t nStart = GetTimeMillis();
@@ -3463,10 +3704,10 @@ bool LoadExternalBlockFile(FILE* fileIn, CDiskBlockPos *dbp)
try {
// locate a header
unsigned char buf[MESSAGE_START_SIZE];
- blkdat.FindByte(Params().MessageStart()[0]);
+ blkdat.FindByte(chainparams.MessageStart()[0]);
nRewind = blkdat.GetPos()+1;
blkdat >> FLATDATA(buf);
- if (memcmp(buf, Params().MessageStart(), MESSAGE_START_SIZE))
+ if (memcmp(buf, chainparams.MessageStart(), MESSAGE_START_SIZE))
continue;
// read size
blkdat >> nSize;
@@ -3500,7 +3741,7 @@ bool LoadExternalBlockFile(FILE* fileIn, CDiskBlockPos *dbp)
// process in case the block isn't known yet
if (mapBlockIndex.count(hash) == 0 || (mapBlockIndex[hash]->nStatus & BLOCK_HAVE_DATA) == 0) {
CValidationState state;
- if (ProcessNewBlock(state, NULL, &block, true, dbp))
+ if (ProcessNewBlock(state, chainparams, NULL, &block, true, dbp))
nLoaded++;
if (state.IsError())
break;
@@ -3522,7 +3763,7 @@ bool LoadExternalBlockFile(FILE* fileIn, CDiskBlockPos *dbp)
LogPrintf("%s: Processing out of order child %s of %s\n", __func__, block.GetHash().ToString(),
head.ToString());
CValidationState dummy;
- if (ProcessNewBlock(dummy, NULL, &block, true, &it->second))
+ if (ProcessNewBlock(dummy, chainparams, NULL, &block, true, &it->second))
{
nLoaded++;
queue.push_back(block.GetHash());
@@ -3742,7 +3983,7 @@ std::string GetWarnings(const std::string& strFor)
if (!CLIENT_VERSION_IS_RELEASE)
strStatusBar = _("This is a pre-release test build - use at your own risk - do not use for mining or merchant applications");
- if (GetBoolArg("-testsafemode", false))
+ if (GetBoolArg("-testsafemode", DEFAULT_TESTSAFEMODE))
strStatusBar = strRPC = "testsafemode enabled";
// Misc warnings like out of disk space and clock is wrong
@@ -3860,15 +4101,16 @@ void static ProcessGetData(CNode* pfrom, const Consensus::Params& consensusParam
// best equivalent proof of work) than the best header chain we know about.
send = mi->second->IsValid(BLOCK_VALID_SCRIPTS) && (pindexBestHeader != NULL) &&
(pindexBestHeader->GetBlockTime() - mi->second->GetBlockTime() < nOneMonth) &&
- (GetBlockProofEquivalentTime(*pindexBestHeader, *mi->second, *pindexBestHeader, Params().GetConsensus()) < nOneMonth);
+ (GetBlockProofEquivalentTime(*pindexBestHeader, *mi->second, *pindexBestHeader, consensusParams) < nOneMonth);
if (!send) {
LogPrintf("%s: ignoring request from peer=%i for old block that isn't in the main chain\n", __func__, pfrom->GetId());
}
}
}
// disconnect node in case we have reached the outbound limit for serving historical blocks
+ // never disconnect whitelisted nodes
static const int nOneWeek = 7 * 24 * 60 * 60; // assume > 1 week = historical
- if (send && CNode::OutboundTargetReached(true) && ( ((pindexBestHeader != NULL) && (pindexBestHeader->GetBlockTime() - mi->second->GetBlockTime() > nOneWeek)) || inv.type == MSG_FILTERED_BLOCK) )
+ if (send && CNode::OutboundTargetReached(true) && ( ((pindexBestHeader != NULL) && (pindexBestHeader->GetBlockTime() - mi->second->GetBlockTime() > nOneWeek)) || inv.type == MSG_FILTERED_BLOCK) && !pfrom->fWhitelisted)
{
LogPrint("net", "historical block serving limit reached, disconnect peer=%d\n", pfrom->GetId());
@@ -3982,6 +4224,19 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
}
+ if (!(nLocalServices & NODE_BLOOM) &&
+ (strCommand == "filterload" ||
+ strCommand == "filteradd" ||
+ strCommand == "filterclear"))
+ {
+ if (pfrom->nVersion >= NO_BLOOM_VERSION) {
+ Misbehaving(pfrom->GetId(), 100);
+ return false;
+ } else if (GetBoolArg("-enforcenodebloom", false)) {
+ pfrom->fDisconnect = true;
+ return false;
+ }
+ }
if (strCommand == "version")
@@ -4124,6 +4379,14 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
LOCK(cs_main);
State(pfrom->GetId())->fCurrentlyConnected = true;
}
+
+ if (pfrom->nVersion >= SENDHEADERS_VERSION) {
+ // Tell our peer we prefer to receive headers rather than inv's
+ // We send this to non-NODE NETWORK peers as well, because even
+ // non-NODE NETWORK peers can announce blocks (such as pruning
+ // nodes)
+ pfrom->PushMessage("sendheaders");
+ }
}
@@ -4193,6 +4456,12 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
pfrom->fDisconnect = true;
}
+ else if (strCommand == "sendheaders")
+ {
+ LOCK(cs_main);
+ State(pfrom->GetId())->fPreferHeaders = true;
+ }
+
else if (strCommand == "inv")
{
@@ -4204,6 +4473,12 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
return error("message inv size() = %u", vInv.size());
}
+ bool fBlocksOnly = GetBoolArg("-blocksonly", DEFAULT_BLOCKSONLY);
+
+ // Allow whitelisted peers to send data other than blocks in blocks only mode if whitelistalwaysrelay is true
+ if (pfrom->fWhitelisted && GetBoolArg("-whitelistalwaysrelay", DEFAULT_WHITELISTALWAYSRELAY))
+ fBlocksOnly = false;
+
LOCK(cs_main);
std::vector<CInv> vToFetch;
@@ -4218,9 +4493,6 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
bool fAlreadyHave = AlreadyHave(inv);
LogPrint("net", "got inv: %s %s peer=%d\n", inv.ToString(), fAlreadyHave ? "have" : "new", pfrom->id);
- if (!fAlreadyHave && !fImporting && !fReindex && inv.type != MSG_BLOCK)
- pfrom->AskFor(inv);
-
if (inv.type == MSG_BLOCK) {
UpdateBlockAvailability(pfrom->GetId(), inv.hash);
if (!fAlreadyHave && !fImporting && !fReindex && !mapBlocksInFlight.count(inv.hash)) {
@@ -4234,7 +4506,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
// not a direct successor.
pfrom->PushMessage("getheaders", chainActive.GetLocator(pindexBestHeader), inv.hash);
CNodeState *nodestate = State(pfrom->GetId());
- if (chainActive.Tip()->GetBlockTime() > GetAdjustedTime() - chainparams.GetConsensus().nPowTargetSpacing * 20 &&
+ if (CanDirectFetch(chainparams.GetConsensus()) &&
nodestate->nBlocksInFlight < MAX_BLOCKS_IN_TRANSIT_PER_PEER) {
vToFetch.push_back(inv);
// Mark block as in flight already, even though the actual "getdata" message only goes out
@@ -4244,6 +4516,13 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
LogPrint("net", "getheaders (%d) %s to peer=%d\n", pindexBestHeader->nHeight, inv.hash.ToString(), pfrom->id);
}
}
+ else
+ {
+ if (fBlocksOnly)
+ LogPrint("net", "transaction (%s) inv sent in violation of protocol peer=%d\n", inv.hash.ToString(), pfrom->id);
+ else if (!fAlreadyHave && !fImporting && !fReindex)
+ pfrom->AskFor(inv);
+ }
// Track requests for our stuff
GetMainSignals().Inventory(inv.hash);
@@ -4335,6 +4614,8 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
LogPrint("net", "Ignoring getheaders from peer=%d because node is in initial block download\n", pfrom->id);
return true;
}
+
+ CNodeState *nodestate = State(pfrom->GetId());
CBlockIndex* pindex = NULL;
if (locator.IsNull())
{
@@ -4362,12 +4643,25 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
if (--nLimit <= 0 || pindex->GetBlockHash() == hashStop)
break;
}
+ // pindex can be NULL either if we sent chainActive.Tip() OR
+ // if our peer has chainActive.Tip() (and thus we are sending an empty
+ // headers message). In both cases it's safe to update
+ // pindexBestHeaderSent to be our tip.
+ nodestate->pindexBestHeaderSent = pindex ? pindex : chainActive.Tip();
pfrom->PushMessage("headers", vHeaders);
}
else if (strCommand == "tx")
{
+ // Stop processing the transaction early if
+ // We are in blocks only mode and peer is either not whitelisted or whitelistalwaysrelay is off
+ if (GetBoolArg("-blocksonly", DEFAULT_BLOCKSONLY) && (!pfrom->fWhitelisted || !GetBoolArg("-whitelistalwaysrelay", DEFAULT_WHITELISTALWAYSRELAY)))
+ {
+ LogPrint("net", "transaction sent in violation of protocol peer=%d\n", pfrom->id);
+ return true;
+ }
+
vector<uint256> vWorkQueue;
vector<uint256> vEraseQueue;
CTransaction tx;
@@ -4381,13 +4675,10 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
bool fMissingInputs = false;
CValidationState state;
+ pfrom->setAskFor.erase(inv.hash);
mapAlreadyAskedFor.erase(inv);
- // Check for recently rejected (and do other quick existence checks)
- if (AlreadyHave(inv))
- return true;
-
- if (AcceptToMemoryPool(mempool, state, tx, true, &fMissingInputs))
+ if (!AlreadyHave(inv) && AcceptToMemoryPool(mempool, state, tx, true, &fMissingInputs))
{
mempool.check(pcoinsTip);
RelayTransaction(tx);
@@ -4465,15 +4756,22 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
assert(recentRejects);
recentRejects->insert(tx.GetHash());
- if (pfrom->fWhitelisted) {
+ if (pfrom->fWhitelisted && GetBoolArg("-whitelistalwaysrelay", DEFAULT_WHITELISTALWAYSRELAY)) {
// Always relay transactions received from whitelisted peers, even
- // if they were rejected from the mempool, allowing the node to
- // function as a gateway for nodes hidden behind it.
+ // if they were already in the mempool or rejected from it due
+ // to policy, allowing the node to function as a gateway for
+ // nodes hidden behind it.
//
- // FIXME: This includes invalid transactions, which means a
- // whitelisted peer could get us banned! We may want to change
- // that.
- RelayTransaction(tx);
+ // Never relay transactions that we would assign a non-zero DoS
+ // score for, as we expect peers to do the same with us in that
+ // case.
+ int nDoS = 0;
+ if (!state.IsInvalid(nDoS) || nDoS == 0) {
+ LogPrintf("Force relaying tx %s from whitelisted peer=%d\n", tx.GetHash().ToString(), pfrom->id);
+ RelayTransaction(tx);
+ } else {
+ LogPrintf("Not relaying invalid transaction %s from whitelisted peer=%d (%s)\n", tx.GetHash().ToString(), pfrom->id, FormatStateMessage(state));
+ }
}
}
int nDoS = 0;
@@ -4542,6 +4840,53 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
pfrom->PushMessage("getheaders", chainActive.GetLocator(pindexLast), uint256());
}
+ bool fCanDirectFetch = CanDirectFetch(chainparams.GetConsensus());
+ CNodeState *nodestate = State(pfrom->GetId());
+ // If this set of headers is valid and ends in a block with at least as
+ // much work as our tip, download as much as possible.
+ if (fCanDirectFetch && pindexLast->IsValid(BLOCK_VALID_TREE) && chainActive.Tip()->nChainWork <= pindexLast->nChainWork) {
+ vector<CBlockIndex *> vToFetch;
+ CBlockIndex *pindexWalk = pindexLast;
+ // Calculate all the blocks we'd need to switch to pindexLast, up to a limit.
+ while (pindexWalk && !chainActive.Contains(pindexWalk) && vToFetch.size() <= MAX_BLOCKS_IN_TRANSIT_PER_PEER) {
+ if (!(pindexWalk->nStatus & BLOCK_HAVE_DATA) &&
+ !mapBlocksInFlight.count(pindexWalk->GetBlockHash())) {
+ // We don't have this block, and it's not yet in flight.
+ vToFetch.push_back(pindexWalk);
+ }
+ pindexWalk = pindexWalk->pprev;
+ }
+ // If pindexWalk still isn't on our main chain, we're looking at a
+ // very large reorg at a time we think we're close to caught up to
+ // the main chain -- this shouldn't really happen. Bail out on the
+ // direct fetch and rely on parallel download instead.
+ if (!chainActive.Contains(pindexWalk)) {
+ LogPrint("net", "Large reorg, won't direct fetch to %s (%d)\n",
+ pindexLast->GetBlockHash().ToString(),
+ pindexLast->nHeight);
+ } else {
+ vector<CInv> vGetData;
+ // Download as much as possible, from earliest to latest.
+ BOOST_REVERSE_FOREACH(CBlockIndex *pindex, vToFetch) {
+ if (nodestate->nBlocksInFlight >= MAX_BLOCKS_IN_TRANSIT_PER_PEER) {
+ // Can't download any more from this peer
+ break;
+ }
+ vGetData.push_back(CInv(MSG_BLOCK, pindex->GetBlockHash()));
+ MarkBlockAsInFlight(pfrom->GetId(), pindex->GetBlockHash(), chainparams.GetConsensus(), pindex);
+ LogPrint("net", "Requesting block %s from peer=%d\n",
+ pindex->GetBlockHash().ToString(), pfrom->id);
+ }
+ if (vGetData.size() > 1) {
+ LogPrint("net", "Downloading blocks toward %s (%d) via headers direct fetch\n",
+ pindexLast->GetBlockHash().ToString(), pindexLast->nHeight);
+ }
+ if (vGetData.size() > 0) {
+ pfrom->PushMessage("getdata", vGetData);
+ }
+ }
+ }
+
CheckBlockIndex(chainparams.GetConsensus());
}
@@ -4561,7 +4906,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
// Such an unrequested block may still be processed, subject to the
// conditions in AcceptBlock().
bool forceProcessing = pfrom->fWhitelisted && !IsInitialBlockDownload();
- ProcessNewBlock(state, pfrom, &block, forceProcessing, NULL);
+ ProcessNewBlock(state, chainparams, pfrom, &block, forceProcessing, NULL);
int nDoS;
if (state.IsInvalid(nDoS)) {
assert (state.GetRejectCode() < REJECT_INTERNAL); // Blocks are never rejected with internal reject codes
@@ -4702,7 +5047,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
uint256 alertHash = alert.GetHash();
if (pfrom->setKnown.count(alertHash) == 0)
{
- if (alert.ProcessAlert(Params().AlertKey()))
+ if (alert.ProcessAlert(chainparams.AlertKey()))
{
// Relay
pfrom->setKnown.insert(alertHash);
@@ -4725,21 +5070,6 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
}
- else if (!(nLocalServices & NODE_BLOOM) &&
- (strCommand == "filterload" ||
- strCommand == "filteradd" ||
- strCommand == "filterclear") &&
- //TODO: Remove this line after reasonable network upgrade
- pfrom->nVersion >= NO_BLOOM_VERSION)
- {
- if (pfrom->nVersion >= NO_BLOOM_VERSION)
- Misbehaving(pfrom->GetId(), 100);
- //TODO: Enable this after reasonable network upgrade
- //else
- // pfrom->fDisconnect = true;
- }
-
-
else if (strCommand == "filterload")
{
CBloomFilter filter;
@@ -5083,6 +5413,100 @@ bool SendMessages(CNode* pto, bool fSendTrickle)
}
//
+ // Try sending block announcements via headers
+ //
+ {
+ // If we have less than MAX_BLOCKS_TO_ANNOUNCE in our
+ // list of block hashes we're relaying, and our peer wants
+ // headers announcements, then find the first header
+ // not yet known to our peer but would connect, and send.
+ // If no header would connect, or if we have too many
+ // blocks, or if the peer doesn't want headers, just
+ // add all to the inv queue.
+ LOCK(pto->cs_inventory);
+ vector<CBlock> vHeaders;
+ bool fRevertToInv = (!state.fPreferHeaders || pto->vBlockHashesToAnnounce.size() > MAX_BLOCKS_TO_ANNOUNCE);
+ CBlockIndex *pBestIndex = NULL; // last header queued for delivery
+ ProcessBlockAvailability(pto->id); // ensure pindexBestKnownBlock is up-to-date
+
+ if (!fRevertToInv) {
+ bool fFoundStartingHeader = false;
+ // Try to find first header that our peer doesn't have, and
+ // then send all headers past that one. If we come across any
+ // headers that aren't on chainActive, give up.
+ BOOST_FOREACH(const uint256 &hash, pto->vBlockHashesToAnnounce) {
+ BlockMap::iterator mi = mapBlockIndex.find(hash);
+ assert(mi != mapBlockIndex.end());
+ CBlockIndex *pindex = mi->second;
+ if (chainActive[pindex->nHeight] != pindex) {
+ // Bail out if we reorged away from this block
+ fRevertToInv = true;
+ break;
+ }
+ assert(pBestIndex == NULL || pindex->pprev == pBestIndex);
+ pBestIndex = pindex;
+ if (fFoundStartingHeader) {
+ // add this to the headers message
+ vHeaders.push_back(pindex->GetBlockHeader());
+ } else if (PeerHasHeader(&state, pindex)) {
+ continue; // keep looking for the first new block
+ } else if (pindex->pprev == NULL || PeerHasHeader(&state, pindex->pprev)) {
+ // Peer doesn't have this header but they do have the prior one.
+ // Start sending headers.
+ fFoundStartingHeader = true;
+ vHeaders.push_back(pindex->GetBlockHeader());
+ } else {
+ // Peer doesn't have this header or the prior one -- nothing will
+ // connect, so bail out.
+ fRevertToInv = true;
+ break;
+ }
+ }
+ }
+ if (fRevertToInv) {
+ // If falling back to using an inv, just try to inv the tip.
+ // The last entry in vBlockHashesToAnnounce was our tip at some point
+ // in the past.
+ if (!pto->vBlockHashesToAnnounce.empty()) {
+ const uint256 &hashToAnnounce = pto->vBlockHashesToAnnounce.back();
+ BlockMap::iterator mi = mapBlockIndex.find(hashToAnnounce);
+ assert(mi != mapBlockIndex.end());
+ CBlockIndex *pindex = mi->second;
+
+ // Warn if we're announcing a block that is not on the main chain.
+ // This should be very rare and could be optimized out.
+ // Just log for now.
+ if (chainActive[pindex->nHeight] != pindex) {
+ LogPrint("net", "Announcing block %s not on main chain (tip=%s)\n",
+ hashToAnnounce.ToString(), chainActive.Tip()->GetBlockHash().ToString());
+ }
+
+ // If the peer announced this block to us, don't inv it back.
+ // (Since block announcements may not be via inv's, we can't solely rely on
+ // setInventoryKnown to track this.)
+ if (!PeerHasHeader(&state, pindex)) {
+ pto->PushInventory(CInv(MSG_BLOCK, hashToAnnounce));
+ LogPrint("net", "%s: sending inv peer=%d hash=%s\n", __func__,
+ pto->id, hashToAnnounce.ToString());
+ }
+ }
+ } else if (!vHeaders.empty()) {
+ if (vHeaders.size() > 1) {
+ LogPrint("net", "%s: %u headers, range (%s, %s), to peer=%d\n", __func__,
+ vHeaders.size(),
+ vHeaders.front().GetHash().ToString(),
+ vHeaders.back().GetHash().ToString(), pto->id);
+ } else {
+ LogPrint("net", "%s: sending header %s to peer=%d\n", __func__,
+ vHeaders.front().GetHash().ToString(), pto->id);
+ }
+ pto->PushMessage("headers", vHeaders);
+ state.pindexBestHeaderSent = pBestIndex;
+ }
+ pto->vBlockHashesToAnnounce.clear();
+ }
+
+ //
// Message: inventory
//
vector<CInv> vInv;
@@ -5200,6 +5624,9 @@ bool SendMessages(CNode* pto, bool fSendTrickle)
pto->PushMessage("getdata", vGetData);
vGetData.clear();
}
+ } else {
+ //If we're not going to ask, don't expect a response.
+ pto->setAskFor.erase(inv.hash);
}
pto->mapAskFor.erase(pto->mapAskFor.begin());
}
diff --git a/src/main.h b/src/main.h
index 5fb5534860..bdbfa3826e 100644
--- a/src/main.h
+++ b/src/main.h
@@ -31,6 +31,7 @@
class CBlockIndex;
class CBlockTreeDB;
class CBloomFilter;
+class CChainParams;
class CInv;
class CScriptCheck;
class CTxMemPool;
@@ -41,6 +42,8 @@ struct CNodeStateStats;
/** Default for accepting alerts from the P2P network. */
static const bool DEFAULT_ALERTS = true;
+/** Default for DEFAULT_WHITELISTALWAYSRELAY. */
+static const bool DEFAULT_WHITELISTALWAYSRELAY = true;
/** Default for -minrelaytxfee, minimum relay fee for transactions */
static const unsigned int DEFAULT_MIN_RELAY_TX_FEE = 1000;
/** Default for -maxorphantx, maximum number of orphan transactions kept in memory */
@@ -53,8 +56,6 @@ static const unsigned int DEFAULT_ANCESTOR_SIZE_LIMIT = 101;
static const unsigned int DEFAULT_DESCENDANT_LIMIT = 25;
/** Default for -limitdescendantsize, maximum kilobytes of in-mempool descendants */
static const unsigned int DEFAULT_DESCENDANT_SIZE_LIMIT = 101;
-/** Default for -maxmempool, maximum megabytes of mempool memory usage */
-static const unsigned int DEFAULT_MAX_MEMPOOL_SIZE = 300;
/** Default for -mempoolexpiry, expiration time for mempool transactions in hours */
static const unsigned int DEFAULT_MEMPOOL_EXPIRY = 72;
/** The maximum size of a blk?????.dat file (since 0.8) */
@@ -63,6 +64,7 @@ static const unsigned int MAX_BLOCKFILE_SIZE = 0x8000000; // 128 MiB
static const unsigned int BLOCKFILE_CHUNK_SIZE = 0x1000000; // 16 MiB
/** The pre-allocation chunk size for rev?????.dat files (since 0.8) */
static const unsigned int UNDOFILE_CHUNK_SIZE = 0x100000; // 1 MiB
+
/** Maximum number of script-checking threads allowed */
static const int MAX_SCRIPTCHECK_THREADS = 16;
/** -par default (number of script-checking threads, 0 = auto) */
@@ -85,6 +87,19 @@ static const unsigned int DATABASE_WRITE_INTERVAL = 60 * 60;
static const unsigned int DATABASE_FLUSH_INTERVAL = 24 * 60 * 60;
/** Maximum length of reject messages. */
static const unsigned int MAX_REJECT_MESSAGE_LENGTH = 111;
+static const unsigned int DEFAULT_LIMITFREERELAY = 15;
+static const bool DEFAULT_RELAYPRIORITY = true;
+
+/** Default for -permitbaremultisig */
+static const bool DEFAULT_PERMIT_BAREMULTISIG = true;
+static const bool DEFAULT_CHECKPOINTS_ENABLED = true;
+static const bool DEFAULT_TXINDEX = false;
+static const unsigned int DEFAULT_BANSCORE_THRESHOLD = 100;
+
+static const bool DEFAULT_TESTSAFEMODE = false;
+
+/** Maximum number of headers to announce when relaying blocks with headers message.*/
+static const unsigned int MAX_BLOCKS_TO_ANNOUNCE = 8;
struct BlockHasher
{
@@ -159,7 +174,7 @@ void UnregisterNodeSignals(CNodeSignals& nodeSignals);
* @param[out] dbp If pblock is stored to disk (or already there), this will be set to its location.
* @return True if state.IsValid()
*/
-bool ProcessNewBlock(CValidationState &state, const CNode* pfrom, const CBlock* pblock, bool fForceProcessing, CDiskBlockPos *dbp);
+bool ProcessNewBlock(CValidationState& state, const CChainParams& chainparams, const CNode* pfrom, const CBlock* pblock, bool fForceProcessing, CDiskBlockPos* dbp);
/** Check whether enough disk space is available for an incoming block */
bool CheckDiskSpace(uint64_t nAdditionalBytes = 0);
/** Open a block file (blk?????.dat) */
@@ -169,9 +184,9 @@ FILE* OpenUndoFile(const CDiskBlockPos &pos, bool fReadOnly = false);
/** Translation to a filesystem path */
boost::filesystem::path GetBlockPosFilename(const CDiskBlockPos &pos, const char *prefix);
/** Import blocks from an external file */
-bool LoadExternalBlockFile(FILE* fileIn, CDiskBlockPos *dbp = NULL);
+bool LoadExternalBlockFile(const CChainParams& chainparams, FILE* fileIn, CDiskBlockPos *dbp = NULL);
/** Initialize a new block tree database + block data on disk */
-bool InitBlockIndex();
+bool InitBlockIndex(const CChainParams& chainparams);
/** Load the block tree and coins database from disk */
bool LoadBlockIndex();
/** Unload database information */
@@ -196,7 +211,7 @@ std::string GetWarnings(const std::string& strFor);
/** Retrieve a transaction (from memory pool, or from disk, if possible) */
bool GetTransaction(const uint256 &hash, CTransaction &tx, const Consensus::Params& params, uint256 &hashBlock, bool fAllowSlow = false);
/** Find the best known block, and make it the tip of the block chain */
-bool ActivateBestChain(CValidationState &state, const CBlock *pblock = NULL);
+bool ActivateBestChain(CValidationState& state, const CChainParams& chainparams, const CBlock* pblock = NULL);
CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams);
/**
@@ -207,14 +222,14 @@ CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams);
*
* Pruning functions are called from FlushStateToDisk when the global fCheckForPruning flag has been set.
* Block and undo files are deleted in lock-step (when blk00003.dat is deleted, so is rev00003.dat.)
- * Pruning cannot take place until the longest chain is at least a certain length (100000 on mainnet, 1000 on testnet, 10 on regtest).
+ * Pruning cannot take place until the longest chain is at least a certain length (100000 on mainnet, 1000 on testnet, 1000 on regtest).
* Pruning will never delete a block within a defined distance (currently 288) from the active chain's tip.
* The block index is updated by unsetting HAVE_DATA and HAVE_UNDO for any blocks that were stored in the deleted files.
* A db flag records the fact that at least some block files have been pruned.
*
* @param[out] setFilesToPrune The set of file indices that can be unlinked will be returned
*/
-void FindFilesToPrune(std::set<int>& setFilesToPrune);
+void FindFilesToPrune(std::set<int>& setFilesToPrune, uint64_t nPruneAfterHeight);
/**
* Actually unlink the specified files
@@ -378,10 +393,7 @@ bool ContextualCheckBlockHeader(const CBlockHeader& block, CValidationState& sta
bool ContextualCheckBlock(const CBlock& block, CValidationState& state, CBlockIndex *pindexPrev);
/** Check a block is completely valid from start to finish (only works on top of our current best block, with cs_main held) */
-bool TestBlockValidity(CValidationState &state, const CBlock& block, CBlockIndex *pindexPrev, bool fCheckPOW = true, bool fCheckMerkleRoot = true);
-
-/** Store block on disk. If dbp is non-NULL, the file is known to already reside on disk */
-bool AcceptBlock(const CBlock& block, CValidationState& state, CBlockIndex **pindex, bool fRequested, CDiskBlockPos* dbp);
+bool TestBlockValidity(CValidationState& state, const CChainParams& chainparams, const CBlock& block, CBlockIndex* pindexPrev, bool fCheckPOW = true, bool fCheckMerkleRoot = true);
class CBlockFileInfo
@@ -443,7 +455,7 @@ class CVerifyDB {
public:
CVerifyDB();
~CVerifyDB();
- bool VerifyDB(CCoinsView *coinsview, int nCheckLevel, int nCheckDepth);
+ bool VerifyDB(const CChainParams& chainparams, CCoinsView *coinsview, int nCheckLevel, int nCheckDepth);
};
/** Find the last common block between the parameter chain and a locator. */
diff --git a/src/miner.cpp b/src/miner.cpp
index 053d9cdbc4..27a1fbcf80 100644
--- a/src/miner.cpp
+++ b/src/miner.cpp
@@ -10,6 +10,7 @@
#include "chainparams.h"
#include "coins.h"
#include "consensus/consensus.h"
+#include "consensus/merkle.h"
#include "consensus/validation.h"
#include "hash.h"
#include "main.h"
@@ -99,9 +100,8 @@ int64_t UpdateTime(CBlockHeader* pblock, const Consensus::Params& consensusParam
return nNewTime - nOldTime;
}
-CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn)
+CBlockTemplate* CreateNewBlock(const CChainParams& chainparams, const CScript& scriptPubKeyIn)
{
- const CChainParams& chainparams = Params();
// Create new block
auto_ptr<CBlockTemplate> pblocktemplate(new CBlockTemplate());
if(!pblocktemplate.get())
@@ -110,7 +110,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn)
// -regtest only: allow overriding block.nVersion with
// -blockversion=N to test forking scenarios
- if (Params().MineBlocksOnDemand())
+ if (chainparams.MineBlocksOnDemand())
pblock->nVersion = GetArg("-blockversion", pblock->nVersion);
// Create coinbase tx
@@ -154,7 +154,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn)
// Priority order to process transactions
list<COrphan> vOrphan; // list memory doesn't move
map<uint256, vector<COrphan*> > mapDependers;
- bool fPrintPriority = GetBoolArg("-printpriority", false);
+ bool fPrintPriority = GetBoolArg("-printpriority", DEFAULT_PRINTPRIORITY);
// This vector will be sorted into a priority queue:
vector<TxPriority> vecPriority;
@@ -345,13 +345,13 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn)
// Fill in header
pblock->hashPrevBlock = pindexPrev->GetBlockHash();
- UpdateTime(pblock, Params().GetConsensus(), pindexPrev);
- pblock->nBits = GetNextWorkRequired(pindexPrev, pblock, Params().GetConsensus());
+ UpdateTime(pblock, chainparams.GetConsensus(), pindexPrev);
+ pblock->nBits = GetNextWorkRequired(pindexPrev, pblock, chainparams.GetConsensus());
pblock->nNonce = 0;
pblocktemplate->vTxSigOps[0] = GetLegacySigOpCount(pblock->vtx[0]);
CValidationState state;
- if (!TestBlockValidity(state, *pblock, pindexPrev, false, false))
+ if (!TestBlockValidity(state, chainparams, *pblock, pindexPrev, false, false))
throw std::runtime_error("CreateNewBlock(): TestBlockValidity failed");
}
@@ -374,7 +374,7 @@ void IncrementExtraNonce(CBlock* pblock, const CBlockIndex* pindexPrev, unsigned
assert(txCoinbase.vin[0].scriptSig.size() <= 100);
pblock->vtx[0] = txCoinbase;
- pblock->hashMerkleRoot = pblock->ComputeMerkleRoot();
+ pblock->hashMerkleRoot = BlockMerkleRoot(*pblock);
}
//////////////////////////////////////////////////////////////////////////////
@@ -432,7 +432,7 @@ static bool ProcessBlockFound(const CBlock* pblock, const CChainParams& chainpar
// Process this block the same as if we had received it from another node
CValidationState state;
- if (!ProcessNewBlock(state, NULL, pblock, true, NULL))
+ if (!ProcessNewBlock(state, chainparams, NULL, pblock, true, NULL))
return error("BitcoinMiner: ProcessNewBlock, block not accepted");
return true;
@@ -478,7 +478,7 @@ void static BitcoinMiner(const CChainParams& chainparams)
unsigned int nTransactionsUpdatedLast = mempool.GetTransactionsUpdated();
CBlockIndex* pindexPrev = chainActive.Tip();
- auto_ptr<CBlockTemplate> pblocktemplate(CreateNewBlock(coinbaseScript->reserveScript));
+ auto_ptr<CBlockTemplate> pblocktemplate(CreateNewBlock(chainparams, coinbaseScript->reserveScript));
if (!pblocktemplate.get())
{
LogPrintf("Error in BitcoinMiner: Keypool ran out, please call keypoolrefill before restarting the mining thread\n");
diff --git a/src/miner.h b/src/miner.h
index ad13204818..16c8e2a976 100644
--- a/src/miner.h
+++ b/src/miner.h
@@ -17,8 +17,11 @@ class CScript;
class CWallet;
namespace Consensus { struct Params; };
+static const bool DEFAULT_GENERATE = false;
static const int DEFAULT_GENERATE_THREADS = 1;
+static const bool DEFAULT_PRINTPRIORITY = false;
+
struct CBlockTemplate
{
CBlock block;
@@ -29,7 +32,7 @@ struct CBlockTemplate
/** Run the miner threads */
void GenerateBitcoins(bool fGenerate, int nThreads, const CChainParams& chainparams);
/** Generate a new block, without valid proof-of-work */
-CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn);
+CBlockTemplate* CreateNewBlock(const CChainParams& chainparams, const CScript& scriptPubKeyIn);
/** Modify the extranonce in a block */
void IncrementExtraNonce(CBlock* pblock, const CBlockIndex* pindexPrev, unsigned int& nExtraNonce);
int64_t UpdateTime(CBlockHeader* pblock, const Consensus::Params& consensusParams, const CBlockIndex* pindexPrev);
diff --git a/src/net.cpp b/src/net.cpp
index 1ea50b2493..e5659efc01 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -460,7 +460,7 @@ void CNode::PushVersion()
else
LogPrint("net", "send version message: version %d, blocks=%d, us=%s, peer=%d\n", PROTOCOL_VERSION, nBestHeight, addrMe.ToString(), id);
PushMessage("version", PROTOCOL_VERSION, nLocalServices, nTime, addrYou, addrMe,
- nLocalHostNonce, strSubVersion, nBestHeight, true);
+ nLocalHostNonce, strSubVersion, nBestHeight, !GetBoolArg("-blocksonly", DEFAULT_BLOCKSONLY));
}
@@ -521,12 +521,11 @@ void CNode::Ban(const CSubNet& subNet, const BanReason &banReason, int64_t banti
banEntry.banReason = banReason;
if (bantimeoffset <= 0)
{
- bantimeoffset = GetArg("-bantime", 60*60*24); // Default 24-hour ban
+ bantimeoffset = GetArg("-bantime", DEFAULT_MISBEHAVING_BANTIME);
sinceUnixEpoch = false;
}
banEntry.nBanUntil = (sinceUnixEpoch ? 0 : GetTime() )+bantimeoffset;
-
LOCK(cs_setBanned);
if (setBanned[subNet].nBanUntil < banEntry.nBanUntil)
setBanned[subNet] = banEntry;
@@ -617,6 +616,7 @@ void CNode::copyStats(CNodeStats &stats)
{
stats.nodeid = this->GetId();
X(nServices);
+ X(fRelayTxes);
X(nLastSend);
X(nLastRecv);
X(nTimeConnected);
@@ -1413,7 +1413,7 @@ void ThreadDNSAddressSeed()
{
// goal: only query DNS seeds if address need is acute
if ((addrman.size() > 0) &&
- (!GetBoolArg("-forcednsseed", false))) {
+ (!GetBoolArg("-forcednsseed", DEFAULT_FORCEDNSSEED))) {
MilliSleep(11 * 1000);
LOCK(cs_vNodes);
@@ -2336,8 +2336,8 @@ bool CAddrDB::Read(CAddrMan& addr)
return true;
}
-unsigned int ReceiveFloodSize() { return 1000*GetArg("-maxreceivebuffer", 5*1000); }
-unsigned int SendBufferSize() { return 1000*GetArg("-maxsendbuffer", 1*1000); }
+unsigned int ReceiveFloodSize() { return 1000*GetArg("-maxreceivebuffer", DEFAULT_MAXRECEIVEBUFFER); }
+unsigned int SendBufferSize() { return 1000*GetArg("-maxsendbuffer", DEFAULT_MAXSENDBUFFER); }
CNode::CNode(SOCKET hSocketIn, const CAddress& addrIn, const std::string& addrNameIn, bool fInboundIn) :
ssSend(SER_NETWORK, INIT_PROTO_VERSION),
@@ -2407,8 +2407,12 @@ CNode::~CNode()
void CNode::AskFor(const CInv& inv)
{
- if (mapAskFor.size() > MAPASKFOR_MAX_SZ)
+ if (mapAskFor.size() > MAPASKFOR_MAX_SZ || setAskFor.size() > SETASKFOR_MAX_SZ)
+ return;
+ // a peer may not have multiple non-responded queue positions for a single inv item
+ if (!setAskFor.insert(inv.hash).second)
return;
+
// We're using mapAskFor as a priority queue,
// the key is the earliest time the request can be sent
int64_t nRequestTime;
diff --git a/src/net.h b/src/net.h
index cd2d225d73..a5a5c770d6 100644
--- a/src/net.h
+++ b/src/net.h
@@ -58,10 +58,21 @@ static const bool DEFAULT_UPNP = false;
#endif
/** The maximum number of entries in mapAskFor */
static const size_t MAPASKFOR_MAX_SZ = MAX_INV_SZ;
+/** The maximum number of entries in setAskFor (larger due to getdata latency)*/
+static const size_t SETASKFOR_MAX_SZ = 2 * MAX_INV_SZ;
/** The maximum number of peer connections to maintain. */
static const unsigned int DEFAULT_MAX_PEER_CONNECTIONS = 125;
/** The default for -maxuploadtarget. 0 = Unlimited */
static const uint64_t DEFAULT_MAX_UPLOAD_TARGET = 0;
+/** Default for blocks only*/
+static const bool DEFAULT_BLOCKSONLY = false;
+
+static const bool DEFAULT_FORCEDNSSEED = false;
+static const size_t DEFAULT_MAXRECEIVEBUFFER = 5 * 1000;
+static const size_t DEFAULT_MAXSENDBUFFER = 1 * 1000;
+
+// NOTE: When adjusting this, update rpcnet:setban's help ("24h")
+static const unsigned int DEFAULT_MISBEHAVING_BANTIME = 60 * 60 * 24; // Default 24-hour ban
unsigned int ReceiveFloodSize();
unsigned int SendBufferSize();
@@ -178,6 +189,7 @@ class CNodeStats
public:
NodeId nodeid;
uint64_t nServices;
+ bool fRelayTxes;
int64_t nLastSend;
int64_t nLastRecv;
int64_t nTimeConnected;
@@ -342,7 +354,7 @@ public:
// We use fRelayTxes for two purposes -
// a) it allows us to not relay tx invs before receiving the peer's version message
// b) the peer may tell us in its version message that we should not relay tx invs
- // until it has initialized its bloom filter.
+ // unless it loads a bloom filter.
bool fRelayTxes;
CSemaphoreGrant grantOutbound;
CCriticalSection cs_filter;
@@ -379,7 +391,11 @@ public:
mruset<CInv> setInventoryKnown;
std::vector<CInv> vInventoryToSend;
CCriticalSection cs_inventory;
+ std::set<uint256> setAskFor;
std::multimap<int64_t, CInv> mapAskFor;
+ // Used for headers announcements - unfiltered blocks to relay
+ // Also protected by cs_inventory
+ std::vector<uint256> vBlockHashesToAnnounce;
// Ping time measurement:
// The pong reply we're expecting, or 0 if no pong expected.
@@ -494,6 +510,12 @@ public:
}
}
+ void PushBlockHash(const uint256 &hash)
+ {
+ LOCK(cs_inventory);
+ vBlockHashesToAnnounce.push_back(hash);
+ }
+
void AskFor(const CInv& inv);
// TODO: Document the postcondition of this function. Is cs_vSend locked?
diff --git a/src/netbase.cpp b/src/netbase.cpp
index 83cedfb620..05214cb026 100644
--- a/src/netbase.cpp
+++ b/src/netbase.cpp
@@ -40,7 +40,7 @@ static proxyType proxyInfo[NET_MAX];
static proxyType nameProxy;
static CCriticalSection cs_proxyInfos;
int nConnectTimeout = DEFAULT_CONNECT_TIMEOUT;
-bool fNameLookup = false;
+bool fNameLookup = DEFAULT_NAME_LOOKUP;
static const unsigned char pchIPv4[12] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff };
diff --git a/src/netbase.h b/src/netbase.h
index 2a79f82d72..9c2df0338e 100644
--- a/src/netbase.h
+++ b/src/netbase.h
@@ -19,8 +19,10 @@
extern int nConnectTimeout;
extern bool fNameLookup;
-/** -timeout default */
+//! -timeout default
static const int DEFAULT_CONNECT_TIMEOUT = 5000;
+//! -dns default
+static const int DEFAULT_NAME_LOOKUP = true;
#ifdef WIN32
// In MSVC, this is defined as a macro, undefine it to prevent a compile and link error
diff --git a/src/policy/fees.cpp b/src/policy/fees.cpp
index ffe31d1942..980ecf10df 100644
--- a/src/policy/fees.cpp
+++ b/src/policy/fees.cpp
@@ -4,6 +4,7 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "policy/fees.h"
+#include "policy/policy.h"
#include "amount.h"
#include "primitives/transaction.h"
@@ -504,6 +505,33 @@ CFeeRate CBlockPolicyEstimator::estimateFee(int confTarget)
return CFeeRate(median);
}
+CFeeRate CBlockPolicyEstimator::estimateSmartFee(int confTarget, int *answerFoundAtTarget, const CTxMemPool& pool)
+{
+ if (answerFoundAtTarget)
+ *answerFoundAtTarget = confTarget;
+ // Return failure if trying to analyze a target we're not tracking
+ if (confTarget <= 0 || (unsigned int)confTarget > feeStats.GetMaxConfirms())
+ return CFeeRate(0);
+
+ double median = -1;
+ while (median < 0 && (unsigned int)confTarget <= feeStats.GetMaxConfirms()) {
+ median = feeStats.EstimateMedianVal(confTarget++, SUFFICIENT_FEETXS, MIN_SUCCESS_PCT, true, nBestSeenHeight);
+ }
+
+ if (answerFoundAtTarget)
+ *answerFoundAtTarget = confTarget - 1;
+
+ // If mempool is limiting txs , return at least the min fee from the mempool
+ CAmount minPoolFee = pool.GetMinFee(GetArg("-maxmempool", DEFAULT_MAX_MEMPOOL_SIZE) * 1000000).GetFeePerK();
+ if (minPoolFee > 0 && minPoolFee > median)
+ return CFeeRate(minPoolFee);
+
+ if (median < 0)
+ return CFeeRate(0);
+
+ return CFeeRate(median);
+}
+
double CBlockPolicyEstimator::estimatePriority(int confTarget)
{
// Return failure if trying to analyze a target we're not tracking
@@ -513,6 +541,30 @@ double CBlockPolicyEstimator::estimatePriority(int confTarget)
return priStats.EstimateMedianVal(confTarget, SUFFICIENT_PRITXS, MIN_SUCCESS_PCT, true, nBestSeenHeight);
}
+double CBlockPolicyEstimator::estimateSmartPriority(int confTarget, int *answerFoundAtTarget, const CTxMemPool& pool)
+{
+ if (answerFoundAtTarget)
+ *answerFoundAtTarget = confTarget;
+ // Return failure if trying to analyze a target we're not tracking
+ if (confTarget <= 0 || (unsigned int)confTarget > priStats.GetMaxConfirms())
+ return -1;
+
+ // If mempool is limiting txs, no priority txs are allowed
+ CAmount minPoolFee = pool.GetMinFee(GetArg("-maxmempool", DEFAULT_MAX_MEMPOOL_SIZE) * 1000000).GetFeePerK();
+ if (minPoolFee > 0)
+ return INF_PRIORITY;
+
+ double median = -1;
+ while (median < 0 && (unsigned int)confTarget <= priStats.GetMaxConfirms()) {
+ median = priStats.EstimateMedianVal(confTarget++, SUFFICIENT_PRITXS, MIN_SUCCESS_PCT, true, nBestSeenHeight);
+ }
+
+ if (answerFoundAtTarget)
+ *answerFoundAtTarget = confTarget - 1;
+
+ return median;
+}
+
void CBlockPolicyEstimator::Write(CAutoFile& fileout)
{
fileout << nBestSeenHeight;
diff --git a/src/policy/fees.h b/src/policy/fees.h
index 15577d128a..7a293267d4 100644
--- a/src/policy/fees.h
+++ b/src/policy/fees.h
@@ -15,6 +15,7 @@
class CAutoFile;
class CFeeRate;
class CTxMemPoolEntry;
+class CTxMemPool;
/** \class CBlockPolicyEstimator
* The BlockPolicyEstimator is used for estimating the fee or priority needed
@@ -182,8 +183,8 @@ static const unsigned int MAX_BLOCK_CONFIRMS = 25;
/** Decay of .998 is a half-life of 346 blocks or about 2.4 days */
static const double DEFAULT_DECAY = .998;
-/** Require greater than 85% of X fee transactions to be confirmed within Y blocks for X to be big enough */
-static const double MIN_SUCCESS_PCT = .85;
+/** Require greater than 95% of X fee transactions to be confirmed within Y blocks for X to be big enough */
+static const double MIN_SUCCESS_PCT = .95;
static const double UNLIKELY_PCT = .5;
/** Require an avg of 1 tx in the combined fee bucket per block to have stat significance */
@@ -242,9 +243,21 @@ public:
/** Return a fee estimate */
CFeeRate estimateFee(int confTarget);
+ /** Estimate fee rate needed to get be included in a block within
+ * confTarget blocks. If no answer can be given at confTarget, return an
+ * estimate at the lowest target where one can be given.
+ */
+ CFeeRate estimateSmartFee(int confTarget, int *answerFoundAtTarget, const CTxMemPool& pool);
+
/** Return a priority estimate */
double estimatePriority(int confTarget);
+ /** Estimate priority needed to get be included in a block within
+ * confTarget blocks. If no answer can be given at confTarget, return an
+ * estimate at the lowest target where one can be given.
+ */
+ double estimateSmartPriority(int confTarget, int *answerFoundAtTarget, const CTxMemPool& pool);
+
/** Write estimation data to a file */
void Write(CAutoFile& fileout);
diff --git a/src/policy/policy.cpp b/src/policy/policy.cpp
index 4c96fbf5a5..46c7f18942 100644
--- a/src/policy/policy.cpp
+++ b/src/policy/policy.cpp
@@ -50,7 +50,7 @@ bool IsStandard(const CScript& scriptPubKey, txnouttype& whichType)
if (m < 1 || m > n)
return false;
} else if (whichType == TX_NULL_DATA &&
- (!GetBoolArg("-datacarrier", true) || scriptPubKey.size() > nMaxDatacarrierBytes))
+ (!fAcceptDatacarrier || scriptPubKey.size() > nMaxDatacarrierBytes))
return false;
return whichType != TX_NONSTANDARD;
diff --git a/src/policy/policy.h b/src/policy/policy.h
index f269e8d476..c8d2c1a924 100644
--- a/src/policy/policy.h
+++ b/src/policy/policy.h
@@ -25,6 +25,8 @@ static const unsigned int MAX_STANDARD_TX_SIZE = 100000;
static const unsigned int MAX_P2SH_SIGOPS = 15;
/** The maximum number of sigops we're willing to relay/mine in a single tx */
static const unsigned int MAX_STANDARD_TX_SIGOPS = MAX_BLOCK_SIGOPS/5;
+/** Default for -maxmempool, maximum megabytes of mempool memory usage */
+static const unsigned int DEFAULT_MAX_MEMPOOL_SIZE = 300;
/**
* Standard script verification flags that standard transactions will comply
* with. However scripts violating these flags may still be present in valid
diff --git a/src/primitives/block.cpp b/src/primitives/block.cpp
index 7a58074d24..7280c18f77 100644
--- a/src/primitives/block.cpp
+++ b/src/primitives/block.cpp
@@ -15,69 +15,6 @@ uint256 CBlockHeader::GetHash() const
return SerializeHash(*this);
}
-uint256 CBlock::ComputeMerkleRoot(bool* fMutated) const
-{
- /* WARNING! If you're reading this because you're learning about crypto
- and/or designing a new system that will use merkle trees, keep in mind
- that the following merkle tree algorithm has a serious flaw related to
- duplicate txids, resulting in a vulnerability (CVE-2012-2459).
-
- The reason is that if the number of hashes in the list at a given time
- is odd, the last one is duplicated before computing the next level (which
- is unusual in Merkle trees). This results in certain sequences of
- transactions leading to the same merkle root. For example, these two
- trees:
-
- A A
- / \ / \
- B C B C
- / \ | / \ / \
- D E F D E F F
- / \ / \ / \ / \ / \ / \ / \
- 1 2 3 4 5 6 1 2 3 4 5 6 5 6
-
- for transaction lists [1,2,3,4,5,6] and [1,2,3,4,5,6,5,6] (where 5 and
- 6 are repeated) result in the same root hash A (because the hash of both
- of (F) and (F,F) is C).
-
- The vulnerability results from being able to send a block with such a
- transaction list, with the same merkle root, and the same block hash as
- the original without duplication, resulting in failed validation. If the
- receiving node proceeds to mark that block as permanently invalid
- however, it will fail to accept further unmodified (and thus potentially
- valid) versions of the same block. We defend against this by detecting
- the case where we would hash two identical hashes at the end of the list
- together, and treating that identically to the block having an invalid
- merkle root. Assuming no double-SHA256 collisions, this will detect all
- known ways of changing the transactions without affecting the merkle
- root.
- */
- std::vector<uint256> vMerkleTree;
- vMerkleTree.reserve(vtx.size() * 2 + 16); // Safe upper bound for the number of total nodes.
- for (std::vector<CTransaction>::const_iterator it(vtx.begin()); it != vtx.end(); ++it)
- vMerkleTree.push_back(it->GetHash());
- int j = 0;
- bool mutated = false;
- for (int nSize = vtx.size(); nSize > 1; nSize = (nSize + 1) / 2)
- {
- for (int i = 0; i < nSize; i += 2)
- {
- int i2 = std::min(i+1, nSize-1);
- if (i2 == i + 1 && i2 + 1 == nSize && vMerkleTree[j+i] == vMerkleTree[j+i2]) {
- // Two identical hashes at the end of the list at a particular level.
- mutated = true;
- }
- vMerkleTree.push_back(Hash(BEGIN(vMerkleTree[j+i]), END(vMerkleTree[j+i]),
- BEGIN(vMerkleTree[j+i2]), END(vMerkleTree[j+i2])));
- }
- j += nSize;
- }
- if (fMutated) {
- *fMutated = mutated;
- }
- return (vMerkleTree.empty() ? uint256() : vMerkleTree.back());
-}
-
std::string CBlock::ToString() const
{
std::stringstream s;
diff --git a/src/primitives/block.h b/src/primitives/block.h
index 54731ff557..5c017d436f 100644
--- a/src/primitives/block.h
+++ b/src/primitives/block.h
@@ -118,12 +118,6 @@ public:
return block;
}
- // Build the merkle tree for this block and return the merkle root.
- // If non-NULL, *mutated is set to whether mutation was detected in the merkle
- // tree (a duplication of transactions in the block leading to an identical
- // merkle root).
- uint256 ComputeMerkleRoot(bool* mutated = NULL) const;
-
std::string ToString() const;
};
diff --git a/src/pubkey.cpp b/src/pubkey.cpp
index bdab137600..6ebb152c75 100644
--- a/src/pubkey.cpp
+++ b/src/pubkey.cpp
@@ -4,19 +4,184 @@
#include "pubkey.h"
-#include "eccryptoverify.h"
+#include <secp256k1.h>
+#include <secp256k1_recovery.h>
-#include "ecwrapper.h"
+namespace
+{
+/* Global secp256k1_context object used for verification. */
+secp256k1_context* secp256k1_context_verify = NULL;
+}
+
+/** This function is taken from the libsecp256k1 distribution and implements
+ * DER parsing for ECDSA signatures, while supporting an arbitrary subset of
+ * format violations.
+ *
+ * Supported violations include negative integers, excessive padding, garbage
+ * at the end, and overly long length descriptors. This is safe to use in
+ * Bitcoin because since the activation of BIP66, signatures are verified to be
+ * strict DER before being passed to this module, and we know it supports all
+ * violations present in the blockchain before that point.
+ */
+static int ecdsa_signature_parse_der_lax(const secp256k1_context* ctx, secp256k1_ecdsa_signature* sig, const unsigned char *input, size_t inputlen) {
+ size_t rpos, rlen, spos, slen;
+ size_t pos = 0;
+ size_t lenbyte;
+ unsigned char tmpsig[64] = {0};
+ int overflow = 0;
+
+ /* Hack to initialize sig with a correctly-parsed but invalid signature. */
+ secp256k1_ecdsa_signature_parse_compact(ctx, sig, tmpsig);
+
+ /* Sequence tag byte */
+ if (pos == inputlen || input[pos] != 0x30) {
+ return 0;
+ }
+ pos++;
+
+ /* Sequence length bytes */
+ if (pos == inputlen) {
+ return 0;
+ }
+ lenbyte = input[pos++];
+ if (lenbyte & 0x80) {
+ lenbyte -= 0x80;
+ if (pos + lenbyte > inputlen) {
+ return 0;
+ }
+ pos += lenbyte;
+ }
+
+ /* Integer tag byte for R */
+ if (pos == inputlen || input[pos] != 0x02) {
+ return 0;
+ }
+ pos++;
+
+ /* Integer length for R */
+ if (pos == inputlen) {
+ return 0;
+ }
+ lenbyte = input[pos++];
+ if (lenbyte & 0x80) {
+ lenbyte -= 0x80;
+ if (pos + lenbyte > inputlen) {
+ return 0;
+ }
+ while (lenbyte > 0 && input[pos] == 0) {
+ pos++;
+ lenbyte--;
+ }
+ if (lenbyte >= sizeof(size_t)) {
+ return 0;
+ }
+ rlen = 0;
+ while (lenbyte > 0) {
+ rlen = (rlen << 8) + input[pos];
+ pos++;
+ lenbyte--;
+ }
+ } else {
+ rlen = lenbyte;
+ }
+ if (rlen > inputlen - pos) {
+ return 0;
+ }
+ rpos = pos;
+ pos += rlen;
+
+ /* Integer tag byte for S */
+ if (pos == inputlen || input[pos] != 0x02) {
+ return 0;
+ }
+ pos++;
+
+ /* Integer length for S */
+ if (pos == inputlen) {
+ return 0;
+ }
+ lenbyte = input[pos++];
+ if (lenbyte & 0x80) {
+ lenbyte -= 0x80;
+ if (pos + lenbyte > inputlen) {
+ return 0;
+ }
+ while (lenbyte > 0 && input[pos] == 0) {
+ pos++;
+ lenbyte--;
+ }
+ if (lenbyte >= sizeof(size_t)) {
+ return 0;
+ }
+ slen = 0;
+ while (lenbyte > 0) {
+ slen = (slen << 8) + input[pos];
+ pos++;
+ lenbyte--;
+ }
+ } else {
+ slen = lenbyte;
+ }
+ if (slen > inputlen - pos) {
+ return 0;
+ }
+ spos = pos;
+ pos += slen;
+
+ /* Ignore leading zeroes in R */
+ while (rlen > 0 && input[rpos] == 0) {
+ rlen--;
+ rpos++;
+ }
+ /* Copy R value */
+ if (rlen > 32) {
+ overflow = 1;
+ } else {
+ memcpy(tmpsig + 32 - rlen, input + rpos, rlen);
+ }
+
+ /* Ignore leading zeroes in S */
+ while (slen > 0 && input[spos] == 0) {
+ slen--;
+ spos++;
+ }
+ /* Copy S value */
+ if (slen > 32) {
+ overflow = 1;
+ } else {
+ memcpy(tmpsig + 64 - slen, input + spos, slen);
+ }
+
+ if (!overflow) {
+ overflow = !secp256k1_ecdsa_signature_parse_compact(ctx, sig, tmpsig);
+ }
+ if (overflow) {
+ /* Overwrite the result again with a correctly-parsed but invalid
+ signature if parsing failed. */
+ memset(tmpsig, 0, 64);
+ secp256k1_ecdsa_signature_parse_compact(ctx, sig, tmpsig);
+ }
+ return 1;
+}
bool CPubKey::Verify(const uint256 &hash, const std::vector<unsigned char>& vchSig) const {
if (!IsValid())
return false;
- CECKey key;
- if (!key.SetPubKey(begin(), size()))
+ secp256k1_pubkey pubkey;
+ secp256k1_ecdsa_signature sig;
+ if (!secp256k1_ec_pubkey_parse(secp256k1_context_verify, &pubkey, &(*this)[0], size())) {
return false;
- if (!key.Verify(hash, vchSig))
+ }
+ if (vchSig.size() == 0) {
return false;
- return true;
+ }
+ if (!ecdsa_signature_parse_der_lax(secp256k1_context_verify, &sig, &vchSig[0], vchSig.size())) {
+ return false;
+ }
+ /* libsecp256k1's ECDSA verification requires lower-S signatures, which have
+ * not historically been enforced in Bitcoin, so normalize them first. */
+ secp256k1_ecdsa_signature_normalize(secp256k1_context_verify, &sig, &sig);
+ return secp256k1_ecdsa_verify(secp256k1_context_verify, &sig, hash.begin(), &pubkey);
}
bool CPubKey::RecoverCompact(const uint256 &hash, const std::vector<unsigned char>& vchSig) {
@@ -24,33 +189,39 @@ bool CPubKey::RecoverCompact(const uint256 &hash, const std::vector<unsigned cha
return false;
int recid = (vchSig[0] - 27) & 3;
bool fComp = ((vchSig[0] - 27) & 4) != 0;
- CECKey key;
- if (!key.Recover(hash, &vchSig[1], recid))
+ secp256k1_pubkey pubkey;
+ secp256k1_ecdsa_recoverable_signature sig;
+ if (!secp256k1_ecdsa_recoverable_signature_parse_compact(secp256k1_context_verify, &sig, &vchSig[1], recid)) {
return false;
- std::vector<unsigned char> pubkey;
- key.GetPubKey(pubkey, fComp);
- Set(pubkey.begin(), pubkey.end());
+ }
+ if (!secp256k1_ecdsa_recover(secp256k1_context_verify, &pubkey, &sig, hash.begin())) {
+ return false;
+ }
+ unsigned char pub[65];
+ size_t publen = 65;
+ secp256k1_ec_pubkey_serialize(secp256k1_context_verify, pub, &publen, &pubkey, fComp ? SECP256K1_EC_COMPRESSED : SECP256K1_EC_UNCOMPRESSED);
+ Set(pub, pub + publen);
return true;
}
bool CPubKey::IsFullyValid() const {
if (!IsValid())
return false;
- CECKey key;
- if (!key.SetPubKey(begin(), size()))
- return false;
- return true;
+ secp256k1_pubkey pubkey;
+ return secp256k1_ec_pubkey_parse(secp256k1_context_verify, &pubkey, &(*this)[0], size());
}
bool CPubKey::Decompress() {
if (!IsValid())
return false;
- CECKey key;
- if (!key.SetPubKey(begin(), size()))
+ secp256k1_pubkey pubkey;
+ if (!secp256k1_ec_pubkey_parse(secp256k1_context_verify, &pubkey, &(*this)[0], size())) {
return false;
- std::vector<unsigned char> pubkey;
- key.GetPubKey(pubkey, false);
- Set(pubkey.begin(), pubkey.end());
+ }
+ unsigned char pub[65];
+ size_t publen = 65;
+ secp256k1_ec_pubkey_serialize(secp256k1_context_verify, pub, &publen, &pubkey, SECP256K1_EC_UNCOMPRESSED);
+ Set(pub, pub + publen);
return true;
}
@@ -61,13 +232,18 @@ bool CPubKey::Derive(CPubKey& pubkeyChild, ChainCode &ccChild, unsigned int nChi
unsigned char out[64];
BIP32Hash(cc, nChild, *begin(), begin()+1, out);
memcpy(ccChild.begin(), out+32, 32);
- CECKey key;
- bool ret = key.SetPubKey(begin(), size());
- ret &= key.TweakPublic(out);
- std::vector<unsigned char> pubkey;
- key.GetPubKey(pubkey, true);
- pubkeyChild.Set(pubkey.begin(), pubkey.end());
- return ret;
+ secp256k1_pubkey pubkey;
+ if (!secp256k1_ec_pubkey_parse(secp256k1_context_verify, &pubkey, &(*this)[0], size())) {
+ return false;
+ }
+ if (!secp256k1_ec_pubkey_tweak_add(secp256k1_context_verify, &pubkey, out)) {
+ return false;
+ }
+ unsigned char pub[33];
+ size_t publen = 33;
+ secp256k1_ec_pubkey_serialize(secp256k1_context_verify, pub, &publen, &pubkey, SECP256K1_EC_COMPRESSED);
+ pubkeyChild.Set(pub, pub + publen);
+ return true;
}
void CExtPubKey::Encode(unsigned char code[74]) const {
@@ -95,3 +271,33 @@ bool CExtPubKey::Derive(CExtPubKey &out, unsigned int nChild) const {
out.nChild = nChild;
return pubkey.Derive(out.pubkey, out.chaincode, nChild, chaincode);
}
+
+/* static */ bool CPubKey::CheckLowS(const std::vector<unsigned char>& vchSig) {
+ secp256k1_ecdsa_signature sig;
+ if (!ecdsa_signature_parse_der_lax(secp256k1_context_verify, &sig, &vchSig[0], vchSig.size())) {
+ return false;
+ }
+ return (!secp256k1_ecdsa_signature_normalize(secp256k1_context_verify, NULL, &sig));
+}
+
+/* static */ int ECCVerifyHandle::refcount = 0;
+
+ECCVerifyHandle::ECCVerifyHandle()
+{
+ if (refcount == 0) {
+ assert(secp256k1_context_verify == NULL);
+ secp256k1_context_verify = secp256k1_context_create(SECP256K1_CONTEXT_VERIFY);
+ assert(secp256k1_context_verify != NULL);
+ }
+ refcount++;
+}
+
+ECCVerifyHandle::~ECCVerifyHandle()
+{
+ refcount--;
+ if (refcount == 0) {
+ assert(secp256k1_context_verify != NULL);
+ secp256k1_context_destroy(secp256k1_context_verify);
+ secp256k1_context_verify = NULL;
+ }
+}
diff --git a/src/pubkey.h b/src/pubkey.h
index cce9c826e5..a1d437e706 100644
--- a/src/pubkey.h
+++ b/src/pubkey.h
@@ -177,6 +177,11 @@ public:
*/
bool Verify(const uint256& hash, const std::vector<unsigned char>& vchSig) const;
+ /**
+ * Check whether a signature is normalized (lower-S).
+ */
+ static bool CheckLowS(const std::vector<unsigned char>& vchSig);
+
//! Recover a public key from a compact signature.
bool RecoverCompact(const uint256& hash, const std::vector<unsigned char>& vchSig);
@@ -205,4 +210,15 @@ struct CExtPubKey {
bool Derive(CExtPubKey& out, unsigned int nChild) const;
};
+/** Users of this module must hold an ECCVerifyHandle. The constructor and
+ * destructor of these are not allowed to run in parallel, though. */
+class ECCVerifyHandle
+{
+ static int refcount;
+
+public:
+ ECCVerifyHandle();
+ ~ECCVerifyHandle();
+};
+
#endif // BITCOIN_PUBKEY_H
diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp
index bda8acff15..6e6330d2a4 100644
--- a/src/qt/bitcoin.cpp
+++ b/src/qt/bitcoin.cpp
@@ -201,8 +201,10 @@ public:
/// Create payment server
void createPaymentServer();
#endif
+ /// parameter interaction/setup based on rules
+ void parameterSetup();
/// Create options model
- void createOptionsModel();
+ void createOptionsModel(bool resetSettings);
/// Create main window
void createWindow(const NetworkStyle *networkStyle);
/// Create splash screen
@@ -309,14 +311,8 @@ BitcoinApplication::BitcoinApplication(int &argc, char **argv):
// UI per-platform customization
// This must be done inside the BitcoinApplication constructor, or after it, because
// PlatformStyle::instantiate requires a QApplication
-#if defined(Q_OS_MAC)
- std::string platformName = "macosx";
-#elif defined(Q_OS_WIN)
- std::string platformName = "windows";
-#else
- std::string platformName = "other";
-#endif
- platformName = GetArg("-uiplatform", platformName);
+ std::string platformName;
+ platformName = GetArg("-uiplatform", BitcoinGUI::DEFAULT_UIPLATFORM);
platformStyle = PlatformStyle::instantiate(QString::fromStdString(platformName));
if (!platformStyle) // Fall back to "other" if specified name not found
platformStyle = PlatformStyle::instantiate("other");
@@ -352,9 +348,9 @@ void BitcoinApplication::createPaymentServer()
}
#endif
-void BitcoinApplication::createOptionsModel()
+void BitcoinApplication::createOptionsModel(bool resetSettings)
{
- optionsModel = new OptionsModel();
+ optionsModel = new OptionsModel(NULL, resetSettings);
}
void BitcoinApplication::createWindow(const NetworkStyle *networkStyle)
@@ -397,6 +393,12 @@ void BitcoinApplication::startThread()
coreThread->start();
}
+void BitcoinApplication::parameterSetup()
+{
+ InitLogging();
+ InitParameterInteraction();
+}
+
void BitcoinApplication::requestInitialize()
{
qDebug() << __func__ << ": Requesting initialize";
@@ -644,13 +646,15 @@ int main(int argc, char *argv[])
// Install qDebug() message handler to route to debug.log
qInstallMessageHandler(DebugMessageHandler);
#endif
+ // Allow parameter interaction before we create the options model
+ app.parameterSetup();
// Load GUI settings from QSettings
- app.createOptionsModel();
+ app.createOptionsModel(mapArgs.count("-resetguisettings") != 0);
// Subscribe to global signals from core
uiInterface.InitMessage.connect(InitMessage);
- if (GetBoolArg("-splash", true) && !GetBoolArg("-min", false))
+ if (GetBoolArg("-splash", DEFAULT_SPLASHSCREEN) && !GetBoolArg("-min", false))
app.createSplashScreen(networkStyle.data());
try
diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp
index d930d15953..b2bd167aea 100644
--- a/src/qt/bitcoingui.cpp
+++ b/src/qt/bitcoingui.cpp
@@ -44,6 +44,7 @@
#include <QProgressBar>
#include <QProgressDialog>
#include <QSettings>
+#include <QShortcut>
#include <QStackedWidget>
#include <QStatusBar>
#include <QStyle>
@@ -58,6 +59,16 @@
#include <QUrlQuery>
#endif
+const std::string BitcoinGUI::DEFAULT_UIPLATFORM =
+#if defined(Q_OS_MAC)
+ "macosx"
+#elif defined(Q_OS_WIN)
+ "windows"
+#else
+ "other"
+#endif
+ ;
+
const QString BitcoinGUI::DEFAULT_WALLET = "~Default";
BitcoinGUI::BitcoinGUI(const PlatformStyle *platformStyle, const NetworkStyle *networkStyle, QWidget *parent) :
@@ -364,6 +375,9 @@ void BitcoinGUI::createActions()
connect(openAction, SIGNAL(triggered()), this, SLOT(openClicked()));
}
#endif // ENABLE_WALLET
+
+ new QShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_C), this, SLOT(showDebugWindowActivateConsole()));
+ new QShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_D), this, SLOT(showDebugWindow()));
}
void BitcoinGUI::createMenuBar()
@@ -439,8 +453,8 @@ void BitcoinGUI::setClientModel(ClientModel *clientModel)
setNumConnections(clientModel->getNumConnections());
connect(clientModel, SIGNAL(numConnectionsChanged(int)), this, SLOT(setNumConnections(int)));
- setNumBlocks(clientModel->getNumBlocks(), clientModel->getLastBlockDate());
- connect(clientModel, SIGNAL(numBlocksChanged(int,QDateTime)), this, SLOT(setNumBlocks(int,QDateTime)));
+ setNumBlocks(clientModel->getNumBlocks(), clientModel->getLastBlockDate(), clientModel->getVerificationProgress(NULL));
+ connect(clientModel, SIGNAL(numBlocksChanged(int,QDateTime,double)), this, SLOT(setNumBlocks(int,QDateTime,double)));
// Receive and report messages from client model
connect(clientModel, SIGNAL(message(QString,QString,unsigned int)), this, SLOT(message(QString,QString,unsigned int)));
@@ -597,6 +611,12 @@ void BitcoinGUI::showDebugWindow()
rpcConsole->activateWindow();
}
+void BitcoinGUI::showDebugWindowActivateConsole()
+{
+ rpcConsole->setTabFocus(RPCConsole::TAB_CONSOLE);
+ showDebugWindow();
+}
+
void BitcoinGUI::showHelpMessageClicked()
{
helpMessageDialog->show();
@@ -662,7 +682,7 @@ void BitcoinGUI::setNumConnections(int count)
labelConnectionsIcon->setToolTip(tr("%n active connection(s) to Bitcoin network", "", count));
}
-void BitcoinGUI::setNumBlocks(int count, const QDateTime& blockDate)
+void BitcoinGUI::setNumBlocks(int count, const QDateTime& blockDate, double nVerificationProgress)
{
if(!clientModel)
return;
@@ -739,7 +759,7 @@ void BitcoinGUI::setNumBlocks(int count, const QDateTime& blockDate)
progressBarLabel->setVisible(true);
progressBar->setFormat(tr("%1 behind").arg(timeBehindText));
progressBar->setMaximum(1000000000);
- progressBar->setValue(clientModel->getVerificationProgress() * 1000000000.0 + 0.5);
+ progressBar->setValue(nVerificationProgress * 1000000000.0 + 0.5);
progressBar->setVisible(true);
tooltip = tr("Catching up...") + QString("<br>") + tooltip;
diff --git a/src/qt/bitcoingui.h b/src/qt/bitcoingui.h
index 717f2bd12d..b121a443e7 100644
--- a/src/qt/bitcoingui.h
+++ b/src/qt/bitcoingui.h
@@ -48,6 +48,7 @@ class BitcoinGUI : public QMainWindow
public:
static const QString DEFAULT_WALLET;
+ static const std::string DEFAULT_UIPLATFORM;
explicit BitcoinGUI(const PlatformStyle *platformStyle, const NetworkStyle *networkStyle, QWidget *parent = 0);
~BitcoinGUI();
@@ -149,7 +150,7 @@ public Q_SLOTS:
/** Set number of connections shown in the UI */
void setNumConnections(int count);
/** Set number of blocks and last block date shown in the UI */
- void setNumBlocks(int count, const QDateTime& blockDate);
+ void setNumBlocks(int count, const QDateTime& blockDate, double nVerificationProgress);
/** Notify the user of an event from the core network or transaction handling code.
@param[in] title the message box / notification title
@@ -198,6 +199,8 @@ private Q_SLOTS:
void aboutClicked();
/** Show debug window */
void showDebugWindow();
+ /** Show debug window and set focus to the console */
+ void showDebugWindowActivateConsole();
/** Show help message dialog */
void showHelpMessageClicked();
#ifndef Q_OS_MAC
diff --git a/src/qt/bitcoinstrings.cpp b/src/qt/bitcoinstrings.cpp
index 01e93d786a..2449046538 100644
--- a/src/qt/bitcoinstrings.cpp
+++ b/src/qt/bitcoinstrings.cpp
@@ -188,7 +188,9 @@ QT_TRANSLATE_NOOP("bitcoin-core", "Activating best chain..."),
QT_TRANSLATE_NOOP("bitcoin-core", "Add a node to connect to and attempt to keep the connection open"),
QT_TRANSLATE_NOOP("bitcoin-core", "Allow DNS lookups for -addnode, -seednode and -connect"),
QT_TRANSLATE_NOOP("bitcoin-core", "Always query for peer addresses via DNS lookup (default: %u)"),
+QT_TRANSLATE_NOOP("bitcoin-core", "Always relay transactions received from whitelisted peers (default: %d)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Attempt to recover private keys from a corrupt wallet.dat on startup"),
+QT_TRANSLATE_NOOP("bitcoin-core", "Automatically create Tor hidden service (default: %d)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Block creation options:"),
QT_TRANSLATE_NOOP("bitcoin-core", "Cannot downgrade wallet"),
QT_TRANSLATE_NOOP("bitcoin-core", "Cannot resolve -bind address: '%s'"),
@@ -295,6 +297,8 @@ QT_TRANSLATE_NOOP("bitcoin-core", "The transaction amount is too small to pay th
QT_TRANSLATE_NOOP("bitcoin-core", "This help message"),
QT_TRANSLATE_NOOP("bitcoin-core", "This is experimental software."),
QT_TRANSLATE_NOOP("bitcoin-core", "Threshold for disconnecting misbehaving peers (default: %u)"),
+QT_TRANSLATE_NOOP("bitcoin-core", "Tor control port password (default: empty)"),
+QT_TRANSLATE_NOOP("bitcoin-core", "Tor control port to use if onion listening enabled (default: %s)"),
QT_TRANSLATE_NOOP("bitcoin-core", "Transaction amount too small"),
QT_TRANSLATE_NOOP("bitcoin-core", "Transaction amounts must be positive"),
QT_TRANSLATE_NOOP("bitcoin-core", "Transaction too large for fee policy"),
@@ -317,6 +321,7 @@ QT_TRANSLATE_NOOP("bitcoin-core", "Wallet needed to be rewritten: restart Bitcoi
QT_TRANSLATE_NOOP("bitcoin-core", "Wallet options:"),
QT_TRANSLATE_NOOP("bitcoin-core", "Warning"),
QT_TRANSLATE_NOOP("bitcoin-core", "Warning: This version is obsolete; upgrade required!"),
+QT_TRANSLATE_NOOP("bitcoin-core", "Whether to operate in a blocks only mode (default: %u)"),
QT_TRANSLATE_NOOP("bitcoin-core", "You need to rebuild the database using -reindex to change -txindex"),
QT_TRANSLATE_NOOP("bitcoin-core", "Zapping all transactions from wallet..."),
QT_TRANSLATE_NOOP("bitcoin-core", "ZeroMQ notification options:"),
diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp
index 0900a35cc4..d36d129c1a 100644
--- a/src/qt/clientmodel.cpp
+++ b/src/qt/clientmodel.cpp
@@ -13,6 +13,7 @@
#include "checkpoints.h"
#include "clientversion.h"
#include "net.h"
+#include "txmempool.h"
#include "ui_interface.h"
#include "util.h"
@@ -21,17 +22,16 @@
#include <QDebug>
#include <QTimer>
+class CBlockIndex;
+
static const int64_t nClientStartupTime = GetTime();
+static int64_t nLastBlockTipUpdateNotification = 0;
ClientModel::ClientModel(OptionsModel *optionsModel, QObject *parent) :
QObject(parent),
optionsModel(optionsModel),
peerTableModel(0),
banTableModel(0),
- cachedNumBlocks(0),
- cachedBlockDate(QDateTime()),
- cachedReindexing(0),
- cachedImporting(0),
pollTimer(0)
{
peerTableModel = new PeerTableModel(this);
@@ -88,40 +88,32 @@ QDateTime ClientModel::getLastBlockDate() const
return QDateTime::fromTime_t(Params().GenesisBlock().GetBlockTime()); // Genesis block's time of current network
}
-double ClientModel::getVerificationProgress() const
+long ClientModel::getMempoolSize() const
{
- LOCK(cs_main);
- return Checkpoints::GuessVerificationProgress(Params().Checkpoints(), chainActive.Tip());
+ return mempool.size();
}
-void ClientModel::updateTimer()
+size_t ClientModel::getMempoolDynamicUsage() const
{
- // Get required lock upfront. This avoids the GUI from getting stuck on
- // periodical polls if the core is holding the locks for a longer time -
- // for example, during a wallet rescan.
- TRY_LOCK(cs_main, lockMain);
- if (!lockMain)
- return;
-
- // Some quantities (such as number of blocks) change so fast that we don't want to be notified for each change.
- // Periodically check and update with a timer.
- int newNumBlocks = getNumBlocks();
- QDateTime newBlockDate = getLastBlockDate();
-
- // check for changed number of blocks we have, number of blocks peers claim to have, reindexing state and importing state
- if (cachedNumBlocks != newNumBlocks ||
- cachedBlockDate != newBlockDate ||
- cachedReindexing != fReindex ||
- cachedImporting != fImporting)
- {
- cachedNumBlocks = newNumBlocks;
- cachedBlockDate = newBlockDate;
- cachedReindexing = fReindex;
- cachedImporting = fImporting;
+ return mempool.DynamicMemoryUsage();
+}
- Q_EMIT numBlocksChanged(newNumBlocks, newBlockDate);
+double ClientModel::getVerificationProgress(const CBlockIndex *tipIn) const
+{
+ CBlockIndex *tip = const_cast<CBlockIndex *>(tipIn);
+ if (!tip)
+ {
+ LOCK(cs_main);
+ tip = chainActive.Tip();
}
+ return Checkpoints::GuessVerificationProgress(Params().Checkpoints(), tip);
+}
+void ClientModel::updateTimer()
+{
+ // no locking required at this point
+ // the following calls will aquire the required lock
+ Q_EMIT mempoolSizeChanged(getMempoolSize(), getMempoolDynamicUsage());
Q_EMIT bytesChanged(getTotalBytesRecv(), getTotalBytesSent());
}
@@ -249,6 +241,23 @@ static void BannedListChanged(ClientModel *clientmodel)
QMetaObject::invokeMethod(clientmodel, "updateBanlist", Qt::QueuedConnection);
}
+static void BlockTipChanged(ClientModel *clientmodel, bool initialSync, const CBlockIndex *pIndex)
+{
+ // lock free async UI updates in case we have a new block tip
+ // during initial sync, only update the UI if the last update
+ // was > 250ms (MODEL_UPDATE_DELAY) ago
+ int64_t now = 0;
+ if (initialSync)
+ now = GetTimeMillis();
+
+ // if we are in-sync, update the UI regardless of last update time
+ if (!initialSync || now - nLastBlockTipUpdateNotification > MODEL_UPDATE_DELAY) {
+ //pass a async signal to the UI thread
+ Q_EMIT clientmodel->numBlocksChanged(pIndex->nHeight, QDateTime::fromTime_t(pIndex->GetBlockTime()), clientmodel->getVerificationProgress(pIndex));
+ nLastBlockTipUpdateNotification = now;
+ }
+}
+
void ClientModel::subscribeToCoreSignals()
{
// Connect signals to client
@@ -256,6 +265,7 @@ void ClientModel::subscribeToCoreSignals()
uiInterface.NotifyNumConnectionsChanged.connect(boost::bind(NotifyNumConnectionsChanged, this, _1));
uiInterface.NotifyAlertChanged.connect(boost::bind(NotifyAlertChanged, this, _1, _2));
uiInterface.BannedListChanged.connect(boost::bind(BannedListChanged, this));
+ uiInterface.NotifyBlockTip.connect(boost::bind(BlockTipChanged, this, _1, _2));
}
void ClientModel::unsubscribeFromCoreSignals()
@@ -265,4 +275,5 @@ void ClientModel::unsubscribeFromCoreSignals()
uiInterface.NotifyNumConnectionsChanged.disconnect(boost::bind(NotifyNumConnectionsChanged, this, _1));
uiInterface.NotifyAlertChanged.disconnect(boost::bind(NotifyAlertChanged, this, _1, _2));
uiInterface.BannedListChanged.disconnect(boost::bind(BannedListChanged, this));
+ uiInterface.NotifyBlockTip.disconnect(boost::bind(BlockTipChanged, this, _1, _2));
}
diff --git a/src/qt/clientmodel.h b/src/qt/clientmodel.h
index 627bdf862d..2d204fdb67 100644
--- a/src/qt/clientmodel.h
+++ b/src/qt/clientmodel.h
@@ -15,6 +15,7 @@ class PeerTableModel;
class TransactionTableModel;
class CWallet;
+class CBlockIndex;
QT_BEGIN_NAMESPACE
class QTimer;
@@ -51,10 +52,15 @@ public:
int getNumConnections(unsigned int flags = CONNECTIONS_ALL) const;
int getNumBlocks() const;
+ //! Return number of transactions in the mempool
+ long getMempoolSize() const;
+ //! Return the dynamic memory usage of the mempool
+ size_t getMempoolDynamicUsage() const;
+
quint64 getTotalBytesRecv() const;
quint64 getTotalBytesSent() const;
- double getVerificationProgress() const;
+ double getVerificationProgress(const CBlockIndex *tip) const;
QDateTime getLastBlockDate() const;
//! Return true if core is doing initial block download
@@ -76,11 +82,6 @@ private:
PeerTableModel *peerTableModel;
BanTableModel *banTableModel;
- int cachedNumBlocks;
- QDateTime cachedBlockDate;
- bool cachedReindexing;
- bool cachedImporting;
-
QTimer *pollTimer;
void subscribeToCoreSignals();
@@ -88,7 +89,8 @@ private:
Q_SIGNALS:
void numConnectionsChanged(int count);
- void numBlocksChanged(int count, const QDateTime& blockDate);
+ void numBlocksChanged(int count, const QDateTime& blockDate, double nVerificationProgress);
+ void mempoolSizeChanged(long count, size_t mempoolSizeInBytes);
void alertsChanged(const QString &warnings);
void bytesChanged(quint64 totalBytesIn, quint64 totalBytesOut);
diff --git a/src/qt/coincontroldialog.cpp b/src/qt/coincontroldialog.cpp
index 81b2597c3b..0f42243047 100644
--- a/src/qt/coincontroldialog.cpp
+++ b/src/qt/coincontroldialog.cpp
@@ -538,7 +538,7 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
nBytes = nBytesInputs + ((CoinControlDialog::payAmounts.size() > 0 ? CoinControlDialog::payAmounts.size() + 1 : 2) * 34) + 10; // always assume +1 output for change here
// Priority
- double mempoolEstimatePriority = mempool.estimatePriority(nTxConfirmTarget);
+ double mempoolEstimatePriority = mempool.estimateSmartPriority(nTxConfirmTarget);
dPriority = dPriorityInputs / (nBytes - nBytesInputs + (nQuantityUncompressed * 29)); // 29 = 180 - 151 (uncompressed public keys are over the limit. max 151 bytes of the input are ignored for priority)
sPriorityLabel = CoinControlDialog::getPriorityLabel(dPriority, mempoolEstimatePriority);
@@ -549,11 +549,12 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
// Fee
nPayFee = CWallet::GetMinimumFee(nBytes, nTxConfirmTarget, mempool);
+ if (nPayFee > 0 && coinControl->nMinimumTotalFee > nPayFee)
+ nPayFee = coinControl->nMinimumTotalFee;
- // Allow free?
- double dPriorityNeeded = mempoolEstimatePriority;
- if (dPriorityNeeded <= 0)
- dPriorityNeeded = AllowFreeThreshold(); // not enough data, back to hard-coded
+
+ // Allow free? (require at least hard-coded threshold and default to that if no estimate)
+ double dPriorityNeeded = std::max(mempoolEstimatePriority, AllowFreeThreshold());
fAllowFree = (dPriority >= dPriorityNeeded);
if (fSendFreeTransactions)
@@ -621,7 +622,7 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
l6->setText(sPriorityLabel); // Priority
l7->setText(fDust ? tr("yes") : tr("no")); // Dust
l8->setText(BitcoinUnits::formatWithUnit(nDisplayUnit, nChange)); // Change
- if (nPayFee > 0 && !(payTxFee.GetFeePerK() > 0 && fPayAtLeastCustomFee && nBytes < 1000))
+ if (nPayFee > 0 && (coinControl->nMinimumTotalFee < nPayFee))
{
l3->setText(ASYMP_UTF8 + l3->text());
l4->setText(ASYMP_UTF8 + l4->text());
@@ -649,8 +650,9 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
double dFeeVary;
if (payTxFee.GetFeePerK() > 0)
dFeeVary = (double)std::max(CWallet::GetRequiredFee(1000), payTxFee.GetFeePerK()) / 1000;
- else
- dFeeVary = (double)std::max(CWallet::GetRequiredFee(1000), mempool.estimateFee(nTxConfirmTarget).GetFeePerK()) / 1000;
+ else {
+ dFeeVary = (double)std::max(CWallet::GetRequiredFee(1000), mempool.estimateSmartFee(nTxConfirmTarget).GetFeePerK()) / 1000;
+ }
QString toolTip4 = tr("Can vary +/- %1 satoshi(s) per input.").arg(dFeeVary);
l3->setToolTip(toolTip4);
@@ -686,7 +688,7 @@ void CoinControlDialog::updateView()
QFlags<Qt::ItemFlag> flgTristate = Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsUserCheckable | Qt::ItemIsTristate;
int nDisplayUnit = model->getOptionsModel()->getDisplayUnit();
- double mempoolEstimatePriority = mempool.estimatePriority(nTxConfirmTarget);
+ double mempoolEstimatePriority = mempool.estimateSmartPriority(nTxConfirmTarget);
std::map<QString, std::vector<COutput> > mapCoins;
model->listCoins(mapCoins);
diff --git a/src/qt/forms/debugwindow.ui b/src/qt/forms/debugwindow.ui
index eb02dd80ff..2471470363 100644
--- a/src/qt/forms/debugwindow.ui
+++ b/src/qt/forms/debugwindow.ui
@@ -23,7 +23,7 @@
<attribute name="title">
<string>&amp;Information</string>
</attribute>
- <layout class="QGridLayout" name="gridLayout" columnstretch="0,1">
+ <layout class="QGridLayout" name="gridLayout" columnstretch="0,1,0">
<property name="horizontalSpacing">
<number>12</number>
</property>
@@ -47,7 +47,7 @@
</property>
</widget>
</item>
- <item row="1" column="1">
+ <item row="1" column="1" colspan="2">
<widget class="QLabel" name="clientName">
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
@@ -70,7 +70,7 @@
</property>
</widget>
</item>
- <item row="2" column="1">
+ <item row="2" column="1" colspan="2">
<widget class="QLabel" name="clientVersion">
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
@@ -96,7 +96,7 @@
</property>
</widget>
</item>
- <item row="3" column="1">
+ <item row="3" column="1" colspan="2">
<widget class="QLabel" name="clientUserAgent">
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
@@ -122,7 +122,7 @@
</property>
</widget>
</item>
- <item row="4" column="1">
+ <item row="4" column="1" colspan="2">
<widget class="QLabel" name="openSSLVersion">
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
@@ -148,7 +148,7 @@
</property>
</widget>
</item>
- <item row="5" column="1">
+ <item row="5" column="1" colspan="2">
<widget class="QLabel" name="berkeleyDBVersion">
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
@@ -171,7 +171,7 @@
</property>
</widget>
</item>
- <item row="6" column="1">
+ <item row="6" column="1" colspan="2">
<widget class="QLabel" name="buildDate">
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
@@ -194,7 +194,7 @@
</property>
</widget>
</item>
- <item row="7" column="1">
+ <item row="7" column="1" colspan="2">
<widget class="QLabel" name="startupTime">
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
@@ -210,19 +210,6 @@
</property>
</widget>
</item>
- <item row="8" column="0">
- <widget class="QLabel" name="label_11">
- <property name="font">
- <font>
- <weight>75</weight>
- <bold>true</bold>
- </font>
- </property>
- <property name="text">
- <string>Network</string>
- </property>
- </widget>
- </item>
<item row="9" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
@@ -230,7 +217,7 @@
</property>
</widget>
</item>
- <item row="9" column="1">
+ <item row="9" column="1" colspan="2">
<widget class="QLabel" name="networkName">
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
@@ -253,7 +240,7 @@
</property>
</widget>
</item>
- <item row="10" column="1">
+ <item row="10" column="1" colspan="2">
<widget class="QLabel" name="numberOfConnections">
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
@@ -289,7 +276,7 @@
</property>
</widget>
</item>
- <item row="12" column="1">
+ <item row="12" column="1" colspan="2">
<widget class="QLabel" name="numberOfBlocks">
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
@@ -306,13 +293,13 @@
</widget>
</item>
<item row="13" column="0">
- <widget class="QLabel" name="label_2">
+ <widget class="QLabel" name="labelLastBlockTime">
<property name="text">
<string>Last block time</string>
</property>
</widget>
</item>
- <item row="13" column="1">
+ <item row="13" column="1" colspan="2">
<widget class="QLabel" name="lastBlockTime">
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
@@ -329,20 +316,43 @@
</widget>
</item>
<item row="14" column="0">
- <spacer name="verticalSpacer_2">
- <property name="orientation">
- <enum>Qt::Vertical</enum>
+ <widget class="QLabel" name="labelMempoolTitle">
+ <property name="font">
+ <font>
+ <weight>75</weight>
+ <bold>true</bold>
+ </font>
</property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>20</width>
- <height>20</height>
- </size>
+ <property name="text">
+ <string>Memory Pool</string>
</property>
- </spacer>
+ </widget>
</item>
<item row="15" column="0">
- <widget class="QLabel" name="labelDebugLogfile">
+ <widget class="QLabel" name="labelNumberOfTransactions">
+ <property name="text">
+ <string>Current number of transactions</string>
+ </property>
+ </widget>
+ </item>
+ <item row="15" column="1">
+ <widget class="QLabel" name="mempoolNumberTxs">
+ <property name="cursor">
+ <cursorShape>IBeamCursor</cursorShape>
+ </property>
+ <property name="text">
+ <string>N/A</string>
+ </property>
+ <property name="textFormat">
+ <enum>Qt::PlainText</enum>
+ </property>
+ <property name="textInteractionFlags">
+ <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
+ </property>
+ </widget>
+ </item>
+ <item row="8" column="0">
+ <widget class="QLabel" name="labelNetwork">
<property name="font">
<font>
<weight>75</weight>
@@ -350,24 +360,74 @@
</font>
</property>
<property name="text">
- <string>Debug log file</string>
+ <string>Network</string>
</property>
</widget>
</item>
<item row="16" column="0">
- <widget class="QPushButton" name="openDebugLogfileButton">
- <property name="toolTip">
- <string>Open the Bitcoin Core debug log file from the current data directory. This can take a few seconds for large log files.</string>
+ <widget class="QLabel" name="labelMemoryUsage">
+ <property name="text">
+ <string>Memory usage</string>
+ </property>
+ </widget>
+ </item>
+ <item row="16" column="1">
+ <widget class="QLabel" name="mempoolSize">
+ <property name="cursor">
+ <cursorShape>IBeamCursor</cursorShape>
</property>
<property name="text">
- <string>&amp;Open</string>
+ <string>N/A</string>
</property>
- <property name="autoDefault">
- <bool>false</bool>
+ <property name="textFormat">
+ <enum>Qt::PlainText</enum>
+ </property>
+ <property name="textInteractionFlags">
+ <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
- <item row="17" column="0">
+ <item row="14" column="2" rowspan="3">
+ <layout class="QVBoxLayout" name="verticalLayoutDebugButton">
+ <property name="spacing">
+ <number>3</number>
+ </property>
+ <item>
+ <spacer name="verticalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>10</width>
+ <height>5</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QLabel" name="labelDebugLogfile">
+ <property name="text">
+ <string>Debug log file</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="openDebugLogfileButton">
+ <property name="toolTip">
+ <string>Open the Bitcoin Core debug log file from the current data directory. This can take a few seconds for large log files.</string>
+ </property>
+ <property name="text">
+ <string>&amp;Open</string>
+ </property>
+ <property name="autoDefault">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="18" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
diff --git a/src/qt/guiconstants.h b/src/qt/guiconstants.h
index 7d3e48ff32..216f23f139 100644
--- a/src/qt/guiconstants.h
+++ b/src/qt/guiconstants.h
@@ -14,6 +14,8 @@ static const int MAX_PASSPHRASE_SIZE = 1024;
/* BitcoinGUI -- Size of icons in status bar */
static const int STATUSBAR_ICONSIZE = 16;
+static const bool DEFAULT_SPLASHSCREEN = true;
+
/* Invalid field background style */
#define STYLE_INVALID "background:#FF8080"
diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp
index 845459b76a..6dce9370d7 100644
--- a/src/qt/guiutil.cpp
+++ b/src/qt/guiutil.cpp
@@ -681,7 +681,10 @@ boost::filesystem::path static GetAutostartDir()
boost::filesystem::path static GetAutostartFilePath()
{
- return GetAutostartDir() / "bitcoin.desktop";
+ std::string chain = ChainNameFromCommandLine();
+ if (chain == CBaseChainParams::MAIN)
+ return GetAutostartDir() / "bitcoin.desktop";
+ return GetAutostartDir() / strprintf("bitcoin-%s.lnk", chain);
}
bool GetStartOnSystemStartup()
diff --git a/src/qt/intro.cpp b/src/qt/intro.cpp
index 4ab87e0f32..ab63e98d40 100644
--- a/src/qt/intro.cpp
+++ b/src/qt/intro.cpp
@@ -162,7 +162,7 @@ void Intro::pickDataDirectory()
/* 2) Allow QSettings to override default dir */
dataDir = settings.value("strDataDir", dataDir).toString();
- if(!fs::exists(GUIUtil::qstringToBoostPath(dataDir)) || GetBoolArg("-choosedatadir", false))
+ if(!fs::exists(GUIUtil::qstringToBoostPath(dataDir)) || GetBoolArg("-choosedatadir", DEFAULT_CHOOSE_DATADIR))
{
/* If current default data directory does not exist, let the user choose one */
Intro intro;
diff --git a/src/qt/intro.h b/src/qt/intro.h
index 50783f7225..1d49922e93 100644
--- a/src/qt/intro.h
+++ b/src/qt/intro.h
@@ -9,6 +9,8 @@
#include <QMutex>
#include <QThread>
+static const bool DEFAULT_CHOOSE_DATADIR = false;
+
class FreespaceChecker;
namespace Ui {
diff --git a/src/qt/locale/bitcoin_ar.ts b/src/qt/locale/bitcoin_ar.ts
index f70196140c..8a54f15791 100644
--- a/src/qt/locale/bitcoin_ar.ts
+++ b/src/qt/locale/bitcoin_ar.ts
@@ -1690,10 +1690,6 @@
<translation>تحذير</translation>
</message>
<message>
- <source>Upgrade wallet to latest format</source>
- <translation>تحديث المحفظة للنسخة الاخيرة</translation>
- </message>
- <message>
<source>This help message</source>
<translation>رسالة المساعدة هذه</translation>
</message>
diff --git a/src/qt/locale/bitcoin_be_BY.ts b/src/qt/locale/bitcoin_be_BY.ts
index 57dd9c3611..c1efc822ec 100644
--- a/src/qt/locale/bitcoin_be_BY.ts
+++ b/src/qt/locale/bitcoin_be_BY.ts
@@ -1424,10 +1424,6 @@
<translation>Опцыі гаманца:</translation>
</message>
<message>
- <source>Imports blocks from external blk000??.dat file</source>
- <translation>Імпартаванне блокаў з вонкавага blk000??.dat файла</translation>
- </message>
- <message>
<source>Activating best chain...</source>
<translation>Актывацыя лепшага ланцуга...</translation>
</message>
@@ -1480,14 +1476,6 @@
<translation>Выканаць каманду калі лепшы блок зменіцца (%s замяняецца на хэш блока)</translation>
</message>
<message>
- <source>Upgrade wallet to latest format</source>
- <translation>Абнавіць гаманец на новы фармат</translation>
- </message>
- <message>
- <source>Rescan the block chain for missing wallet transactions</source>
- <translation>Перасканаваць ланцуг блокаў дзеля пошуку адсутных транзакцый</translation>
- </message>
- <message>
<source>Loading addresses...</source>
<translation>Загружаем адрасы...</translation>
</message>
diff --git a/src/qt/locale/bitcoin_bg.ts b/src/qt/locale/bitcoin_bg.ts
index d2db8a196c..8496a33481 100644
--- a/src/qt/locale/bitcoin_bg.ts
+++ b/src/qt/locale/bitcoin_bg.ts
@@ -168,6 +168,10 @@
<translation>Наистина ли желаете да шифрирате портфейла си?</translation>
</message>
<message>
+ <source>Bitcoin Core will close now to finish the encryption process. Remember that encrypting your wallet cannot fully protect your bitcoins from being stolen by malware infecting your computer.</source>
+ <translation>Биткоин сега ще се затоври за да завърши процеса на криптиране. Запомнете, че криптирането на вашия портефейл не може напълно да предпази вашите монети от кражба чрез зловреден софтуер, инфектирал вашия компютър</translation>
+ </message>
+ <message>
<source>IMPORTANT: Any previous backups you have made of your wallet file should be replaced with the newly generated, encrypted wallet file. For security reasons, previous backups of the unencrypted wallet file will become useless as soon as you start using the new, encrypted wallet.</source>
<translation>ВАЖНО: Всички стари запазвания, които сте направили на Вашият портфейл трябва да замените с запазване на новополучения, шифриран портфейл. От съображения за сигурност, предишните запазвания на нешифрирани портфейли ще станат неизползваеми веднага, щом започнете да използвате новият, шифриран портфейл.</translation>
</message>
@@ -414,6 +418,10 @@
<translation>%1 зад</translation>
</message>
<message>
+ <source>Last received block was generated %1 ago.</source>
+ <translation>Последния получен блок е генериран преди %1.</translation>
+ </message>
+ <message>
<source>Transactions after this will not yet be visible.</source>
<translation>Транзакции след това няма все още да бъдат видими.</translation>
</message>
@@ -636,6 +644,10 @@
<translation>нищо</translation>
</message>
<message>
+ <source>This label turns red if the transaction size is greater than 1000 bytes.</source>
+ <translation>Този етикет става червен, когато размера на транзакцията е по-голяма от 1000 бита.</translation>
+ </message>
+ <message>
<source>yes</source>
<translation>да</translation>
</message>
@@ -850,6 +862,10 @@
<translation>&amp;Мрежа</translation>
</message>
<message>
+ <source>Automatically start Bitcoin Core after logging in to the system.</source>
+ <translation>Автоматично стартиране на Bitcoin Core след влизане в системата.</translation>
+ </message>
+ <message>
<source>W&amp;allet</source>
<translation>По&amp;ртфейл</translation>
</message>
@@ -1048,10 +1064,22 @@
<translation>Файл за справяне със заявки</translation>
</message>
<message>
+ <source>Payment request expired.</source>
+ <translation>Заявката за плащане е изтекла.</translation>
+ </message>
+ <message>
+ <source>Invalid payment request.</source>
+ <translation>Невалидна заявка за плащане.</translation>
+ </message>
+ <message>
<source>Refund from %1</source>
<translation>Възстановяване на сума от %1</translation>
</message>
<message>
+ <source>Payment request %1 is too large (%2 bytes, allowed %3 bytes).</source>
+ <translation>Заявката за плащане %1 е твърде голям (%2 байта, позволени %3 байта).</translation>
+ </message>
+ <message>
<source>Error communicating with %1: %2</source>
<translation>Грешка при комуникацията с %1: %2</translation>
</message>
@@ -1236,14 +1264,6 @@
<translation>Получени за последно</translation>
</message>
<message>
- <source>Bytes Sent</source>
- <translation>Изпратени байтове</translation>
- </message>
- <message>
- <source>Bytes Received</source>
- <translation>Получени байтове</translation>
- </message>
- <message>
<source>Ping Time</source>
<translation>Време за отговор</translation>
</message>
@@ -1332,6 +1352,14 @@
<translation>Изходящи</translation>
</message>
<message>
+ <source>Yes</source>
+ <translation>Да</translation>
+ </message>
+ <message>
+ <source>No</source>
+ <translation>Не</translation>
+ </message>
+ <message>
<source>Unknown</source>
<translation>Неизвестен</translation>
</message>
@@ -1536,6 +1564,10 @@
<translation>за килобайт</translation>
</message>
<message>
+ <source>Hide</source>
+ <translation>Скрий</translation>
+ </message>
+ <message>
<source>total at least</source>
<translation>Крайна сума поне</translation>
</message>
@@ -1644,8 +1676,8 @@
<translation>Грешка при създаването на транзакция!</translation>
</message>
<message>
- <source>Pay only the minimum fee of %1</source>
- <translation>Платете минималната такса от %1</translation>
+ <source>Payment request expired.</source>
+ <translation>Заявката за плащане е изтекла.</translation>
</message>
<message>
<source>Warning: Invalid Bitcoin address</source>
@@ -1926,6 +1958,10 @@
<translation>собствен адрес</translation>
</message>
<message>
+ <source>watch-only</source>
+ <translation>само гледане</translation>
+ </message>
+ <message>
<source>label</source>
<translation>име</translation>
</message>
@@ -2088,6 +2124,10 @@
<translation>Емитирани</translation>
</message>
<message>
+ <source>watch-only</source>
+ <translation>само гледане</translation>
+ </message>
+ <message>
<source>(n/a)</source>
<translation>(n/a)</translation>
</message>
@@ -2430,22 +2470,10 @@
<translation>Предупреждение</translation>
</message>
<message>
- <source>on startup</source>
- <translation>по време на стартирането</translation>
- </message>
- <message>
<source>Password for JSON-RPC connections</source>
<translation>Парола за JSON-RPC връзките</translation>
</message>
<message>
- <source>Upgrade wallet to latest format</source>
- <translation>Обновяване на портфейла до най-новия формат</translation>
- </message>
- <message>
- <source>Rescan the block chain for missing wallet transactions</source>
- <translation>Повторно сканиране на блок-връзка за липсващи портфейлни транзакции</translation>
- </message>
- <message>
<source>This help message</source>
<translation>Това помощно съобщение</translation>
</message>
diff --git a/src/qt/locale/bitcoin_ca.ts b/src/qt/locale/bitcoin_ca.ts
index b9aa40a7e3..dcbe4dc4cb 100644
--- a/src/qt/locale/bitcoin_ca.ts
+++ b/src/qt/locale/bitcoin_ca.ts
@@ -1494,14 +1494,6 @@
<translation>Darrera recepció</translation>
</message>
<message>
- <source>Bytes Sent</source>
- <translation>Bytes enviats</translation>
- </message>
- <message>
- <source>Bytes Received</source>
- <translation>Bytes rebuts</translation>
- </message>
- <message>
<source>Ping Time</source>
<translation>Temps de ping</translation>
</message>
@@ -2010,10 +2002,6 @@
<translation><numerusform>Estimat per començar la confirmació en %n bloc.</numerusform><numerusform>Estimat per començar la confirmació en %n blocs.</numerusform></translation>
</message>
<message>
- <source>Pay only the minimum fee of %1</source>
- <translation>Paga només la comissió mínima de %1</translation>
- </message>
- <message>
<source>The recipient address is not valid. Please recheck.</source>
<translation>L'adreça de destinatari no és vàlida. Torneu-la a comprovar.</translation>
</message>
@@ -2860,10 +2848,6 @@
<translation>&lt;category&gt; pot ser:</translation>
</message>
<message>
- <source>Attempt to recover private keys from a corrupt wallet.dat</source>
- <translation>Intenta recuperar les claus privades d'un fitxer wallet.dat corrupte</translation>
- </message>
- <message>
<source>Block creation options:</source>
<translation>Opcions de la creació de blocs:</translation>
</message>
@@ -2984,10 +2968,6 @@
<translation>Cal que reconstruïu la base de dades fent servir -reindex per canviar -txindex</translation>
</message>
<message>
- <source>Imports blocks from external blk000??.dat file</source>
- <translation>Importa blocs de un fitxer blk000??.dat extern</translation>
- </message>
- <message>
<source>Allow JSON-RPC connections from specified source. Valid for &lt;ip&gt; are a single IP (e.g. 1.2.3.4), a network/netmask (e.g. 1.2.3.4/255.255.255.0) or a network/CIDR (e.g. 1.2.3.4/24). This option can be specified multiple times</source>
<translation>Permet les connexions JSON-RPC d'una font específica. Vàlid per a &lt;ip&gt; són una IP individual (p. ex., 1.2.3.4), una xarxa / màscara de xarxa (p. ex., 1.2.3.4/255.255.255.0) o una xarxa/CIDR (p. ex., 1.2.3.4/24). Es pot especificar aquesta opció moltes vegades</translation>
</message>
@@ -3236,10 +3216,6 @@
<translation>Se suprimeixen totes les transaccions del moneder...</translation>
</message>
<message>
- <source>on startup</source>
- <translation>a l'inici de l'aplicació</translation>
- </message>
- <message>
<source>wallet.dat corrupt, salvage failed</source>
<translation>El fitxer wallet.data és corrupte. El rescat de les dades ha fallat</translation>
</message>
@@ -3252,14 +3228,6 @@
<translation>Executa l'ordre quan el millor bloc canviï (%s en cmd es reemplaça per un resum de bloc)</translation>
</message>
<message>
- <source>Upgrade wallet to latest format</source>
- <translation>Actualitza el moneder a l'últim format</translation>
- </message>
- <message>
- <source>Rescan the block chain for missing wallet transactions</source>
- <translation>Reescaneja la cadena de blocs en les transaccions de moneder perdudes</translation>
- </message>
- <message>
<source>This help message</source>
<translation>Aquest misatge d'ajuda</translation>
</message>
diff --git a/src/qt/locale/bitcoin_ca@valencia.ts b/src/qt/locale/bitcoin_ca@valencia.ts
index edb14dedba..e717f53d47 100644
--- a/src/qt/locale/bitcoin_ca@valencia.ts
+++ b/src/qt/locale/bitcoin_ca@valencia.ts
@@ -1490,14 +1490,6 @@
<translation>Darrera recepció</translation>
</message>
<message>
- <source>Bytes Sent</source>
- <translation>Bytes enviats</translation>
- </message>
- <message>
- <source>Bytes Received</source>
- <translation>Bytes rebuts</translation>
- </message>
- <message>
<source>Ping Time</source>
<translation>Temps de ping</translation>
</message>
@@ -2006,10 +1998,6 @@
<translation><numerusform>Estimat per començar la confirmació en %n bloc.</numerusform><numerusform>Estimat per començar la confirmació en %n blocs.</numerusform></translation>
</message>
<message>
- <source>Pay only the minimum fee of %1</source>
- <translation>Paga només la comissió mínima de %1</translation>
- </message>
- <message>
<source>The recipient address is not valid. Please recheck.</source>
<translation>L'adreça de destinatari no és vàlida. Torneu-la a comprovar.</translation>
</message>
@@ -2856,10 +2844,6 @@
<translation>&lt;category&gt; pot ser:</translation>
</message>
<message>
- <source>Attempt to recover private keys from a corrupt wallet.dat</source>
- <translation>Intenta recuperar les claus privades d'un fitxer wallet.dat corrupte</translation>
- </message>
- <message>
<source>Block creation options:</source>
<translation>Opcions de la creació de blocs:</translation>
</message>
@@ -2980,10 +2964,6 @@
<translation>Cal que reconstruïu la base de dades fent servir -reindex per canviar -txindex</translation>
</message>
<message>
- <source>Imports blocks from external blk000??.dat file</source>
- <translation>Importa blocs d'un fitxer blk000??.dat extern</translation>
- </message>
- <message>
<source>Allow JSON-RPC connections from specified source. Valid for &lt;ip&gt; are a single IP (e.g. 1.2.3.4), a network/netmask (e.g. 1.2.3.4/255.255.255.0) or a network/CIDR (e.g. 1.2.3.4/24). This option can be specified multiple times</source>
<translation>Permet les connexions JSON-RPC d'una font específica. Vàlid per a &lt;ip&gt; són una IP individual (p. ex., 1.2.3.4), una xarxa / màscara de xarxa (p. ex., 1.2.3.4/255.255.255.0) o una xarxa/CIDR (p. ex., 1.2.3.4/24). Es pot especificar esta opció moltes vegades</translation>
</message>
@@ -3232,10 +3212,6 @@
<translation>Se suprimeixen totes les transaccions del moneder...</translation>
</message>
<message>
- <source>on startup</source>
- <translation>a l'inici de l'aplicació</translation>
- </message>
- <message>
<source>wallet.dat corrupt, salvage failed</source>
<translation>El fitxer wallet.data és corrupte. El rescat de les dades ha fallat</translation>
</message>
@@ -3248,14 +3224,6 @@
<translation>Executa l'orde quan el millor bloc canvie (%s en cmd es reemplaça per un resum de bloc)</translation>
</message>
<message>
- <source>Upgrade wallet to latest format</source>
- <translation>Actualitza el moneder a l'últim format</translation>
- </message>
- <message>
- <source>Rescan the block chain for missing wallet transactions</source>
- <translation>Reescaneja la cadena de blocs en les transaccions de moneder perdudes</translation>
- </message>
- <message>
<source>This help message</source>
<translation>Este misatge d'ajuda</translation>
</message>
diff --git a/src/qt/locale/bitcoin_ca_ES.ts b/src/qt/locale/bitcoin_ca_ES.ts
index f10a41163e..331ad835f6 100644
--- a/src/qt/locale/bitcoin_ca_ES.ts
+++ b/src/qt/locale/bitcoin_ca_ES.ts
@@ -1494,14 +1494,6 @@
<translation>Darrera recepció</translation>
</message>
<message>
- <source>Bytes Sent</source>
- <translation>Bytes enviats</translation>
- </message>
- <message>
- <source>Bytes Received</source>
- <translation>Bytes rebuts</translation>
- </message>
- <message>
<source>Ping Time</source>
<translation>Temps de ping</translation>
</message>
@@ -2010,10 +2002,6 @@
<translation><numerusform>Estimat per començar la confirmació en %n bloc.</numerusform><numerusform>Estimat per començar la confirmació en %n blocs.</numerusform></translation>
</message>
<message>
- <source>Pay only the minimum fee of %1</source>
- <translation>Paga només la comissió mínima de %1</translation>
- </message>
- <message>
<source>The recipient address is not valid. Please recheck.</source>
<translation>L'adreça de destinatari no és vàlida. Torneu-la a comprovar.</translation>
</message>
@@ -2860,10 +2848,6 @@
<translation>&lt;category&gt; pot ser:</translation>
</message>
<message>
- <source>Attempt to recover private keys from a corrupt wallet.dat</source>
- <translation>Intenta recuperar les claus privades d'un fitxer wallet.dat corrupte</translation>
- </message>
- <message>
<source>Block creation options:</source>
<translation>Opcions de la creació de blocs:</translation>
</message>
@@ -2984,10 +2968,6 @@
<translation>Cal que reconstruïu la base de dades fent servir -reindex per canviar -txindex</translation>
</message>
<message>
- <source>Imports blocks from external blk000??.dat file</source>
- <translation>Importa blocs de un fitxer blk000??.dat extern</translation>
- </message>
- <message>
<source>Allow JSON-RPC connections from specified source. Valid for &lt;ip&gt; are a single IP (e.g. 1.2.3.4), a network/netmask (e.g. 1.2.3.4/255.255.255.0) or a network/CIDR (e.g. 1.2.3.4/24). This option can be specified multiple times</source>
<translation>Permet les connexions JSON-RPC d'una font específica. Vàlid per a &lt;ip&gt; són una IP individual (p. ex., 1.2.3.4), una xarxa / màscara de xarxa (p. ex., 1.2.3.4/255.255.255.0) o una xarxa/CIDR (p. ex., 1.2.3.4/24). Es pot especificar aquesta opció moltes vegades</translation>
</message>
@@ -3236,10 +3216,6 @@
<translation>Se suprimeixen totes les transaccions del moneder...</translation>
</message>
<message>
- <source>on startup</source>
- <translation>a l'inici de l'aplicació</translation>
- </message>
- <message>
<source>wallet.dat corrupt, salvage failed</source>
<translation>El fitxer wallet.data és corrupte. El rescat de les dades ha fallat</translation>
</message>
@@ -3252,14 +3228,6 @@
<translation>Executa l'ordre quan el millor bloc canviï (%s en cmd es reemplaça per un resum de bloc)</translation>
</message>
<message>
- <source>Upgrade wallet to latest format</source>
- <translation>Actualitza el moneder a l'últim format</translation>
- </message>
- <message>
- <source>Rescan the block chain for missing wallet transactions</source>
- <translation>Reescaneja la cadena de blocs en les transaccions de moneder perdudes</translation>
- </message>
- <message>
<source>This help message</source>
<translation>Aquest misatge d'ajuda</translation>
</message>
diff --git a/src/qt/locale/bitcoin_cs.ts b/src/qt/locale/bitcoin_cs.ts
index c8c3368543..a2232dbe8e 100644
--- a/src/qt/locale/bitcoin_cs.ts
+++ b/src/qt/locale/bitcoin_cs.ts
@@ -1494,14 +1494,6 @@
<translation>Poslední příjem</translation>
</message>
<message>
- <source>Bytes Sent</source>
- <translation>Bajtů odesláno</translation>
- </message>
- <message>
- <source>Bytes Received</source>
- <translation>Bajtů přijato</translation>
- </message>
- <message>
<source>Ping Time</source>
<translation>Odezva</translation>
</message>
@@ -2010,10 +2002,6 @@
<translation><numerusform>Potvrzování by podle odhadu mělo začít během %n bloku.</numerusform><numerusform>Potvrzování by podle odhadu mělo začít během %n bloků.</numerusform><numerusform>Potvrzování by podle odhadu mělo začít během %n bloků.</numerusform></translation>
</message>
<message>
- <source>Pay only the minimum fee of %1</source>
- <translation>Zaplatit pouze minimální poplatek %1</translation>
- </message>
- <message>
<source>The recipient address is not valid. Please recheck.</source>
<translation>Adresa příjemce je neplatná – překontroluj ji prosím.</translation>
</message>
@@ -2860,10 +2848,6 @@
<translation>&lt;category&gt; může být:</translation>
</message>
<message>
- <source>Attempt to recover private keys from a corrupt wallet.dat</source>
- <translation>Pokusit se zachránit soukromé klíče z poškozeného souboru wallet.dat</translation>
- </message>
- <message>
<source>Block creation options:</source>
<translation>Možnosti vytváření bloku:</translation>
</message>
@@ -2984,10 +2968,6 @@
<translation>Je třeba přestavět databázi použitím -reindex, aby bylo možné změnit -txindex</translation>
</message>
<message>
- <source>Imports blocks from external blk000??.dat file</source>
- <translation>Importovat bloky z externího souboru blk000??.dat</translation>
- </message>
- <message>
<source>Allow JSON-RPC connections from specified source. Valid for &lt;ip&gt; are a single IP (e.g. 1.2.3.4), a network/netmask (e.g. 1.2.3.4/255.255.255.0) or a network/CIDR (e.g. 1.2.3.4/24). This option can be specified multiple times</source>
<translation>Povolit JSON-RPC spojení ze specifikovaného zdroje. Platnou hodnotou &lt;ip&gt; je jednotlivá IP adresa (např. 1.2.3.4), síť/maska (např. 1.2.3.4/255.255.255.0) nebo síť/CIDR (např. 1.2.3.4/24). Tuto volbu lze použít i vícekrát</translation>
</message>
@@ -3236,10 +3216,6 @@
<translation>Vymazat všechny transakce z peněženky...</translation>
</message>
<message>
- <source>on startup</source>
- <translation>při startu</translation>
- </message>
- <message>
<source>wallet.dat corrupt, salvage failed</source>
<translation>Soubor wallet.dat je poškozen, jeho záchrana se nezdařila</translation>
</message>
@@ -3252,14 +3228,6 @@
<translation>Spustit příkaz, když se změní nejlepší blok (%s se v příkazu nahradí hashem bloku)</translation>
</message>
<message>
- <source>Upgrade wallet to latest format</source>
- <translation>Převést peněženku na nejnovější formát</translation>
- </message>
- <message>
- <source>Rescan the block chain for missing wallet transactions</source>
- <translation>Přeskenovat řetězec bloků na chybějící transakce tvé pěněženky</translation>
- </message>
- <message>
<source>This help message</source>
<translation>Tato nápověda</translation>
</message>
diff --git a/src/qt/locale/bitcoin_da.ts b/src/qt/locale/bitcoin_da.ts
index 46d9826045..93594dcb05 100644
--- a/src/qt/locale/bitcoin_da.ts
+++ b/src/qt/locale/bitcoin_da.ts
@@ -1129,7 +1129,7 @@
</message>
<message>
<source>&amp;Unit to show amounts in:</source>
- <translation>&amp;Enhed at vise beløb i:</translation>
+ <translation>&amp;Enhed, som beløb vises i:</translation>
</message>
<message>
<source>Choose the default subdivision unit to show in the interface and when sending coins.</source>
@@ -1141,7 +1141,7 @@
</message>
<message>
<source>&amp;OK</source>
- <translation>&amp;O.k.</translation>
+ <translation>&amp;Ok</translation>
</message>
<message>
<source>&amp;Cancel</source>
@@ -1200,7 +1200,7 @@
</message>
<message>
<source>Pending:</source>
- <translation>Uafgjort:</translation>
+ <translation>Afventende:</translation>
</message>
<message>
<source>Total of transactions that have yet to be confirmed, and do not yet count toward the spendable balance</source>
@@ -1546,14 +1546,6 @@
<translation>Seneste modtagelse</translation>
</message>
<message>
- <source>Bytes Sent</source>
- <translation>Byte sendt</translation>
- </message>
- <message>
- <source>Bytes Received</source>
- <translation>Byte modtaget</translation>
- </message>
- <message>
<source>Ping Time</source>
<translation>Ping-tid</translation>
</message>
@@ -2066,6 +2058,10 @@
<translation>Kopiér byttepenge</translation>
</message>
<message>
+ <source>Total Amount %1</source>
+ <translation>Totalbeløb %1</translation>
+ </message>
+ <message>
<source>or</source>
<translation>eller</translation>
</message>
@@ -2097,19 +2093,15 @@
<source>Payment request expired.</source>
<translation>Betalingsanmodning er udløbet.</translation>
</message>
+ <message>
+ <source>Pay only the required fee of %1</source>
+ <translation>Betal kun det påkrævede gebyr på %1</translation>
+ </message>
<message numerus="yes">
<source>Estimated to begin confirmation within %n block(s).</source>
<translation><numerusform>Bekræftelse estimeres til at begynde inden for %n blok.</numerusform><numerusform>Bekræftelse estimeres til at begynde inden for %n blokke.</numerusform></translation>
</message>
<message>
- <source>Pay only the minimum fee of %1</source>
- <translation>Betal kun det minimale gebyr på %1</translation>
- </message>
- <message>
- <source>Total Amount %1&lt;span style='font-size:10pt;font-weight:normal;'&gt;&lt;br /&gt;(=%2)&lt;/span&gt;</source>
- <translation>Totalbeløb %1&lt;span style='font-size:10pt;font-weight:normal;'&gt;&lt;br /&gt;(=%2)&lt;/span&gt;</translation>
- </message>
- <message>
<source>The recipient address is not valid. Please recheck.</source>
<translation>Modtageradressen er ikke gyldig. Tjek venligst igen.</translation>
</message>
@@ -2888,10 +2880,6 @@
<translation>Acceptér kommandolinje- og JSON-RPC-kommandoer</translation>
</message>
<message>
- <source>Fees (in %s/kB) smaller than this are considered zero fee for relaying (default: %s)</source>
- <translation>Gebyrer (i %s/kB) mindre end dette opfattes som nul-gebyr under videresendelse (standard: %s)</translation>
- </message>
- <message>
<source>If &lt;category&gt; is not supplied or if &lt;category&gt; = 1, output all debugging information.</source>
<translation>Hvis &lt;category&gt; ikke angives eller hvis &lt;category&gt; = 1, udskriv al fejlretningsinformation.</translation>
</message>
@@ -3016,10 +3004,6 @@
<translation>&lt;kategori&gt; kan være:</translation>
</message>
<message>
- <source>Attempt to recover private keys from a corrupt wallet.dat</source>
- <translation>Forsøg at genskabe private nøgler fra ødelagt wallet.dat</translation>
- </message>
- <message>
<source>Block creation options:</source>
<translation>Blokoprettelsestilvalg:</translation>
</message>
@@ -3176,10 +3160,6 @@
<translation>Du er nødt til at genopbygge databasen ved hjælp af -reindex for at ændre -txindex</translation>
</message>
<message>
- <source>Imports blocks from external blk000??.dat file</source>
- <translation>Importerer blokke fra ekstern blk000??.dat fil</translation>
- </message>
- <message>
<source>Allow JSON-RPC connections from specified source. Valid for &lt;ip&gt; are a single IP (e.g. 1.2.3.4), a network/netmask (e.g. 1.2.3.4/255.255.255.0) or a network/CIDR (e.g. 1.2.3.4/24). This option can be specified multiple times</source>
<translation>Tillad JSON-RPC-forbindelser fra angivet kilde. Gyldig for &lt;ip&gt; er en enkelt IP (fx 1.2.3.4), et netværk/netmaske (fx 1.2.3.4/255.255.255.0) eller et netværk/CIDR (fx 1.2.3.4/24). Dette tilvalg kan angives flere gange</translation>
</message>
@@ -3212,6 +3192,10 @@
<translation>Udfør kommando, når en relevant alarm modtages eller vi ser en virkelig lang udsplitning (%s i cmd erstattes af besked)</translation>
</message>
<message>
+ <source>Fees (in %s/kB) smaller than this are considered zero fee for relaying, mining and transaction creation (default: %s)</source>
+ <translation>Gebyrer (i %s/kB) mindre end dette opfattes som intet gebyr for videresendelse, mining og oprettelse af transaktioner (standard: %s)</translation>
+ </message>
+ <message>
<source>If paytxfee is not set, include enough fee so transactions begin confirmation on average within n blocks (default: %u)</source>
<translation>Hvis paytxfee ikke er sat, inkluderes nok gebyr til at transaktioner begynder at blive bekræftet ingen for gennemsnitligt n blokke (standard: %u)</translation>
</message>
@@ -3268,6 +3252,10 @@
<translation>Aktiverer bedste kæde…</translation>
</message>
<message>
+ <source>Attempt to recover private keys from a corrupt wallet.dat on startup</source>
+ <translation>Forsøg at genskabe private nøgler fra en ødelagt wallet.dat under opstart</translation>
+ </message>
+ <message>
<source>Cannot resolve -whitebind address: '%s'</source>
<translation>Kan ikke løse -whitebind adresse: "%s"</translation>
</message>
@@ -3292,6 +3280,10 @@
<translation>Fejl under læsning fra database; lukker ned.</translation>
</message>
<message>
+ <source>Imports blocks from external blk000??.dat file on startup</source>
+ <translation>Importerer blokeringer fra ekstern blk000??.dat-fil under opstart</translation>
+ </message>
+ <message>
<source>Information</source>
<translation>Information</translation>
</message>
@@ -3348,6 +3340,10 @@
<translation>Reducerer -maxconnections fra %d til %d på grund af systembegrænsninger.</translation>
</message>
<message>
+ <source>Rescan the block chain for missing wallet transactions on startup</source>
+ <translation>Genindlæs blokkæden efter manglende tegnebogstransaktioner under opstart</translation>
+ </message>
+ <message>
<source>Send trace/debug info to console instead of debug.log file</source>
<translation>Send sporings-/fejlsøgningsinformation til konsollen i stedet for debug.log filen</translation>
</message>
@@ -3416,6 +3412,10 @@
<translation>Ikke i stand til at tildele til %s på denne computer (bind returnerede fejl %s)</translation>
</message>
<message>
+ <source>Upgrade wallet to latest format on startup</source>
+ <translation>Opgradér tegnebog til seneste format under opstart</translation>
+ </message>
+ <message>
<source>Username for JSON-RPC connections</source>
<translation>Brugernavn til JSON-RPC-forbindelser</translation>
</message>
@@ -3436,10 +3436,6 @@
<translation>ZeroMQ-notifikationsindstillinger:</translation>
</message>
<message>
- <source>on startup</source>
- <translation>under opstart</translation>
- </message>
- <message>
<source>wallet.dat corrupt, salvage failed</source>
<translation>wallet.dat ødelagt, redning af data mislykkedes</translation>
</message>
@@ -3452,14 +3448,6 @@
<translation>Udfør kommando, når den bedste blok ændres (%s i kommandoen erstattes med blokhash)</translation>
</message>
<message>
- <source>Upgrade wallet to latest format</source>
- <translation>Opgrader tegnebog til seneste format</translation>
- </message>
- <message>
- <source>Rescan the block chain for missing wallet transactions</source>
- <translation>Gennemsøg blokkæden for manglende tegnebogstransaktioner</translation>
- </message>
- <message>
<source>This help message</source>
<translation>Denne hjælpebesked</translation>
</message>
diff --git a/src/qt/locale/bitcoin_de.ts b/src/qt/locale/bitcoin_de.ts
index a25fb7458d..42776f2c8b 100644
--- a/src/qt/locale/bitcoin_de.ts
+++ b/src/qt/locale/bitcoin_de.ts
@@ -1518,14 +1518,6 @@
<translation>Letzter Empfang</translation>
</message>
<message>
- <source>Bytes Sent</source>
- <translation>Übertragene Byte</translation>
- </message>
- <message>
- <source>Bytes Received</source>
- <translation>Empfangene Byte</translation>
- </message>
- <message>
<source>Ping Time</source>
<translation>Pingzeit</translation>
</message>
@@ -2022,6 +2014,10 @@
<translation>Wechselgeld kopieren</translation>
</message>
<message>
+ <source>Total Amount %1</source>
+ <translation>Gesamtbetrag %1</translation>
+ </message>
+ <message>
<source>or</source>
<translation>oder</translation>
</message>
@@ -2058,14 +2054,6 @@
<translation><numerusform>Voraussichtlicher Beginn der Bestätigung innerhalb von %n Block.</numerusform><numerusform>Voraussichtlicher Beginn der Bestätigung innerhalb von %n Blöcken.</numerusform></translation>
</message>
<message>
- <source>Pay only the minimum fee of %1</source>
- <translation>Nur die minimale Gebühr in Höhe von %1 zahlen</translation>
- </message>
- <message>
- <source>Total Amount %1&lt;span style='font-size:10pt;font-weight:normal;'&gt;&lt;br /&gt;(=%2)&lt;/span&gt;</source>
- <translation>Gesamtbetrag %1&lt;span style='font-size:10pt;font-weight:normal;'&gt;&lt;br /&gt;(=%2)&lt;/span&gt;</translation>
- </message>
- <message>
<source>The recipient address is not valid. Please recheck.</source>
<translation>Die Zahlungsadresse ist ungültig, bitte nochmals überprüfen.</translation>
</message>
@@ -2924,10 +2912,6 @@
<translation>&lt;category&gt; kann sein:</translation>
</message>
<message>
- <source>Attempt to recover private keys from a corrupt wallet.dat</source>
- <translation>Versuchen, private Schlüssel aus einer beschädigten wallet.dat wiederherzustellen</translation>
- </message>
- <message>
<source>Block creation options:</source>
<translation>Blockerzeugungsoptionen:</translation>
</message>
@@ -3048,10 +3032,6 @@
<translation>Sie müssen die Datenbank mit Hilfe von -reindex neu aufbauen, um -txindex zu verändern</translation>
</message>
<message>
- <source>Imports blocks from external blk000??.dat file</source>
- <translation>Blöcke aus externer Datei blk000??.dat importieren</translation>
- </message>
- <message>
<source>Allow JSON-RPC connections from specified source. Valid for &lt;ip&gt; are a single IP (e.g. 1.2.3.4), a network/netmask (e.g. 1.2.3.4/255.255.255.0) or a network/CIDR (e.g. 1.2.3.4/24). This option can be specified multiple times</source>
<translation>JSON-RPC-Verbindungen von der angegeben Quelle erlauben. Gültig für &lt;ip&gt; ist eine einzelne IP-Adresse (z.B. 1.2.3.4), ein Netzwerk bzw. eine Netzmaske (z.B. 1.2.3.4/255.255.255.0), oder die CIDR-Notation (z.B. 1.2.3.4/24). Kann mehrmals angegeben werden.</translation>
</message>
@@ -3304,10 +3284,6 @@
<translation>ZeroMQ-Benachrichtigungsoptionen:</translation>
</message>
<message>
- <source>on startup</source>
- <translation>beim Starten</translation>
- </message>
- <message>
<source>wallet.dat corrupt, salvage failed</source>
<translation>wallet.dat beschädigt, Datenrettung fehlgeschlagen</translation>
</message>
@@ -3320,14 +3296,6 @@
<translation>Befehl ausführen wenn der beste Block wechselt (%s im Befehl wird durch den Hash des Blocks ersetzt)</translation>
</message>
<message>
- <source>Upgrade wallet to latest format</source>
- <translation>Wallet auf das neueste Format aktualisieren</translation>
- </message>
- <message>
- <source>Rescan the block chain for missing wallet transactions</source>
- <translation>Blockkette erneut nach fehlenden Wallet-Transaktionen durchsuchen</translation>
- </message>
- <message>
<source>This help message</source>
<translation>Dieser Hilfetext</translation>
</message>
diff --git a/src/qt/locale/bitcoin_el_GR.ts b/src/qt/locale/bitcoin_el_GR.ts
index 1f33a497ee..d9f8dee5ef 100644
--- a/src/qt/locale/bitcoin_el_GR.ts
+++ b/src/qt/locale/bitcoin_el_GR.ts
@@ -1389,14 +1389,6 @@
<translation>Τελευταία λήψη</translation>
</message>
<message>
- <source>Bytes Sent</source>
- <translation>Σταλθέντα bytes</translation>
- </message>
- <message>
- <source>Bytes Received</source>
- <translation>Ληφθέντα bytes</translation>
- </message>
- <message>
<source>Ping Time</source>
<translation>Χρόνος καθυστέρησης</translation>
</message>
@@ -2555,10 +2547,6 @@
<translation>(προεπιλογή: 1)</translation>
</message>
<message>
- <source>Attempt to recover private keys from a corrupt wallet.dat</source>
- <translation>Προσπάθεια για ανακτησει ιδιωτικων κλειδιων από ενα διεφθαρμένο αρχειο wallet.dat </translation>
- </message>
- <message>
<source>Block creation options:</source>
<translation>Αποκλεισμός επιλογων δημιουργίας: </translation>
</message>
@@ -2639,10 +2627,6 @@
<translation>Επιλογές πορτοφολιού:</translation>
</message>
<message>
- <source>Imports blocks from external blk000??.dat file</source>
- <translation>Εισαγωγή μπλοκ από εξωτερικό αρχείο blk000?.dat</translation>
- </message>
- <message>
<source>Cannot obtain a lock on data directory %s. Bitcoin Core is probably already running.</source>
<translation>Αδυναμία κλειδώματος του φακέλου δεδομένων %s. Πιθανώς το Bitcoin να είναι ήδη ενεργό.</translation>
</message>
@@ -2747,10 +2731,6 @@
<translation>Μεταφορά όλων των συναλλαγών απο το πορτοφόλι</translation>
</message>
<message>
- <source>on startup</source>
- <translation>κατά την εκκίνηση</translation>
- </message>
- <message>
<source>wallet.dat corrupt, salvage failed</source>
<translation>Το αρχειο wallet.dat ειναι διεφθαρμένο, η διάσωση απέτυχε</translation>
</message>
@@ -2763,14 +2743,6 @@
<translation>Εκτέλεσε την εντολή όταν το καλύτερο μπλοκ αλλάξει(%s στην εντολή αντικαθίσταται από το hash του μπλοκ)</translation>
</message>
<message>
- <source>Upgrade wallet to latest format</source>
- <translation>Αναβάθμισε το πορτοφόλι στην τελευταία έκδοση</translation>
- </message>
- <message>
- <source>Rescan the block chain for missing wallet transactions</source>
- <translation>Επανέλεγχος της αλυσίδας μπλοκ για απούσες συναλλαγές</translation>
- </message>
- <message>
<source>This help message</source>
<translation>Αυτό το κείμενο βοήθειας</translation>
</message>
diff --git a/src/qt/locale/bitcoin_en.ts b/src/qt/locale/bitcoin_en.ts
index 1a607a2233..21df732520 100644
--- a/src/qt/locale/bitcoin_en.ts
+++ b/src/qt/locale/bitcoin_en.ts
@@ -299,17 +299,17 @@
<context>
<name>BitcoinGUI</name>
<message>
- <location filename="../bitcoingui.cpp" line="+324"/>
+ <location filename="../bitcoingui.cpp" line="+325"/>
<source>Sign &amp;message...</source>
<translation>Sign &amp;message...</translation>
</message>
<message>
- <location line="+353"/>
+ <location line="+362"/>
<source>Synchronizing with network...</source>
<translation>Synchronizing with network...</translation>
</message>
<message>
- <location line="-429"/>
+ <location line="-438"/>
<source>&amp;Overview</source>
<translation>&amp;Overview</translation>
</message>
@@ -389,12 +389,12 @@
<translation type="unfinished"></translation>
</message>
<message>
- <location line="+180"/>
+ <location line="+183"/>
<source>Bitcoin Core client</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location line="+163"/>
+ <location line="+169"/>
<source>Importing blocks from disk...</source>
<translation>Importing blocks from disk...</translation>
</message>
@@ -404,7 +404,7 @@
<translation>Reindexing blocks on disk...</translation>
</message>
<message>
- <location line="-427"/>
+ <location line="-436"/>
<source>Send coins to a Bitcoin address</source>
<translation>Send coins to a Bitcoin address</translation>
</message>
@@ -434,12 +434,12 @@
<translation>&amp;Verify message...</translation>
</message>
<message>
- <location line="+450"/>
+ <location line="+459"/>
<source>Bitcoin</source>
<translation>Bitcoin</translation>
</message>
<message>
- <location line="-660"/>
+ <location line="-669"/>
<source>Wallet</source>
<translation>Wallet</translation>
</message>
@@ -484,7 +484,7 @@
<translation>Verify messages to ensure they were signed with specified Bitcoin addresses</translation>
</message>
<message>
- <location line="+53"/>
+ <location line="+56"/>
<source>&amp;File</source>
<translation>&amp;File</translation>
</message>
@@ -504,7 +504,7 @@
<translation>Tabs toolbar</translation>
</message>
<message>
- <location line="-311"/>
+ <location line="-314"/>
<source>Bitcoin Core</source>
<translation type="unfinished">Bitcoin Core</translation>
</message>
@@ -549,7 +549,7 @@
<translation type="unfinished"></translation>
</message>
<message numerus="yes">
- <location line="+320"/>
+ <location line="+329"/>
<source>%n active connection(s) to Bitcoin network</source>
<translation>
<numerusform>%n active connection to Bitcoin network</numerusform>
@@ -3316,7 +3316,7 @@
<context>
<name>TransactionTableModel</name>
<message>
- <location filename="../transactiontablemodel.cpp" line="+233"/>
+ <location filename="../transactiontablemodel.cpp" line="+246"/>
<source>Date</source>
<translation>Date</translation>
</message>
@@ -3419,7 +3419,7 @@
<translation>(n/a)</translation>
</message>
<message>
- <location line="+215"/>
+ <location line="+217"/>
<source>Transaction status. Hover over this field to show number of confirmations.</source>
<translation>Transaction status. Hover over this field to show number of confirmations.</translation>
</message>
@@ -3544,6 +3544,11 @@
</message>
<message>
<location line="+1"/>
+ <source>Copy raw transaction</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+1"/>
<source>Edit label</source>
<translation>Edit label</translation>
</message>
@@ -3553,7 +3558,7 @@
<translation>Show transaction details</translation>
</message>
<message>
- <location line="+179"/>
+ <location line="+181"/>
<source>Export Transaction History</source>
<translation type="unfinished"></translation>
</message>
@@ -3618,7 +3623,7 @@
<translation>ID</translation>
</message>
<message>
- <location line="+116"/>
+ <location line="+121"/>
<source>Range:</source>
<translation>Range:</translation>
</message>
@@ -3698,7 +3703,7 @@
<context>
<name>bitcoin-core</name>
<message>
- <location filename="../bitcoinstrings.cpp" line="+258"/>
+ <location filename="../bitcoinstrings.cpp" line="+260"/>
<source>Options:</source>
<translation>Options:</translation>
</message>
@@ -3718,7 +3723,7 @@
<translation>Specify your own public address</translation>
</message>
<message>
- <location line="-107"/>
+ <location line="-109"/>
<source>Accept command line and JSON-RPC commands</source>
<translation>Accept command line and JSON-RPC commands</translation>
</message>
@@ -3758,7 +3763,7 @@
<translation type="unfinished"></translation>
</message>
<message>
- <location line="+110"/>
+ <location line="+112"/>
<source>Error: A fatal internal error occurred, see debug.log for details</source>
<translation type="unfinished"></translation>
</message>
@@ -3778,12 +3783,12 @@
<translation>Run in the background as a daemon and accept commands</translation>
</message>
<message>
- <location line="+32"/>
+ <location line="+34"/>
<source>Unable to start HTTP server. See debug log for details.</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location line="-119"/>
+ <location line="-123"/>
<source>Accept connections from outside (default: 1 if no -proxy or -connect)</source>
<translation>Accept connections from outside (default: 1 if no -proxy or -connect)</translation>
</message>
@@ -3878,7 +3883,7 @@
<translation type="unfinished"></translation>
</message>
<message>
- <location line="+9"/>
+ <location line="+11"/>
<source>Block creation options:</source>
<translation>Block creation options:</translation>
</message>
@@ -4018,7 +4023,7 @@
<translation>Specify wallet file (within data directory)</translation>
</message>
<message>
- <location line="+16"/>
+ <location line="+18"/>
<source>Unsupported argument -benchmark ignored, use -debug=bench.</source>
<translation type="unfinished"></translation>
</message>
@@ -4068,12 +4073,12 @@
<translation type="unfinished"></translation>
</message>
<message>
- <location line="+1"/>
+ <location line="+2"/>
<source>You need to rebuild the database using -reindex to change -txindex</source>
<translation>You need to rebuild the database using -reindex to change -txindex</translation>
</message>
<message>
- <location line="-299"/>
+ <location line="-304"/>
<source>Allow JSON-RPC connections from specified source. Valid for &lt;ip&gt; are a single IP (e.g. 1.2.3.4), a network/netmask (e.g. 1.2.3.4/255.255.255.0) or a network/CIDR (e.g. 1.2.3.4/24). This option can be specified multiple times</source>
<translation type="unfinished"></translation>
</message>
@@ -4189,10 +4194,20 @@
</message>
<message>
<location line="+4"/>
+ <source>Always relay transactions received from whitelisted peers (default: %d)</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+1"/>
<source>Attempt to recover private keys from a corrupt wallet.dat on startup</source>
<translation type="unfinished"></translation>
</message>
<message>
+ <location line="+1"/>
+ <source>Automatically create Tor hidden service (default: %d)</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
<location line="+5"/>
<source>Cannot resolve -whitebind address: &apos;%s&apos;</source>
<translation type="unfinished"></translation>
@@ -4359,6 +4374,16 @@
</message>
<message>
<location line="+2"/>
+ <source>Tor control port password (default: empty)</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+1"/>
+ <source>Tor control port to use if onion listening enabled (default: %s)</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+1"/>
<source>Transaction amount too small</source>
<translation>Transaction amount too small</translation>
</message>
@@ -4408,7 +4433,12 @@
<translation>Warning</translation>
</message>
<message>
- <location line="+3"/>
+ <location line="+2"/>
+ <source>Whether to operate in a blocks only mode (default: %u)</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+2"/>
<source>Zapping all transactions from wallet...</source>
<translation type="unfinished"></translation>
</message>
@@ -4423,27 +4453,27 @@
<translation>wallet.dat corrupt, salvage failed</translation>
</message>
<message>
- <location line="-64"/>
+ <location line="-67"/>
<source>Password for JSON-RPC connections</source>
<translation>Password for JSON-RPC connections</translation>
</message>
<message>
- <location line="-196"/>
+ <location line="-198"/>
<source>Execute command when the best block changes (%s in cmd is replaced by block hash)</source>
<translation>Execute command when the best block changes (%s in cmd is replaced by block hash)</translation>
</message>
<message>
- <location line="+232"/>
+ <location line="+234"/>
<source>This help message</source>
<translation>This help message</translation>
</message>
<message>
- <location line="-106"/>
+ <location line="-108"/>
<source>Allow DNS lookups for -addnode, -seednode and -connect</source>
<translation>Allow DNS lookups for -addnode, -seednode and -connect</translation>
</message>
<message>
- <location line="+58"/>
+ <location line="+60"/>
<source>Loading addresses...</source>
<translation>Loading addresses...</translation>
</message>
@@ -4453,7 +4483,7 @@
<translation>Error loading wallet.dat: Wallet corrupted</translation>
</message>
<message>
- <location line="-205"/>
+ <location line="-207"/>
<source>(1 = keep tx meta data e.g. account owner and payment request information, 2 = drop tx meta data)</source>
<translation type="unfinished"></translation>
</message>
@@ -4528,7 +4558,7 @@
<translation type="unfinished"></translation>
</message>
<message>
- <location line="+26"/>
+ <location line="+28"/>
<source>Error loading wallet.dat</source>
<translation>Error loading wallet.dat</translation>
</message>
@@ -4638,12 +4668,12 @@
<translation type="unfinished"></translation>
</message>
<message>
- <location line="+8"/>
+ <location line="+10"/>
<source>Unknown network specified in -onlynet: &apos;%s&apos;</source>
<translation>Unknown network specified in -onlynet: &apos;%s&apos;</translation>
</message>
<message>
- <location line="-111"/>
+ <location line="-113"/>
<source>Cannot resolve -bind address: &apos;%s&apos;</source>
<translation>Cannot resolve -bind address: &apos;%s&apos;</translation>
</message>
@@ -4668,12 +4698,12 @@
<translation>Loading block index...</translation>
</message>
<message>
- <location line="-60"/>
+ <location line="-62"/>
<source>Add a node to connect to and attempt to keep the connection open</source>
<translation>Add a node to connect to and attempt to keep the connection open</translation>
</message>
<message>
- <location line="+61"/>
+ <location line="+63"/>
<source>Loading wallet...</source>
<translation>Loading wallet...</translation>
</message>
diff --git a/src/qt/locale/bitcoin_eo.ts b/src/qt/locale/bitcoin_eo.ts
index b969075e0a..4bd64f68d1 100644
--- a/src/qt/locale/bitcoin_eo.ts
+++ b/src/qt/locale/bitcoin_eo.ts
@@ -1124,10 +1124,6 @@
<translation>Aktuala nombro de blokoj</translation>
</message>
<message>
- <source>Bytes Sent</source>
- <translation>Bajtoj Senditaj:</translation>
- </message>
- <message>
<source>Last block time</source>
<translation>Horo de la lasta bloko</translation>
</message>
@@ -2134,10 +2130,6 @@
<translation>&lt;category&gt; povas esti:</translation>
</message>
<message>
- <source>Attempt to recover private keys from a corrupt wallet.dat</source>
- <translation>Provo ripari privatajn ŝlosilojn el difektita wallet.dat</translation>
- </message>
- <message>
<source>Block creation options:</source>
<translation>Blok-kreaj agordaĵoj:</translation>
</message>
@@ -2214,10 +2206,6 @@
<translation>Vi devas rekontrui la datumbazon kun -reindex por ŝanĝi -txindex</translation>
</message>
<message>
- <source>Imports blocks from external blk000??.dat file</source>
- <translation>Importas blokojn el ekstera dosiero blk000??.dat</translation>
- </message>
- <message>
<source>Execute command when a relevant alert is received or we see a really long fork (%s in cmd is replaced by message)</source>
<translation>Plenumi komandon kiam rilata alerto riceviĝas, aŭ kiam ni vidas tre longan forkon (%s en cms anstataŭiĝas per mesaĝo)</translation>
</message>
@@ -2298,14 +2286,6 @@
<translation>Plenumi komandon kiam plej bona bloko ŝanĝiĝas (%s en cmd anstataŭiĝas per bloka haketaĵo)</translation>
</message>
<message>
- <source>Upgrade wallet to latest format</source>
- <translation>Ĝisdatigi monujon al plej lasta formato</translation>
- </message>
- <message>
- <source>Rescan the block chain for missing wallet transactions</source>
- <translation>Reskani la blokĉenon por mankantaj monujaj transakcioj</translation>
- </message>
- <message>
<source>This help message</source>
<translation>Tiu ĉi helpmesaĝo</translation>
</message>
diff --git a/src/qt/locale/bitcoin_es.ts b/src/qt/locale/bitcoin_es.ts
index 91b0d79e30..ec8261173b 100644
--- a/src/qt/locale/bitcoin_es.ts
+++ b/src/qt/locale/bitcoin_es.ts
@@ -218,7 +218,15 @@
</context>
<context>
<name>BanTableModel</name>
- </context>
+ <message>
+ <source>IP/Netmask</source>
+ <translation>IP/Máscara</translation>
+ </message>
+ <message>
+ <source>Banned Until</source>
+ <translation>Bloqueado Hasta</translation>
+ </message>
+</context>
<context>
<name>BitcoinGUI</name>
<message>
@@ -1068,6 +1076,18 @@
<translation>Puerto del servidor proxy (ej. 9050)</translation>
</message>
<message>
+ <source>IPv4</source>
+ <translation>IPv4</translation>
+ </message>
+ <message>
+ <source>IPv6</source>
+ <translation>IPv6</translation>
+ </message>
+ <message>
+ <source>Tor</source>
+ <translation>Tor</translation>
+ </message>
+ <message>
<source>&amp;Window</source>
<translation>&amp;Ventana</translation>
</message>
@@ -1454,6 +1474,10 @@
<translation>&amp;Pares</translation>
</message>
<message>
+ <source>Banned peers</source>
+ <translation>Peers Bloqueados</translation>
+ </message>
+ <message>
<source>Select a peer to view detailed information.</source>
<translation>Seleccionar un par para ver su información detallada.</translation>
</message>
@@ -1466,6 +1490,18 @@
<translation>Versión</translation>
</message>
<message>
+ <source>Starting Block</source>
+ <translation>Importando bloques...</translation>
+ </message>
+ <message>
+ <source>Synced Headers</source>
+ <translation>Sincronizar Cabeceras</translation>
+ </message>
+ <message>
+ <source>Synced Blocks</source>
+ <translation>Bloques Sincronizados</translation>
+ </message>
+ <message>
<source>User Agent</source>
<translation>User Agent</translation>
</message>
@@ -1490,14 +1526,6 @@
<translation>Ultima recepción</translation>
</message>
<message>
- <source>Bytes Sent</source>
- <translation>Bytes enviados</translation>
- </message>
- <message>
- <source>Bytes Received</source>
- <translation>Bytes recibidos</translation>
- </message>
- <message>
<source>Ping Time</source>
<translation>Ping</translation>
</message>
@@ -1550,6 +1578,26 @@
<translation>Borrar consola</translation>
</message>
<message>
+ <source>&amp;Disconnect Node</source>
+ <translation>Nodo &amp;Desconectado</translation>
+ </message>
+ <message>
+ <source>1 &amp;hour</source>
+ <translation>1 &amp;hora</translation>
+ </message>
+ <message>
+ <source>1 &amp;day</source>
+ <translation>1 &amp;día</translation>
+ </message>
+ <message>
+ <source>1 &amp;week</source>
+ <translation>1 &amp;semana</translation>
+ </message>
+ <message>
+ <source>1 &amp;year</source>
+ <translation>1 &amp;año</translation>
+ </message>
+ <message>
<source>Welcome to the Bitcoin Core RPC console.</source>
<translation>Bienvenido a la consola RPC de Bitcoin Core.</translation>
</message>
@@ -1578,6 +1626,10 @@
<translation>%1 GB</translation>
</message>
<message>
+ <source>(node id: %1)</source>
+ <translation>(nodo: %1)</translation>
+ </message>
+ <message>
<source>via %1</source>
<translation>via %1</translation>
</message>
@@ -1997,17 +2049,13 @@
<source>Payment request expired.</source>
<translation>Solicitud de pago caducada.</translation>
</message>
- <message numerus="yes">
- <source>Estimated to begin confirmation within %n block(s).</source>
- <translation><numerusform>Estimado para empezar la confirmación dentro de %n bloque.</numerusform><numerusform>Estimado para empezar la confirmación dentro de %n bloques.</numerusform></translation>
- </message>
<message>
- <source>Pay only the minimum fee of %1</source>
+ <source>Pay only the required fee of %1</source>
<translation>Paga sólo la cuota mínima de %1</translation>
</message>
- <message>
- <source>Total Amount %1&lt;span style='font-size:10pt;font-weight:normal;'&gt;&lt;br /&gt;(=%2)&lt;/span&gt;</source>
- <translation>Monto Total %1&lt;span style='font-size:10pt;font-weight:normal;'&gt;&lt;br /&gt;(=%2)&lt;/span&gt;</translation>
+ <message numerus="yes">
+ <source>Estimated to begin confirmation within %n block(s).</source>
+ <translation><numerusform>Estimado para empezar la confirmación dentro de %n bloque.</numerusform><numerusform>Estimado para empezar la confirmación dentro de %n bloques.</numerusform></translation>
</message>
<message>
<source>The recipient address is not valid. Please recheck.</source>
@@ -2794,6 +2842,10 @@
<translation>Un error interno fatal ocurrió, ver debug.log para detalles</translation>
</message>
<message>
+ <source>Fee (in %s/kB) to add to transactions you send (default: %s)</source>
+ <translation>Comisión (en %s/KB) para agregar a las transacciones que envíe (por defecto: %s)</translation>
+ </message>
+ <message>
<source>Pruning blockstore...</source>
<translation>Poda blockstore ...</translation>
</message>
@@ -2867,10 +2919,6 @@
<translation>&lt;category&gt; puede ser:</translation>
</message>
<message>
- <source>Attempt to recover private keys from a corrupt wallet.dat</source>
- <translation>Intento de recuperar claves privadas de un wallet.dat corrupto</translation>
- </message>
- <message>
<source>Block creation options:</source>
<translation>Opciones de creación de bloques:</translation>
</message>
@@ -2991,10 +3039,6 @@
<translation>Usted necesita reconstruir la base de datos utilizando -reindex para cambiar -txindex</translation>
</message>
<message>
- <source>Imports blocks from external blk000??.dat file</source>
- <translation>Importa los bloques desde un archivo blk000??.dat externo</translation>
- </message>
- <message>
<source>Allow JSON-RPC connections from specified source. Valid for &lt;ip&gt; are a single IP (e.g. 1.2.3.4), a network/netmask (e.g. 1.2.3.4/255.255.255.0) or a network/CIDR (e.g. 1.2.3.4/24). This option can be specified multiple times</source>
<translation>Permitir conexiones JSON-RPC de origen especificado. Válido para son una sola IP (por ejemplo 1.2.3.4), una red/máscara de red (por ejemplo 1.2.3.4/255.255.255.0) o una red/CIDR (e.g. 1.2.3.4/24). Esta opción se puede especificar varias veces</translation>
</message>
@@ -3079,6 +3123,10 @@
<translation>Activando la mejor cadena...</translation>
</message>
<message>
+ <source>Attempt to recover private keys from a corrupt wallet.dat on startup</source>
+ <translation>Intento de recuperar claves privadas de un wallet.dat corrupto</translation>
+ </message>
+ <message>
<source>Cannot resolve -whitebind address: '%s'</source>
<translation>No se puede resolver -whitebind address: '%s'</translation>
</message>
@@ -3103,6 +3151,10 @@
<translation>Error al leer la base de datos, cerrando.</translation>
</message>
<message>
+ <source>Imports blocks from external blk000??.dat file on startup</source>
+ <translation>Importa los bloques desde un archivo externo blk000?.dat</translation>
+ </message>
+ <message>
<source>Information</source>
<translation>Información</translation>
</message>
@@ -3155,6 +3207,10 @@
<translation>Recibir y mostrar alertas de red P2P (default: %u)</translation>
</message>
<message>
+ <source>Rescan the block chain for missing wallet transactions on startup</source>
+ <translation>Rescanea la cadena de bloques para transacciones perdidas de la cartera</translation>
+ </message>
+ <message>
<source>Send trace/debug info to console instead of debug.log file</source>
<translation>Enviar información de trazas/depuración a la consola en lugar de al archivo debug.log</translation>
</message>
@@ -3223,6 +3279,10 @@
<translation>No es posible conectar con %s en este sistema (bind ha dado el error %s)</translation>
</message>
<message>
+ <source>Upgrade wallet to latest format on startup</source>
+ <translation>Actualizar el monedero al último formato</translation>
+ </message>
+ <message>
<source>Username for JSON-RPC connections</source>
<translation>Nombre de usuario para las conexiones JSON-RPC
</translation>
@@ -3240,10 +3300,6 @@
<translation>Eliminando todas las transacciones del monedero...</translation>
</message>
<message>
- <source>on startup</source>
- <translation>al iniciar</translation>
- </message>
- <message>
<source>wallet.dat corrupt, salvage failed</source>
<translation>wallet.dat corrupto. Ha fallado la recuperación.</translation>
</message>
@@ -3257,14 +3313,6 @@
<translation>Ejecutar un comando cuando cambia el mejor bloque (%s en cmd se sustituye por el hash de bloque)</translation>
</message>
<message>
- <source>Upgrade wallet to latest format</source>
- <translation>Actualizar el monedero al último formato</translation>
- </message>
- <message>
- <source>Rescan the block chain for missing wallet transactions</source>
- <translation>Volver a examinar la cadena de bloques en busca de transacciones del monedero perdidas</translation>
- </message>
- <message>
<source>This help message</source>
<translation>Este mensaje de ayuda
</translation>
diff --git a/src/qt/locale/bitcoin_es_CL.ts b/src/qt/locale/bitcoin_es_CL.ts
index e388b5a0cf..df17411ab5 100644
--- a/src/qt/locale/bitcoin_es_CL.ts
+++ b/src/qt/locale/bitcoin_es_CL.ts
@@ -1305,10 +1305,6 @@
<translation>Atención: Poco espacio en el disco duro</translation>
</message>
<message>
- <source>Imports blocks from external blk000??.dat file</source>
- <translation>Importar bloques desde el archivo externo blk000??.dat </translation>
- </message>
- <message>
<source>Information</source>
<translation>Información</translation>
</message>
@@ -1340,15 +1336,6 @@
</translation>
</message>
<message>
- <source>Upgrade wallet to latest format</source>
- <translation>Actualizar billetera al formato actual</translation>
- </message>
- <message>
- <source>Rescan the block chain for missing wallet transactions</source>
- <translation>Rescanea la cadena de bloques para transacciones perdidas de la cartera
-</translation>
- </message>
- <message>
<source>This help message</source>
<translation>Este mensaje de ayuda
</translation>
@@ -1375,6 +1362,14 @@
<translation>Dirección -proxy invalida: '%s'</translation>
</message>
<message>
+ <source>Cannot resolve -bind address: '%s'</source>
+ <translation>No se pudo resolver la dirección fija: '%s'</translation>
+ </message>
+ <message>
+ <source>Cannot resolve -externalip address: '%s'</source>
+ <translation>No se pudo resolver la dirección ip: '%s'</translation>
+ </message>
+ <message>
<source>Invalid amount for -paytxfee=&lt;amount&gt;: '%s'</source>
<translation>Cantidad inválida para -paytxfee=&lt;amount&gt;: '%s'</translation>
</message>
@@ -1395,6 +1390,14 @@
<translation>Cargando cartera...</translation>
</message>
<message>
+ <source>Cannot downgrade wallet</source>
+ <translation>No es posible desactualizar la billetera</translation>
+ </message>
+ <message>
+ <source>Cannot write default address</source>
+ <translation>No se pudo escribir la dirección por defecto</translation>
+ </message>
+ <message>
<source>Rescanning...</source>
<translation>Rescaneando...</translation>
</message>
diff --git a/src/qt/locale/bitcoin_es_DO.ts b/src/qt/locale/bitcoin_es_DO.ts
index 7a7a6e33f5..c67d642de7 100644
--- a/src/qt/locale/bitcoin_es_DO.ts
+++ b/src/qt/locale/bitcoin_es_DO.ts
@@ -2137,10 +2137,6 @@
<translation>&lt;category&gt; puede ser:</translation>
</message>
<message>
- <source>Attempt to recover private keys from a corrupt wallet.dat</source>
- <translation>Intento de recuperar claves privadas de un wallet.dat corrupto</translation>
- </message>
- <message>
<source>Block creation options:</source>
<translation>Opciones de creación de bloques:</translation>
</message>
@@ -2217,10 +2213,6 @@
<translation>Usted necesita reconstruir la base de datos utilizando -reindex para cambiar -txindex</translation>
</message>
<message>
- <source>Imports blocks from external blk000??.dat file</source>
- <translation>Importa los bloques desde un archivo blk000??.dat externo</translation>
- </message>
- <message>
<source>Execute command when a relevant alert is received or we see a really long fork (%s in cmd is replaced by message)</source>
<translation>Ejecutar un comando cuando se reciba una alerta importante o cuando veamos un fork demasiado largo (%s en cmd se reemplazará por el mensaje)</translation>
</message>
@@ -2298,10 +2290,6 @@
<translation>Aviso</translation>
</message>
<message>
- <source>on startup</source>
- <translation>al iniciar</translation>
- </message>
- <message>
<source>wallet.dat corrupt, salvage failed</source>
<translation>wallet.dat corrupto. Ha fallado la recuperación.</translation>
</message>
@@ -2315,14 +2303,6 @@
<translation>Ejecutar un comando cuando cambia el mejor bloque (%s en cmd se sustituye por el hash de bloque)</translation>
</message>
<message>
- <source>Upgrade wallet to latest format</source>
- <translation>Actualizar el monedero al último formato</translation>
- </message>
- <message>
- <source>Rescan the block chain for missing wallet transactions</source>
- <translation>Volver a examinar la cadena de bloques en busca de transacciones del monedero perdidas</translation>
- </message>
- <message>
<source>This help message</source>
<translation>Este mensaje de ayuda
</translation>
diff --git a/src/qt/locale/bitcoin_et.ts b/src/qt/locale/bitcoin_et.ts
index d2f98a9876..9279834af3 100644
--- a/src/qt/locale/bitcoin_et.ts
+++ b/src/qt/locale/bitcoin_et.ts
@@ -1680,10 +1680,6 @@
<translation>Hoiatus: toimus wallet.dat faili andmete päästmine! Originaal wallet.dat nimetati kaustas %s ümber wallet.{ajatempel}.bak'iks, jäägi või tehingute ebakõlade puhul tuleks teha backup'ist taastamine.</translation>
</message>
<message>
- <source>Attempt to recover private keys from a corrupt wallet.dat</source>
- <translation>Püüa vigasest wallet.dat failist taastada turvavõtmed</translation>
- </message>
- <message>
<source>Block creation options:</source>
<translation>Blokeeri loomise valikud:</translation>
</message>
@@ -1736,10 +1732,6 @@
<translation>Rahakoti valikud:</translation>
</message>
<message>
- <source>Imports blocks from external blk000??.dat file</source>
- <translation>Impordi blokid välisest blk000??.dat failist</translation>
- </message>
- <message>
<source>Information</source>
<translation>Informatsioon</translation>
</message>
@@ -1796,10 +1788,6 @@
<translation>Hoiatus</translation>
</message>
<message>
- <source>on startup</source>
- <translation>käivitamisel</translation>
- </message>
- <message>
<source>wallet.dat corrupt, salvage failed</source>
<translation>wallet.dat fail on katki, päästmine ebaõnnestus</translation>
</message>
@@ -1812,14 +1800,6 @@
<translation>Käivita käsklus, kui parim plokk muutub (käskluse %s asendatakse ploki hash'iga)</translation>
</message>
<message>
- <source>Upgrade wallet to latest format</source>
- <translation>Uuenda rahakott uusimasse vormingusse</translation>
- </message>
- <message>
- <source>Rescan the block chain for missing wallet transactions</source>
- <translation>Otsi ploki jadast rahakoti kadunud tehinguid</translation>
- </message>
- <message>
<source>This help message</source>
<translation>Käesolev abitekst</translation>
</message>
diff --git a/src/qt/locale/bitcoin_fa.ts b/src/qt/locale/bitcoin_fa.ts
index 05f8fc6251..fb4e25dfb8 100644
--- a/src/qt/locale/bitcoin_fa.ts
+++ b/src/qt/locale/bitcoin_fa.ts
@@ -1616,10 +1616,18 @@
<translation>تولید شده ولی قبول نشده</translation>
</message>
<message>
+ <source>Offline</source>
+ <translation>آفلاین</translation>
+ </message>
+ <message>
<source>Label</source>
<translation>برچسب</translation>
</message>
<message>
+ <source>Unconfirmed</source>
+ <translation>تایید نشده</translation>
+ </message>
+ <message>
<source>Received with</source>
<translation>دریافت‌شده با</translation>
</message>
@@ -1966,14 +1974,6 @@
<translation>زمانی که بهترین بلاک تغییر کرد، دستور را اجرا کن (%s در cmd با block hash جایگزین شده است)</translation>
</message>
<message>
- <source>Upgrade wallet to latest format</source>
- <translation>wallet را به جدیدترین فرمت روزآمد کنید</translation>
- </message>
- <message>
- <source>Rescan the block chain for missing wallet transactions</source>
- <translation>اسکان مجدد زنجیر بلوکها برای گم والت معامله</translation>
- </message>
- <message>
<source>This help message</source>
<translation>پیام کمکی</translation>
</message>
diff --git a/src/qt/locale/bitcoin_fa_IR.ts b/src/qt/locale/bitcoin_fa_IR.ts
index 6c16fc6f1f..fd9de2e049 100644
--- a/src/qt/locale/bitcoin_fa_IR.ts
+++ b/src/qt/locale/bitcoin_fa_IR.ts
@@ -1024,14 +1024,6 @@
<translation>دستور را وقتی بهترین بلاک تغییر کرد اجرا کن (%s در دستور توسط block hash جایگزین شده است)</translation>
</message>
<message>
- <source>Upgrade wallet to latest format</source>
- <translation>wallet را به جدیدترین نسخه روزآمد کنید</translation>
- </message>
- <message>
- <source>Rescan the block chain for missing wallet transactions</source>
- <translation>زنجیره بلاک را برای تراکنش جا افتاده در WALLET دوباره اسکن کنید</translation>
- </message>
- <message>
<source>This help message</source>
<translation>این پیام راهنما</translation>
</message>
diff --git a/src/qt/locale/bitcoin_fi.ts b/src/qt/locale/bitcoin_fi.ts
index 8cf6d01653..7026fff1f5 100644
--- a/src/qt/locale/bitcoin_fi.ts
+++ b/src/qt/locale/bitcoin_fi.ts
@@ -1482,14 +1482,6 @@
<translation>Viimeisin vastaanotettu</translation>
</message>
<message>
- <source>Bytes Sent</source>
- <translation>Tavua lähetetty</translation>
- </message>
- <message>
- <source>Bytes Received</source>
- <translation>Tavua vastaanotettu</translation>
- </message>
- <message>
<source>Ping Time</source>
<translation>Vasteaika</translation>
</message>
@@ -1982,10 +1974,6 @@
<translation>Maksupyyntö on vanhentunut.</translation>
</message>
<message>
- <source>Pay only the minimum fee of %1</source>
- <translation>Maksa vain vähimmäiskulu %1</translation>
- </message>
- <message>
<source>The recipient address is not valid. Please recheck.</source>
<translation>Vastaanottajan osoite ei ole kelvollinen. Tarkistathan uudelleen.</translation>
</message>
@@ -2792,10 +2780,6 @@
<translation>&lt;category&gt; voi olla:</translation>
</message>
<message>
- <source>Attempt to recover private keys from a corrupt wallet.dat</source>
- <translation>Yritetään palauttaa privaattiavaimia korruptoituneesta wallet.dat -lompakkotiedostosta</translation>
- </message>
- <message>
<source>Block creation options:</source>
<translation>Lohkon luonnin asetukset:</translation>
</message>
@@ -2912,10 +2896,6 @@
<translation>Sinun tulee uudelleenrakentaa tietokanta käyttäen -reindex vaihtaen -txindex</translation>
</message>
<message>
- <source>Imports blocks from external blk000??.dat file</source>
- <translation>Tuodaan lohkoja ulkoisesta blk000??.dat tiedostosta</translation>
- </message>
- <message>
<source>Cannot obtain a lock on data directory %s. Bitcoin Core is probably already running.</source>
<translation>Ei voida lukita data-hakemistoa %s. Bitcoin Core on luultavasti jo käynnissä.</translation>
</message>
@@ -3060,10 +3040,6 @@
<translation>Tyhjennetään kaikki rahansiirrot lompakosta....</translation>
</message>
<message>
- <source>on startup</source>
- <translation>käynnistyksessä</translation>
- </message>
- <message>
<source>wallet.dat corrupt, salvage failed</source>
<translation>wallet.dat -lompakkotiedosto korruptoitunut, korjaaminen epäonnistui</translation>
</message>
@@ -3076,14 +3052,6 @@
<translation>Suorita käsky kun paras lohko muuttuu (%s cmd on vaihdettu block hashin kanssa)</translation>
</message>
<message>
- <source>Upgrade wallet to latest format</source>
- <translation>Päivitä lompakko uusimpaan formaattiin</translation>
- </message>
- <message>
- <source>Rescan the block chain for missing wallet transactions</source>
- <translation>Skannaa uudelleen lohkoketju lompakon puuttuvien rahasiirtojen vuoksi</translation>
- </message>
- <message>
<source>This help message</source>
<translation>Tämä ohjeviesti</translation>
</message>
diff --git a/src/qt/locale/bitcoin_fr.ts b/src/qt/locale/bitcoin_fr.ts
index a2799f99fc..97dccdac06 100644
--- a/src/qt/locale/bitcoin_fr.ts
+++ b/src/qt/locale/bitcoin_fr.ts
@@ -1486,14 +1486,6 @@
<translation>Dernière réception</translation>
</message>
<message>
- <source>Bytes Sent</source>
- <translation>Octets envoyés</translation>
- </message>
- <message>
- <source>Bytes Received</source>
- <translation>Octets reçus</translation>
- </message>
- <message>
<source>Ping Time</source>
<translation>Temps de ping</translation>
</message>
@@ -2002,14 +1994,6 @@
<translation><numerusform>Il est estimé que la confirmation commencera dans %n bloc.</numerusform><numerusform>Il est estimé que la confirmation commencera dans %n blocs.</numerusform></translation>
</message>
<message>
- <source>Pay only the minimum fee of %1</source>
- <translation>Payer seulement les frais minimum de %1</translation>
- </message>
- <message>
- <source>Total Amount %1&lt;span style='font-size:10pt;font-weight:normal;'&gt;&lt;br /&gt;(=%2)&lt;/span&gt;</source>
- <translation>Montant total %1&lt;span style='font-size:10pt;font-weight:normal;'&gt;&lt;br /&gt;(=%2)&lt;/span&gt;</translation>
- </message>
- <message>
<source>The recipient address is not valid. Please recheck.</source>
<translation>L'adresse du destinataire est invalide. Veuillez la vérifier.</translation>
</message>
@@ -2860,10 +2844,6 @@
<translation>&lt;category&gt; peut être :</translation>
</message>
<message>
- <source>Attempt to recover private keys from a corrupt wallet.dat</source>
- <translation>Tenter de récupérer les clefs privées d'un wallet.dat corrompu</translation>
- </message>
- <message>
<source>Block creation options:</source>
<translation>Options de création de bloc :</translation>
</message>
@@ -2984,10 +2964,6 @@
<translation>Vous devez reconstruire la base de données en utilisant -reindex afin de modifier -txindex</translation>
</message>
<message>
- <source>Imports blocks from external blk000??.dat file</source>
- <translation>Importe des blocs depuis un fichier blk000??.dat externe</translation>
- </message>
- <message>
<source>Allow JSON-RPC connections from specified source. Valid for &lt;ip&gt; are a single IP (e.g. 1.2.3.4), a network/netmask (e.g. 1.2.3.4/255.255.255.0) or a network/CIDR (e.g. 1.2.3.4/24). This option can be specified multiple times</source>
<translation>Permettre les connexions JSON-RPC de sources spécifiques. Valide pour &lt;ip&gt; qui sont une IP simple (p. ex. 1.2.3.4), un réseau/masque réseau (p. ex. 1.2.3.4/255.255.255.0) ou un réseau/CIDR (p. ex. 1.2.3.4/24). Cette option peut être être spécifiée plusieurs fois</translation>
</message>
@@ -3236,10 +3212,6 @@
<translation>Supprimer toutes les transactions du portefeuille...</translation>
</message>
<message>
- <source>on startup</source>
- <translation>au démarrage</translation>
- </message>
- <message>
<source>wallet.dat corrupt, salvage failed</source>
<translation>wallet.dat corrompu, la récupération a échoué</translation>
</message>
@@ -3252,14 +3224,6 @@
<translation>Exécuter la commande lorsque le meilleur bloc change (%s dans cmd est remplacé par le hachage du bloc)</translation>
</message>
<message>
- <source>Upgrade wallet to latest format</source>
- <translation>Mettre à niveau le portefeuille vers le format le plus récent</translation>
- </message>
- <message>
- <source>Rescan the block chain for missing wallet transactions</source>
- <translation>Réanalyser la chaîne de blocs pour les transactions de portefeuille manquantes</translation>
- </message>
- <message>
<source>This help message</source>
<translation>Ce message d'aide</translation>
</message>
diff --git a/src/qt/locale/bitcoin_gl.ts b/src/qt/locale/bitcoin_gl.ts
index 3edaef7e16..79f0d46d3f 100644
--- a/src/qt/locale/bitcoin_gl.ts
+++ b/src/qt/locale/bitcoin_gl.ts
@@ -1966,10 +1966,6 @@
<translation>&lt;categoría&gt; pode ser:</translation>
</message>
<message>
- <source>Attempt to recover private keys from a corrupt wallet.dat</source>
- <translation>Tentar recuperar claves privadas dende un wallet.dat corrupto</translation>
- </message>
- <message>
<source>Block creation options:</source>
<translation>Opcións de creación de bloque:</translation>
</message>
@@ -2042,10 +2038,6 @@
<translation>Precisas reconstruír a base de datos empregando -reindex para cambiar -txindex</translation>
</message>
<message>
- <source>Imports blocks from external blk000??.dat file</source>
- <translation>Importa bloques dende arquivos blk000??.dat externos</translation>
- </message>
- <message>
<source>Execute command when a relevant alert is received or we see a really long fork (%s in cmd is replaced by message)</source>
<translation>Executar comando cando se recibe unha alerta relevante ou vemos un fork realmente longo (%s no cmd é substituído pola mensaxe)</translation>
</message>
@@ -2122,14 +2114,6 @@
<translation>Executar comando cando o mellor bloque cambie (%s no comando é sustituído polo hash do bloque)</translation>
</message>
<message>
- <source>Upgrade wallet to latest format</source>
- <translation>Actualizar moedeiro ao formato máis recente</translation>
- </message>
- <message>
- <source>Rescan the block chain for missing wallet transactions</source>
- <translation>Rescanear transaccións ausentes na cadea de bloques</translation>
- </message>
- <message>
<source>This help message</source>
<translation>Esta mensaxe de axuda</translation>
</message>
diff --git a/src/qt/locale/bitcoin_he.ts b/src/qt/locale/bitcoin_he.ts
index 8e985e9f16..048b268200 100644
--- a/src/qt/locale/bitcoin_he.ts
+++ b/src/qt/locale/bitcoin_he.ts
@@ -1332,14 +1332,6 @@
<translation>קבלה אחרונה</translation>
</message>
<message>
- <source>Bytes Sent</source>
- <translation>בתים שנשלחו</translation>
- </message>
- <message>
- <source>Bytes Received</source>
- <translation>בתים שהתקבלו</translation>
- </message>
- <message>
<source>Ping Time</source>
<translation>זמן המענה</translation>
</message>
@@ -2534,10 +2526,6 @@
<translation>&lt;קטגוריה&gt; יכולה להיות:</translation>
</message>
<message>
- <source>Attempt to recover private keys from a corrupt wallet.dat</source>
- <translation>נסה לשחזר מפתחות פרטיים מקובץ wallet.dat מושחת.</translation>
- </message>
- <message>
<source>Block creation options:</source>
<translation>אפשרויות יצירת מקטע:</translation>
</message>
@@ -2642,10 +2630,6 @@
<translation>עליך לבנות מחדש את מסד הנתונים תוך שימוש ב־‎-reindex על מנת לשנות את ‎-txindex</translation>
</message>
<message>
- <source>Imports blocks from external blk000??.dat file</source>
- <translation>מיובאים מקטעים מקובצי blk000??.dat חיצוניים</translation>
- </message>
- <message>
<source>Execute command when a relevant alert is received or we see a really long fork (%s in cmd is replaced by message)</source>
<translation>הרץ פקודה כאשר ההתראה הרלוונטית מתקבלת או כשאנחנו עדים לפיצול ארוך מאוד (%s בשורת הפקודה יוחלף ע"י ההודעה)</translation>
</message>
@@ -2770,10 +2754,6 @@
<translation>אזהרה</translation>
</message>
<message>
- <source>on startup</source>
- <translation>עם ההפעלה</translation>
- </message>
- <message>
<source>wallet.dat corrupt, salvage failed</source>
<translation>קובץ wallet.dat מושחת, החילוץ נכשל</translation>
</message>
@@ -2786,14 +2766,6 @@
<translation>יש לבצע פקודה זו כשהמקטע הטוב ביותר משתנה (%s בפקודה יוחלף בגיבוב המקטע)</translation>
</message>
<message>
- <source>Upgrade wallet to latest format</source>
- <translation>שדרוג הארנק למבנה העדכני</translation>
- </message>
- <message>
- <source>Rescan the block chain for missing wallet transactions</source>
- <translation>יש לסרוק מחדש את שרשרת המקטעים למציאת העברות חסרות בארנק</translation>
- </message>
- <message>
<source>This help message</source>
<translation>הודעת העזרה הזו</translation>
</message>
diff --git a/src/qt/locale/bitcoin_hr.ts b/src/qt/locale/bitcoin_hr.ts
index 80371dfaf7..aa28ecf24f 100644
--- a/src/qt/locale/bitcoin_hr.ts
+++ b/src/qt/locale/bitcoin_hr.ts
@@ -1058,14 +1058,6 @@
<translation>Trajanje veze</translation>
</message>
<message>
- <source>Bytes Sent</source>
- <translation>Bajtova poslano</translation>
- </message>
- <message>
- <source>Bytes Received</source>
- <translation>Bajtova primljeno</translation>
- </message>
- <message>
<source>Last block time</source>
<translation>Posljednje vrijeme bloka</translation>
</message>
@@ -1784,10 +1776,6 @@
<translation>Pogreška: Nema dovoljno prostora na disku!</translation>
</message>
<message>
- <source>Imports blocks from external blk000??.dat file</source>
- <translation>Uvozi blokove sa vanjske blk000??.dat datoteke</translation>
- </message>
- <message>
<source>Information</source>
<translation>Informacija</translation>
</message>
@@ -1816,14 +1804,6 @@
<translation>Izvršite naredbu kada se najbolji blok promjeni (%s u cmd je zamjenjen sa block hash)</translation>
</message>
<message>
- <source>Upgrade wallet to latest format</source>
- <translation>Nadogradite novčanik u posljednji format.</translation>
- </message>
- <message>
- <source>Rescan the block chain for missing wallet transactions</source>
- <translation>Ponovno pretraži lanac blokova za transakcije koje nedostaju</translation>
- </message>
- <message>
<source>This help message</source>
<translation>Ova poruka za pomoć</translation>
</message>
diff --git a/src/qt/locale/bitcoin_hu.ts b/src/qt/locale/bitcoin_hu.ts
index 6722854589..27cfedc728 100644
--- a/src/qt/locale/bitcoin_hu.ts
+++ b/src/qt/locale/bitcoin_hu.ts
@@ -1318,14 +1318,6 @@
<translation>Legutóbbi fogadás</translation>
</message>
<message>
- <source>Bytes Sent</source>
- <translation>Küldött bájtok</translation>
- </message>
- <message>
- <source>Bytes Received</source>
- <translation>Fogadott bájtok</translation>
- </message>
- <message>
<source>Ping Time</source>
<translation>Ping idő</translation>
</message>
@@ -2468,15 +2460,6 @@
<translation>Parancs, amit akkor hajt végre, amikor a legjobb blokk megváltozik (%s a cmd-ban lecserélődik a blokk hash-re)</translation>
</message>
<message>
- <source>Upgrade wallet to latest format</source>
- <translation>A Tárca frissítése a legfrissebb formátumra</translation>
- </message>
- <message>
- <source>Rescan the block chain for missing wallet transactions</source>
- <translation>Blokklánc újraszkennelése hiányzó tárca-tranzakciók után
-</translation>
- </message>
- <message>
<source>This help message</source>
<translation>Ez a súgó-üzenet
</translation>
diff --git a/src/qt/locale/bitcoin_id_ID.ts b/src/qt/locale/bitcoin_id_ID.ts
index e2caa6d867..22ce3efecb 100644
--- a/src/qt/locale/bitcoin_id_ID.ts
+++ b/src/qt/locale/bitcoin_id_ID.ts
@@ -2,6 +2,10 @@
<context>
<name>AddressBookPage</name>
<message>
+ <source>Right-click to edit address or label</source>
+ <translation>Klik-kanan untuk mengubah alamat atau label</translation>
+ </message>
+ <message>
<source>Create a new address</source>
<translation>Buat alamat baru</translation>
</message>
@@ -454,6 +458,36 @@
<translation>Menyusul...</translation>
</message>
<message>
+ <source>Date: %1
+</source>
+ <translation>Tanggal: %1
+</translation>
+ </message>
+ <message>
+ <source>Amount: %1
+</source>
+ <translation>Jumlah: %1
+</translation>
+ </message>
+ <message>
+ <source>Type: %1
+</source>
+ <translation>Tipe: %1
+</translation>
+ </message>
+ <message>
+ <source>Label: %1
+</source>
+ <translation>Label: %1
+</translation>
+ </message>
+ <message>
+ <source>Address: %1
+</source>
+ <translation>Alamat: %1
+</translation>
+ </message>
+ <message>
<source>Sent transaction</source>
<translation>Transaksi terkirim</translation>
</message>
@@ -480,6 +514,10 @@
<context>
<name>CoinControlDialog</name>
<message>
+ <source>Coin Selection</source>
+ <translation>Pemilihan Koin</translation>
+ </message>
+ <message>
<source>Quantity:</source>
<translation>Kuantitas:</translation>
</message>
@@ -898,6 +936,18 @@
<translation>Port proxy (cth. 9050)</translation>
</message>
<message>
+ <source>IPv4</source>
+ <translation>IPv4</translation>
+ </message>
+ <message>
+ <source>IPv6</source>
+ <translation>IPv6</translation>
+ </message>
+ <message>
+ <source>Tor</source>
+ <translation>Tor</translation>
+ </message>
+ <message>
<source>&amp;Window</source>
<translation>&amp;Jendela</translation>
</message>
@@ -958,6 +1008,10 @@
<translation>Restart klien diperlukan untuk mengaktifkan perubahan.</translation>
</message>
<message>
+ <source>Client will be shut down. Do you want to proceed?</source>
+ <translation>Klien akan dimatikan, apakah anda hendak melanjutkan?</translation>
+ </message>
+ <message>
<source>This change would require a client restart.</source>
<translation>Perubahan ini akan memerlukan restart klien</translation>
</message>
@@ -1001,6 +1055,10 @@
<translation>Saldo ditambang yang masih terlalu muda</translation>
</message>
<message>
+ <source>Balances</source>
+ <translation>Saldo:</translation>
+ </message>
+ <message>
<source>Total:</source>
<translation>Jumlah:</translation>
</message>
@@ -1020,6 +1078,10 @@
<translation>Alamat pembayaran salah %1</translation>
</message>
<message>
+ <source>Payment request rejected</source>
+ <translation>Permintaan pembayaran ditolak</translation>
+ </message>
+ <message>
<source>Requested payment amount of %1 is too small (considered dust).</source>
<translation>Nilai pembayaran %1 yang diminta oleh Anda terlalu sedikit (dianggap debu).</translation>
</message>
@@ -1028,6 +1090,10 @@
<translation>Gagalan permintaan pembayaran</translation>
</message>
<message>
+ <source>Payment request expired.</source>
+ <translation>Permintaan pembayaran telah kadaluarsa</translation>
+ </message>
+ <message>
<source>Refund from %1</source>
<translation>Pembayaran kembali dari %1</translation>
</message>
@@ -1050,6 +1116,10 @@
</context>
<context>
<name>PeerTableModel</name>
+ <message>
+ <source>User Agent</source>
+ <translation>Agen Pengguna</translation>
+ </message>
</context>
<context>
<name>QObject</name>
@@ -1058,6 +1128,10 @@
<translation>Nilai</translation>
</message>
<message>
+ <source>Enter a Bitcoin address (e.g. %1)</source>
+ <translation>Masukkan alamat Bitcoin (contoh %1)</translation>
+ </message>
+ <message>
<source>%1 h</source>
<translation>%1 Jam</translation>
</message>
@@ -1144,6 +1218,24 @@
<translation>Jumlah blok terkini</translation>
</message>
<message>
+ <source>Sent</source>
+ <translation>Terkirim</translation>
+ </message>
+ <message>
+ <source>Version</source>
+ <translation>Versi</translation>
+ </message>
+ <message>
+ <source>User Agent</source>
+ <translation>Agen Pengguna
+
+</translation>
+ </message>
+ <message>
+ <source>Services</source>
+ <translation>Layanan</translation>
+ </message>
+ <message>
<source>Last block time</source>
<translation>Waktu blok terakhir</translation>
</message>
@@ -1188,6 +1280,26 @@
<translation>Bersihkan konsol</translation>
</message>
<message>
+ <source>1 &amp;hour</source>
+ <translation>1 &amp;jam</translation>
+ </message>
+ <message>
+ <source>1 &amp;day</source>
+ <translation>1 &amp;hari</translation>
+ </message>
+ <message>
+ <source>1 &amp;week</source>
+ <translation>1 &amp;minggu</translation>
+ </message>
+ <message>
+ <source>1 &amp;year</source>
+ <translation>1 &amp;tahun</translation>
+ </message>
+ <message>
+ <source>Welcome to the Bitcoin Core RPC console.</source>
+ <translation>Selamat datang di konsol RPC Bitcoin.</translation>
+ </message>
+ <message>
<source>Use up and down arrows to navigate history, and &lt;b&gt;Ctrl-L&lt;/b&gt; to clear screen.</source>
<translation>Gunakan panah keatas dan kebawah untuk menampilkan sejarah, dan &lt;b&gt;Ctrl-L&lt;/b&gt; untuk bersihkan layar.</translation>
</message>
@@ -1211,7 +1323,19 @@
<source>%1 GB</source>
<translation>%1 GB</translation>
</message>
- </context>
+ <message>
+ <source>Yes</source>
+ <translation>Ya</translation>
+ </message>
+ <message>
+ <source>No</source>
+ <translation>Tidak</translation>
+ </message>
+ <message>
+ <source>Unknown</source>
+ <translation>Tidak diketahui</translation>
+ </message>
+</context>
<context>
<name>ReceiveCoinsDialog</name>
<message>
@@ -1432,6 +1556,22 @@
<translation>Alamat uang kembali yang kustom</translation>
</message>
<message>
+ <source>Recommended:</source>
+ <translation>Disarankan</translation>
+ </message>
+ <message>
+ <source>Confirmation time:</source>
+ <translation>Waktu konfirmasi:</translation>
+ </message>
+ <message>
+ <source>normal</source>
+ <translation>normal</translation>
+ </message>
+ <message>
+ <source>fast</source>
+ <translation>cepat</translation>
+ </message>
+ <message>
<source>Send to multiple recipients at once</source>
<translation>Kirim ke beberapa penerima sekaligus</translation>
</message>
@@ -1492,6 +1632,10 @@
<translation>Salin uang kembali</translation>
</message>
<message>
+ <source>Total Amount %1</source>
+ <translation>Jumlah Total %1</translation>
+ </message>
+ <message>
<source>or</source>
<translation>atau</translation>
</message>
@@ -1516,6 +1660,14 @@
<translation>Gagal: Transaksi ditolak. Ini mungkin terjadi jika beberapa dari koin dalam dompet Anda telah digunakan, seperti ketika Anda menggunakan salinan wallet.dat dan beberapa koin telah dibelanjakan dalam salinan tersebut tetapi disini tidak tertandai sebagai terpakai.</translation>
</message>
<message>
+ <source>A fee higher than %1 is considered an absurdly high fee.</source>
+ <translation>Biaya yang lebih tinggi dari %1 dianggap biaya tak masuk akal.</translation>
+ </message>
+ <message>
+ <source>Payment request expired.</source>
+ <translation>Permintaan pembayaran telah kadaluarsa</translation>
+ </message>
+ <message>
<source>Warning: Invalid Bitcoin address</source>
<translation>Awas: Alamat Bitcoin tidak sah</translation>
</message>
@@ -2214,10 +2366,6 @@
<translation>(pengaturan awal: 1)</translation>
</message>
<message>
- <source>Attempt to recover private keys from a corrupt wallet.dat</source>
- <translation>Coba memulihkan kunci-kunci pribadi dari wallet.dat yang rusak</translation>
- </message>
- <message>
<source>Block creation options:</source>
<translation>Pilihan pembuatan blok:</translation>
</message>
@@ -2306,14 +2454,14 @@
<translation>Harus membangun ulang database menggunakan -reindex supaya mengubah -txindex</translation>
</message>
<message>
- <source>Imports blocks from external blk000??.dat file</source>
- <translation>Impor blok dari eksternal berkas blk000???.dat</translation>
- </message>
- <message>
<source>Cannot obtain a lock on data directory %s. Bitcoin Core is probably already running.</source>
<translation>Tidak bisa mengunci data directory %s. Kemungkinan Bitcoin Core sudah mulai.</translation>
</message>
<message>
+ <source>Connect through SOCKS5 proxy</source>
+ <translation>Hubungkan melalui proxy SOCKS5</translation>
+ </message>
+ <message>
<source>Information</source>
<translation>Informasi</translation>
</message>
@@ -2390,14 +2538,6 @@
<translation>Menjalankan perintah ketika perubahan blok terbaik (%s dalam cmd digantikan oleh hash blok)</translation>
</message>
<message>
- <source>Upgrade wallet to latest format</source>
- <translation>Perbarui dompet ke format terbaru</translation>
- </message>
- <message>
- <source>Rescan the block chain for missing wallet transactions</source>
- <translation>Pindai ulang rantai-blok untuk transaksi dompet yang hilang</translation>
- </message>
- <message>
<source>This help message</source>
<translation>Pesan bantuan ini</translation>
</message>
diff --git a/src/qt/locale/bitcoin_it.ts b/src/qt/locale/bitcoin_it.ts
index b613bc888e..7a2b7bd843 100644
--- a/src/qt/locale/bitcoin_it.ts
+++ b/src/qt/locale/bitcoin_it.ts
@@ -1487,14 +1487,6 @@ Per specificare più URL separarli con una barra verticale "|".</translation>
<translation>Ultima Ricezione</translation>
</message>
<message>
- <source>Bytes Sent</source>
- <translation>Byte Inviati</translation>
- </message>
- <message>
- <source>Bytes Received</source>
- <translation>Byte Ricevuti</translation>
- </message>
- <message>
<source>Ping Time</source>
<translation>Tempo di Ping</translation>
</message>
@@ -1999,10 +1991,6 @@ Per specificare più URL separarli con una barra verticale "|".</translation>
<translation>Richiesta di pagamento scaduta.</translation>
</message>
<message>
- <source>Pay only the minimum fee of %1</source>
- <translation>Paga solamente la commissione minima di %1</translation>
- </message>
- <message>
<source>The recipient address is not valid. Please recheck.</source>
<translation>L'indirizzo del beneficiario non è valido. Si prega di ricontrollare.</translation>
</message>
@@ -2853,10 +2841,6 @@ Per specificare più URL separarli con una barra verticale "|".</translation>
<translation>Valori possibili per &lt;category&gt;:</translation>
</message>
<message>
- <source>Attempt to recover private keys from a corrupt wallet.dat</source>
- <translation>Tenta di recuperare le chiavi private da un wallet.dat corrotto</translation>
- </message>
- <message>
<source>Block creation options:</source>
<translation>Opzioni creazione blocco:</translation>
</message>
@@ -2977,10 +2961,6 @@ Per specificare più URL separarli con una barra verticale "|".</translation>
<translation>È necessario ricostruire il database usando -reindex per cambiare -txindex</translation>
</message>
<message>
- <source>Imports blocks from external blk000??.dat file</source>
- <translation>Importa blocchi da un file blk000??.dat esterno</translation>
- </message>
- <message>
<source>Allow JSON-RPC connections from specified source. Valid for &lt;ip&gt; are a single IP (e.g. 1.2.3.4), a network/netmask (e.g. 1.2.3.4/255.255.255.0) or a network/CIDR (e.g. 1.2.3.4/24). This option can be specified multiple times</source>
<translation>Permette connessioni JSON-RPC dall'origine specificata. I valori validi per &lt;ip&gt; sono un singolo IP (ad es. 1.2.3.4), una network/netmask (ad es. 1.2.3.4/255.255.255.0) oppure una network/CIDR (ad es. 1.2.3.4/24). Questa opzione può essere specificata più volte.</translation>
</message>
@@ -3229,10 +3209,6 @@ Per specificare più URL separarli con una barra verticale "|".</translation>
<translation>Eliminazione dal portamonete di tutte le transazioni...</translation>
</message>
<message>
- <source>on startup</source>
- <translation>all'avvio</translation>
- </message>
- <message>
<source>wallet.dat corrupt, salvage failed</source>
<translation>wallet.dat corrotto, recupero fallito</translation>
</message>
@@ -3245,14 +3221,6 @@ Per specificare più URL separarli con una barra verticale "|".</translation>
<translation>Esegue un comando quando il miglior blocco cambia (%s nel cmd è sostituito dall'hash del blocco)</translation>
</message>
<message>
- <source>Upgrade wallet to latest format</source>
- <translation>Aggiorna il wallet all'ultimo formato</translation>
- </message>
- <message>
- <source>Rescan the block chain for missing wallet transactions</source>
- <translation>Ripete la scansione della block chain per individuare le transazioni che mancano dal portamonete</translation>
- </message>
- <message>
<source>This help message</source>
<translation>Questo messaggio di aiuto</translation>
</message>
diff --git a/src/qt/locale/bitcoin_ja.ts b/src/qt/locale/bitcoin_ja.ts
index 5770fe9a02..140ed2445b 100644
--- a/src/qt/locale/bitcoin_ja.ts
+++ b/src/qt/locale/bitcoin_ja.ts
@@ -1550,14 +1550,6 @@
<translation>最終受信</translation>
</message>
<message>
- <source>Bytes Sent</source>
- <translation>送信済バイト数</translation>
- </message>
- <message>
- <source>Bytes Received</source>
- <translation>受信済バイト数</translation>
- </message>
- <message>
<source>Ping Time</source>
<translation>Ping時間</translation>
</message>
@@ -2070,6 +2062,10 @@
<translation>釣り銭をコピー</translation>
</message>
<message>
+ <source>Total Amount %1</source>
+ <translation>合計: %1</translation>
+ </message>
+ <message>
<source>or</source>
<translation>または</translation>
</message>
@@ -2101,19 +2097,15 @@
<source>Payment request expired.</source>
<translation>支払いリクエストの期限が切れました。</translation>
</message>
+ <message>
+ <source>Pay only the required fee of %1</source>
+ <translation>要求手数料 %1 のみを支払う</translation>
+ </message>
<message numerus="yes">
<source>Estimated to begin confirmation within %n block(s).</source>
<translation><numerusform>%n ブロック以内に検証が開始されると予想されます。</numerusform></translation>
</message>
<message>
- <source>Pay only the minimum fee of %1</source>
- <translation>最小手数料 %1 のみを支払う</translation>
- </message>
- <message>
- <source>Total Amount %1&lt;span style='font-size:10pt;font-weight:normal;'&gt;&lt;br /&gt;(=%2)&lt;/span&gt;</source>
- <translation>総額 %1&lt;span style='font-size:10pt;font-weight:normal;'&gt;&lt;br /&gt;(=%2)&lt;/span&gt;</translation>
- </message>
- <message>
<source>The recipient address is not valid. Please recheck.</source>
<translation>受取アドレスが不正です。再チェックしてください。</translation>
</message>
@@ -2892,10 +2884,6 @@
<translation>コマンドラインと JSON-RPC コマンドを許可</translation>
</message>
<message>
- <source>Fees (in %s/kB) smaller than this are considered zero fee for relaying (default: %s)</source>
- <translation>中継の際、この値未満の手数料 (%s/kB単位) はゼロであるとみなす (デフォルト: %s)</translation>
- </message>
- <message>
<source>If &lt;category&gt; is not supplied or if &lt;category&gt; = 1, output all debugging information.</source>
<translation>&lt;category&gt; が与えられなかった場合や &lt;category&gt; = 1 の場合には、すべてのデバッグ情報が出力されます。</translation>
</message>
@@ -3020,10 +3008,6 @@
<translation>&lt;category&gt;は以下の値を指定できます:</translation>
</message>
<message>
- <source>Attempt to recover private keys from a corrupt wallet.dat</source>
- <translation>壊れた wallet.dat から秘密鍵を復旧することを試す</translation>
- </message>
- <message>
<source>Block creation options:</source>
<translation>ブロック作成オプション:</translation>
</message>
@@ -3181,10 +3165,6 @@
<translation>-txindex を変更するには -reindex を使用してデータベースを再構築する必要があります</translation>
</message>
<message>
- <source>Imports blocks from external blk000??.dat file</source>
- <translation>外部の blk000??.dat ファイルからブロックをインポート</translation>
- </message>
- <message>
<source>Allow JSON-RPC connections from specified source. Valid for &lt;ip&gt; are a single IP (e.g. 1.2.3.4), a network/netmask (e.g. 1.2.3.4/255.255.255.0) or a network/CIDR (e.g. 1.2.3.4/24). This option can be specified multiple times</source>
<translation>指定したアクセス元からのJSON-RPC接続を許可する。有効な&lt;ip&gt;は、単一のIP (例 1.2.3.4)、ネットワーク/ネットマスク (1.2.3.4/255.255.255.0)、またはネットワーク/CIDR (1.2.3.4/24)です。このオプションは複数回指定できます。</translation>
</message>
@@ -3217,6 +3197,10 @@
<translation>関連のアラートをもらってもすごく長いのフォークを見てもコマンドを実行 (コマンドの中にあるの%sはメッセージから置き換えさせる)</translation>
</message>
<message>
+ <source>Fees (in %s/kB) smaller than this are considered zero fee for relaying, mining and transaction creation (default: %s)</source>
+ <translation>トランザクションの中継、採掘および作成の際には、この値未満の手数料 (%s/kB単位) はゼロであるとみなす (デフォルト: %s)</translation>
+ </message>
+ <message>
<source>If paytxfee is not set, include enough fee so transactions begin confirmation on average within n blocks (default: %u)</source>
<translation>paytxfee が設定されていなかった場合、平均して n ブロック以内にトランザクションが検証され始めるのに十分な手数料を含める (初期値: %u)</translation>
</message>
@@ -3273,6 +3257,10 @@
<translation>最優良のチェインを有効化しています...</translation>
</message>
<message>
+ <source>Attempt to recover private keys from a corrupt wallet.dat on startup</source>
+ <translation>起動時に壊れた wallet.dat から秘密鍵を復旧することを試す</translation>
+ </message>
+ <message>
<source>Cannot resolve -whitebind address: '%s'</source>
<translation>-whitebind アドレス '%s' を解決できません</translation>
</message>
@@ -3297,6 +3285,10 @@
<translation>データベースの読み込みエラー。シャットダウンします。</translation>
</message>
<message>
+ <source>Imports blocks from external blk000??.dat file on startup</source>
+ <translation>起動時に外部の blk000??.dat ファイルからブロックをインポート</translation>
+ </message>
+ <message>
<source>Information</source>
<translation>情報</translation>
</message>
@@ -3353,6 +3345,10 @@
<translation>システム上の制約から、-maxconnections を %d から %d に削減しました。</translation>
</message>
<message>
+ <source>Rescan the block chain for missing wallet transactions on startup</source>
+ <translation>起動時に失ったウォレットの取引のブロック チェーンを再スキャン</translation>
+ </message>
+ <message>
<source>Send trace/debug info to console instead of debug.log file</source>
<translation>トレース/デバッグ情報を debug.log ファイルの代わりにコンソールへ送る</translation>
</message>
@@ -3421,6 +3417,10 @@
<translation>このコンピュータの %s にバインドすることができません (バインドが返したエラーは %s)</translation>
</message>
<message>
+ <source>Upgrade wallet to latest format on startup</source>
+ <translation>起動時にウォレットを最新のフォーマットにアップグレード</translation>
+ </message>
+ <message>
<source>Username for JSON-RPC connections</source>
<translation>JSON-RPC 接続のユーザー名</translation>
</message>
@@ -3441,10 +3441,6 @@
<translation>ZeroMQ通知オプション:</translation>
</message>
<message>
- <source>on startup</source>
- <translation>起動時</translation>
- </message>
- <message>
<source>wallet.dat corrupt, salvage failed</source>
<translation>wallet.dat が壊れ、復旧に失敗しました</translation>
</message>
@@ -3457,14 +3453,6 @@
<translation>最良のブロックに変更する際にコマンドを実行 (cmd の %s はブロック ハッシュに置換される)</translation>
</message>
<message>
- <source>Upgrade wallet to latest format</source>
- <translation>ウォレットを最新のフォーマットにアップグレード</translation>
- </message>
- <message>
- <source>Rescan the block chain for missing wallet transactions</source>
- <translation>失ったウォレットの取引のブロック チェーンを再スキャン</translation>
- </message>
- <message>
<source>This help message</source>
<translation>このヘルプ メッセージ</translation>
</message>
diff --git a/src/qt/locale/bitcoin_ka.ts b/src/qt/locale/bitcoin_ka.ts
index 6e5db78589..e8f5286697 100644
--- a/src/qt/locale/bitcoin_ka.ts
+++ b/src/qt/locale/bitcoin_ka.ts
@@ -2234,10 +2234,6 @@
<translation>&lt;category&gt; შეიძლება იყოს:</translation>
</message>
<message>
- <source>Attempt to recover private keys from a corrupt wallet.dat</source>
- <translation>პირადი გასაღებების აღდგენის მცდელობა wallet.dat-იდან</translation>
- </message>
- <message>
<source>Block creation options:</source>
<translation>ბლოკის შექმნის ოპციები:</translation>
</message>
@@ -2322,10 +2318,6 @@
<translation>საჭიროა ბაზის ხელახალი აგება, გამოიყენეთ -reindex რათა შეცვალოთ -txindex</translation>
</message>
<message>
- <source>Imports blocks from external blk000??.dat file</source>
- <translation>ბლოკების იმპორტი გარე blk000??.dat ფაილიდან</translation>
- </message>
- <message>
<source>Execute command when a relevant alert is received or we see a really long fork (%s in cmd is replaced by message)</source>
<translation>ბრძანების შესრულება შესაბამისი უწყების მიღებისას ან როცა შეინიშნება საგრძნობი გახლეჩა (cmd-ში %s შეიცვლება მესიჯით)</translation>
</message>
@@ -2410,14 +2402,6 @@
<translation>კომანდის შესრულება უკეთესი ბლოკის გამოჩენისას (%s კომანდაში ჩანაცვლდება ბლოკის ჰეშით)</translation>
</message>
<message>
- <source>Upgrade wallet to latest format</source>
- <translation>საფულის ფორმატის განახლება</translation>
- </message>
- <message>
- <source>Rescan the block chain for missing wallet transactions</source>
- <translation>ბლოკების ჯაჭვის გადამოწმება საფულეში გამორჩენილ ტრანსაქციებზე</translation>
- </message>
- <message>
<source>This help message</source>
<translation>ეს ტექსტი</translation>
</message>
diff --git a/src/qt/locale/bitcoin_ko_KR.ts b/src/qt/locale/bitcoin_ko_KR.ts
index 653ea40882..8243618f11 100644
--- a/src/qt/locale/bitcoin_ko_KR.ts
+++ b/src/qt/locale/bitcoin_ko_KR.ts
@@ -2304,10 +2304,6 @@
<translation>(기본값: 1)</translation>
</message>
<message>
- <source>Attempt to recover private keys from a corrupt wallet.dat</source>
- <translation>손상된 wallet.dat에서 개인키 복원을 시도합니다</translation>
- </message>
- <message>
<source>Block creation options:</source>
<translation>블록 생성 옵션:</translation>
</message>
@@ -2404,10 +2400,6 @@
<translation>-txindex를 바꾸기 위해서는 -reindex를 사용해서 데이터베이스를 재구성해야 합니다. </translation>
</message>
<message>
- <source>Imports blocks from external blk000??.dat file</source>
- <translation>외부 blk000??.dat 파일에서 블록을 가져옵니다.</translation>
- </message>
- <message>
<source>Cannot obtain a lock on data directory %s. Bitcoin Core is probably already running.</source>
<translation>데이터 디렉토리 %s에 락을 걸 수 없었습니다. 비트코인 코어가 이미 실행 중인 것으로 보입니다.</translation>
</message>
@@ -2496,10 +2488,6 @@
<translation>지갑의 모든거래내역 건너뛰기...</translation>
</message>
<message>
- <source>on startup</source>
- <translation>구동 중</translation>
- </message>
- <message>
<source>wallet.dat corrupt, salvage failed</source>
<translation>wallet.dat 파일이 손상되었고 복구가 실패하였습니다.</translation>
</message>
@@ -2512,14 +2500,6 @@
<translation>최고의 블럭이 변하면 명령을 실행(cmd 에 있는 %s 는 블럭 해시에 의해 대체되어 짐)</translation>
</message>
<message>
- <source>Upgrade wallet to latest format</source>
- <translation>지갑을 최근 형식으로 개선하시오</translation>
- </message>
- <message>
- <source>Rescan the block chain for missing wallet transactions</source>
- <translation>누락된 지갑 송금에 대한 블록 체인 다시 검색</translation>
- </message>
- <message>
<source>This help message</source>
<translation>도움말 메시지입니다</translation>
</message>
diff --git a/src/qt/locale/bitcoin_la.ts b/src/qt/locale/bitcoin_la.ts
index b1e14fb859..b297a35d4b 100644
--- a/src/qt/locale/bitcoin_la.ts
+++ b/src/qt/locale/bitcoin_la.ts
@@ -1410,10 +1410,6 @@
<translation>Monitio: wallet.data corrupta, data salvata! Originalis wallet.dat salvata ut wallet.{timestamp}.bak in %s; si pendendum tuum vel transactiones pravae sunt, oportet ab conservato restituere.</translation>
</message>
<message>
- <source>Attempt to recover private keys from a corrupt wallet.dat</source>
- <translation>Conare recipere claves privatas de corrupto wallet.dat</translation>
- </message>
- <message>
<source>Block creation options:</source>
<translation>Optiones creandi frustorum:</translation>
</message>
@@ -1466,10 +1462,6 @@
<translation>Verificante cassidilem...</translation>
</message>
<message>
- <source>Imports blocks from external blk000??.dat file</source>
- <translation>Importat frusta ab externa plica blk000??.dat</translation>
- </message>
- <message>
<source>Information</source>
<translation>Informatio</translation>
</message>
@@ -1538,14 +1530,6 @@
<translation>Pelle mandatum quando optissimum frustum mutat (%s in mandato substituitur ab hash frusti)</translation>
</message>
<message>
- <source>Upgrade wallet to latest format</source>
- <translation>Progredere cassidile ad formam recentissimam</translation>
- </message>
- <message>
- <source>Rescan the block chain for missing wallet transactions</source>
- <translation>Iterum perlege catenam frustorum propter absentes cassidilis transactiones</translation>
- </message>
- <message>
<source>This help message</source>
<translation>Hic nuntius auxilii</translation>
</message>
diff --git a/src/qt/locale/bitcoin_lt.ts b/src/qt/locale/bitcoin_lt.ts
index d91c183884..7820977375 100644
--- a/src/qt/locale/bitcoin_lt.ts
+++ b/src/qt/locale/bitcoin_lt.ts
@@ -872,14 +872,6 @@
<translation>Versija</translation>
</message>
<message>
- <source>Bytes Sent</source>
- <translation>Nusiųsti baitai</translation>
- </message>
- <message>
- <source>Bytes Received</source>
- <translation>Gauti baitai</translation>
- </message>
- <message>
<source>Last block time</source>
<translation>Paskutinio bloko laikas</translation>
</message>
@@ -1662,14 +1654,6 @@
<translation>Slaptažodis JSON-RPC sujungimams</translation>
</message>
<message>
- <source>Upgrade wallet to latest format</source>
- <translation>Atnaujinti piniginę į naujausią formatą</translation>
- </message>
- <message>
- <source>Rescan the block chain for missing wallet transactions</source>
- <translation>Ieškoti prarastų piniginės sandorių blokų grandinėje</translation>
- </message>
- <message>
<source>This help message</source>
<translation>Pagelbos žinutė</translation>
</message>
diff --git a/src/qt/locale/bitcoin_lv_LV.ts b/src/qt/locale/bitcoin_lv_LV.ts
index db2eabaf78..fa7abdf2ab 100644
--- a/src/qt/locale/bitcoin_lv_LV.ts
+++ b/src/qt/locale/bitcoin_lv_LV.ts
@@ -2122,10 +2122,6 @@
<translation>&lt;category&gt; var būt:</translation>
</message>
<message>
- <source>Attempt to recover private keys from a corrupt wallet.dat</source>
- <translation>Mēģināt atgūt privātās atslēgas no bojāta wallet.dat</translation>
- </message>
- <message>
<source>Block creation options:</source>
<translation>Bloka izveidošanas iestatījumi:</translation>
</message>
@@ -2166,10 +2162,6 @@
<translation>Maciņa iespējas:</translation>
</message>
<message>
- <source>Imports blocks from external blk000??.dat file</source>
- <translation>Importēt blokus no ārējās blk000??.dat datnes</translation>
- </message>
- <message>
<source>Information</source>
<translation>Informācija</translation>
</message>
@@ -2218,10 +2210,6 @@
<translation>Brīdinājums</translation>
</message>
<message>
- <source>on startup</source>
- <translation>startēšanas laikā</translation>
- </message>
- <message>
<source>wallet.dat corrupt, salvage failed</source>
<translation>wallet.dat ir bojāts, glābšana neizdevās</translation>
</message>
@@ -2234,14 +2222,6 @@
<translation>Izpildīt komandu, kad labāk atbilstošais bloks izmainās (%s cmd aizvieto ar bloka hešu)</translation>
</message>
<message>
- <source>Upgrade wallet to latest format</source>
- <translation>Atjaunot maciņa formātu uz jaunāko</translation>
- </message>
- <message>
- <source>Rescan the block chain for missing wallet transactions</source>
- <translation>Atkārtoti skanēt bloku virkni, meklējot trūkstošās maciņa transakcijas</translation>
- </message>
- <message>
<source>This help message</source>
<translation>Šis palīdzības paziņojums</translation>
</message>
diff --git a/src/qt/locale/bitcoin_mn.ts b/src/qt/locale/bitcoin_mn.ts
index a44d3b6fb3..d1a5976224 100644
--- a/src/qt/locale/bitcoin_mn.ts
+++ b/src/qt/locale/bitcoin_mn.ts
@@ -1034,10 +1034,6 @@
<translation>Түрүйвчийн сонголтууд:</translation>
</message>
<message>
- <source>Upgrade wallet to latest format</source>
- <translation>Түрүйвчийг хамгийн сүүлийн үеийн форматруу шинэчлэх</translation>
- </message>
- <message>
<source>Loading addresses...</source>
<translation>Хаягуудыг ачааллаж байна...</translation>
</message>
diff --git a/src/qt/locale/bitcoin_nb.ts b/src/qt/locale/bitcoin_nb.ts
index 9f5344ecab..6cded5e135 100644
--- a/src/qt/locale/bitcoin_nb.ts
+++ b/src/qt/locale/bitcoin_nb.ts
@@ -1550,14 +1550,6 @@
<translation>Siste Mottatte</translation>
</message>
<message>
- <source>Bytes Sent</source>
- <translation>Byte Sendt</translation>
- </message>
- <message>
- <source>Bytes Received</source>
- <translation>Byte Mottatt</translation>
- </message>
- <message>
<source>Ping Time</source>
<translation>Ping-tid</translation>
</message>
@@ -2070,6 +2062,10 @@
<translation>Kopier veksel</translation>
</message>
<message>
+ <source>Total Amount %1</source>
+ <translation>Totalt Beløp %1</translation>
+ </message>
+ <message>
<source>or</source>
<translation>eller</translation>
</message>
@@ -2101,19 +2097,15 @@
<source>Payment request expired.</source>
<translation>Betalingsetterspørringen har utløpt.</translation>
</message>
+ <message>
+ <source>Pay only the required fee of %1</source>
+ <translation>Betal kun påkrevd gebyr på %1</translation>
+ </message>
<message numerus="yes">
<source>Estimated to begin confirmation within %n block(s).</source>
<translation><numerusform>Anslått til å begynne bekreftelse innen %n blokk.</numerusform><numerusform>Anslått til å begynne bekreftelse innen %n blokker.</numerusform></translation>
</message>
<message>
- <source>Pay only the minimum fee of %1</source>
- <translation>Betal kun minimumsgebyret på %1</translation>
- </message>
- <message>
- <source>Total Amount %1&lt;span style='font-size:10pt;font-weight:normal;'&gt;&lt;br /&gt;(=%2)&lt;/span&gt;</source>
- <translation>Totalt Beløp %1&lt;span style='font-size:10pt;font-weight:normal;'&gt;&lt;br /&gt;(=%2)&lt;/span&gt;</translation>
- </message>
- <message>
<source>The recipient address is not valid. Please recheck.</source>
<translation>Mottakeradressen er ikke gyldig. Vennligst kontroller på nytt.</translation>
</message>
@@ -2892,10 +2884,6 @@
<translation>Ta imot kommandolinje- og JSON-RPC-kommandoer</translation>
</message>
<message>
- <source>Fees (in %s/kB) smaller than this are considered zero fee for relaying (default: %s)</source>
- <translation>Gebyrer (i %s/kB) mindre enn dette vil anses som gebyrfrie (for videresending) (standard: %s)</translation>
- </message>
- <message>
<source>If &lt;category&gt; is not supplied or if &lt;category&gt; = 1, output all debugging information.</source>
<translation>Hvis &lt;category&gt; ikke er oppgitt eller hvis &lt;category&gt; = 1, ta ut all informasjon for feilsøking.</translation>
</message>
@@ -3016,10 +3004,6 @@
<translation>&lt;category&gt; kan være:</translation>
</message>
<message>
- <source>Attempt to recover private keys from a corrupt wallet.dat</source>
- <translation>Forsøk å berge private nøkler fra en korrupt wallet.dat</translation>
- </message>
- <message>
<source>Block creation options:</source>
<translation>Valg for opprettelse av blokker:</translation>
</message>
@@ -3176,10 +3160,6 @@
<translation>Du må gjenoppbygge databasen med å bruke -reindex for å endre -txindex</translation>
</message>
<message>
- <source>Imports blocks from external blk000??.dat file</source>
- <translation>Importerer blokker fra ekstern fil blk000??.dat</translation>
- </message>
- <message>
<source>Allow JSON-RPC connections from specified source. Valid for &lt;ip&gt; are a single IP (e.g. 1.2.3.4), a network/netmask (e.g. 1.2.3.4/255.255.255.0) or a network/CIDR (e.g. 1.2.3.4/24). This option can be specified multiple times</source>
<translation>Tillat JSON-RPC-tilkoblinger fra angitt kilde. Gyldig for &lt;ip&gt; er en enkelt IP (f. eks. 1.2.3.4), et nettverk/nettmaske (f. eks. 1.2.3.4/255.255.255.0) eller et nettverk/CIDR (f. eks. 1.2.3.4/24). Dette alternativet kan angis flere ganger</translation>
</message>
@@ -3212,6 +3192,10 @@
<translation>Utfør kommando når et relevant varsel er mottatt eller vi ser en veldig lang gaffel (%s i kommando er erstattet med melding)</translation>
</message>
<message>
+ <source>Fees (in %s/kB) smaller than this are considered zero fee for relaying, mining and transaction creation (default: %s)</source>
+ <translation>Gebyrer (i %s/kB) mindre enn dette anses som null gebyr for videresending, graving og laging av transaksjoner (standardverdi: %s)</translation>
+ </message>
+ <message>
<source>If paytxfee is not set, include enough fee so transactions begin confirmation on average within n blocks (default: %u)</source>
<translation>Hvis paytxfee ikke er angitt, inkluderer da nok i gebyr til at transaksjoner gjennomsnittligt bekreftes innen n blokker (standardverdi: %u)</translation>
</message>
@@ -3268,6 +3252,10 @@
<translation>Aktiverer beste kjede...</translation>
</message>
<message>
+ <source>Attempt to recover private keys from a corrupt wallet.dat on startup</source>
+ <translation>Forsøk å berge private nøkler fra en korrupt wallet.dat ved oppstart</translation>
+ </message>
+ <message>
<source>Cannot resolve -whitebind address: '%s'</source>
<translation>Kan ikke løse -whitebind-adresse: '%s'</translation>
</message>
@@ -3292,6 +3280,10 @@
<translation>Feil ved lesing fra database, stenger ned.</translation>
</message>
<message>
+ <source>Imports blocks from external blk000??.dat file on startup</source>
+ <translation>Importerer blokker fra ekstern fil blk000??.dat ved oppstart</translation>
+ </message>
+ <message>
<source>Information</source>
<translation>Informasjon</translation>
</message>
@@ -3348,6 +3340,10 @@
<translation>Reduserer -maxconnections fra %d til %d, pga. systembegrensninger.</translation>
</message>
<message>
+ <source>Rescan the block chain for missing wallet transactions on startup</source>
+ <translation>Se gjennom blokkjeden etter manglende lommeboktransaksjoner ved oppstart</translation>
+ </message>
+ <message>
<source>Send trace/debug info to console instead of debug.log file</source>
<translation>Send spor-/feilsøkingsinformasjon til konsollen istedenfor filen debug.log</translation>
</message>
@@ -3416,6 +3412,10 @@
<translation>Kan ikke binde til %s på denne datamaskinen (binding returnerte feilen %s)</translation>
</message>
<message>
+ <source>Upgrade wallet to latest format on startup</source>
+ <translation>Oppgrader lommebok til nyeste format ved oppstart</translation>
+ </message>
+ <message>
<source>Username for JSON-RPC connections</source>
<translation>Brukernavn for JSON-RPC forbindelser</translation>
</message>
@@ -3436,10 +3436,6 @@
<translation>Valg for ZeroMQ-meldinger:</translation>
</message>
<message>
- <source>on startup</source>
- <translation>ved oppstart</translation>
- </message>
- <message>
<source>wallet.dat corrupt, salvage failed</source>
<translation>wallet.dat korrupt, bergning feilet</translation>
</message>
@@ -3452,14 +3448,6 @@
<translation>Utfør kommando når beste blokk endrer seg (%s i kommandoen erstattes med blokkens hash)</translation>
</message>
<message>
- <source>Upgrade wallet to latest format</source>
- <translation>Oppgrader lommebok til nyeste format</translation>
- </message>
- <message>
- <source>Rescan the block chain for missing wallet transactions</source>
- <translation>Se gjennom blokkjeden etter manglende lommeboktransaksjoner</translation>
- </message>
- <message>
<source>This help message</source>
<translation>Denne hjelpemeldingen</translation>
</message>
diff --git a/src/qt/locale/bitcoin_nl.ts b/src/qt/locale/bitcoin_nl.ts
index cbb1dc0fe3..c307f0ab6a 100644
--- a/src/qt/locale/bitcoin_nl.ts
+++ b/src/qt/locale/bitcoin_nl.ts
@@ -1490,14 +1490,6 @@
<translation>Laatst ontvangen</translation>
</message>
<message>
- <source>Bytes Sent</source>
- <translation>Bytes Verzonden</translation>
- </message>
- <message>
- <source>Bytes Received</source>
- <translation>Bytes Ontvangen</translation>
- </message>
- <message>
<source>Ping Time</source>
<translation>Ping Tijd</translation>
</message>
@@ -1994,10 +1986,6 @@
<translation>Betalingsverzoek verlopen.</translation>
</message>
<message>
- <source>Pay only the minimum fee of %1</source>
- <translation>Betaal alleen de minimale transactiekosten van %1</translation>
- </message>
- <message>
<source>The recipient address is not valid. Please recheck.</source>
<translation>Het adres van de ontvanger is niet geldig. Gelieve opnieuw te controleren..</translation>
</message>
@@ -2840,10 +2828,6 @@
<translation>&lt;category&gt; kan zijn:</translation>
</message>
<message>
- <source>Attempt to recover private keys from a corrupt wallet.dat</source>
- <translation>Poog de geheime sleutels uit een corrupt wallet.dat bestand terug te halen</translation>
- </message>
- <message>
<source>Block creation options:</source>
<translation>Blokcreatie-opties:</translation>
</message>
@@ -2956,10 +2940,6 @@
<translation>Om -txindex te kunnen veranderen dient u de database opnieuw te bouwen met gebruik van -reindex.</translation>
</message>
<message>
- <source>Imports blocks from external blk000??.dat file</source>
- <translation>Importeert blokken van extern blk000??.dat bestand</translation>
- </message>
- <message>
<source>Allow JSON-RPC connections from specified source. Valid for &lt;ip&gt; are a single IP (e.g. 1.2.3.4), a network/netmask (e.g. 1.2.3.4/255.255.255.0) or a network/CIDR (e.g. 1.2.3.4/24). This option can be specified multiple times</source>
<translation>Sta JSON-RPC verbindingen toe vanuit een gespecificeerde bron. Geldig voor &lt;ip&gt; zijn een enkel IP (bijv. 1.2.3.4), een netwerk/netmask (bijv. 1.2.3.4/255.255.255.0) of een netwerk/CIDR (bijv. 1.2.3.4/24). Deze optie kan meerdere keren gespecificeerd worden.</translation>
</message>
@@ -3189,10 +3169,6 @@
<translation>Bezig met het zappen van alle transacties van de portemonnee...</translation>
</message>
<message>
- <source>on startup</source>
- <translation>bij opstarten</translation>
- </message>
- <message>
<source>wallet.dat corrupt, salvage failed</source>
<translation>wallet.dat corrupt, veiligstellen mislukt</translation>
</message>
@@ -3205,14 +3181,6 @@
<translation>Voer commando uit zodra het beste blok verandert (%s in cmd wordt vervangen door blockhash)</translation>
</message>
<message>
- <source>Upgrade wallet to latest format</source>
- <translation>Vernieuw portemonnee naar nieuwste versie</translation>
- </message>
- <message>
- <source>Rescan the block chain for missing wallet transactions</source>
- <translation>Doorzoek de blokketen op ontbrekende portemonnee-transacties</translation>
- </message>
- <message>
<source>This help message</source>
<translation>Dit helpbericht</translation>
</message>
diff --git a/src/qt/locale/bitcoin_pam.ts b/src/qt/locale/bitcoin_pam.ts
index f5e74261f0..893ae43c55 100644
--- a/src/qt/locale/bitcoin_pam.ts
+++ b/src/qt/locale/bitcoin_pam.ts
@@ -1406,14 +1406,6 @@
<translation>I-execute ing command istung mialilan ya ing best block (%s in cmd is replaced by block hash)</translation>
</message>
<message>
- <source>Upgrade wallet to latest format</source>
- <translation>I-upgrade ing wallet king pekabayung porma</translation>
- </message>
- <message>
- <source>Rescan the block chain for missing wallet transactions</source>
- <translation>I-scan pasibayu ing block chain para kareng mauaualang transaksion</translation>
- </message>
- <message>
<source>This help message</source>
<translation>Ining saup a mensayi</translation>
</message>
diff --git a/src/qt/locale/bitcoin_pl.ts b/src/qt/locale/bitcoin_pl.ts
index ed828539ee..228e02a5ee 100644
--- a/src/qt/locale/bitcoin_pl.ts
+++ b/src/qt/locale/bitcoin_pl.ts
@@ -1490,14 +1490,6 @@
<translation>Ostatnio odebrano</translation>
</message>
<message>
- <source>Bytes Sent</source>
- <translation>Bajtów wysłano</translation>
- </message>
- <message>
- <source>Bytes Received</source>
- <translation>Bajtów pobrano</translation>
- </message>
- <message>
<source>Ping Time</source>
<translation>Czas odpowiedzi</translation>
</message>
@@ -1994,14 +1986,6 @@
<translation><numerusform>Przybliżony czas zatwierdzenia: %n bloków.</numerusform><numerusform>Przybliżony czas zatwierdzenia: %n bloków.</numerusform><numerusform>Przybliżony czas zatwierdzenia: %n bloków.</numerusform></translation>
</message>
<message>
- <source>Pay only the minimum fee of %1</source>
- <translation>Płac tylko minimalna opłatę %1</translation>
- </message>
- <message>
- <source>Total Amount %1&lt;span style='font-size:10pt;font-weight:normal;'&gt;&lt;br /&gt;(=%2)&lt;/span&gt;</source>
- <translation>Całkowita kwota %1&lt;span style='font-size:10pt;font-weight:normal;'&gt;&lt;br /&gt;(=%2)&lt;/span&gt;</translation>
- </message>
- <message>
<source>The recipient address is not valid. Please recheck.</source>
<translation>Adres odbiorcy jest nieprawidłowy, proszę sprawić ponownie.</translation>
</message>
@@ -2852,10 +2836,6 @@
<translation>&lt;category&gt; mogą być:</translation>
</message>
<message>
- <source>Attempt to recover private keys from a corrupt wallet.dat</source>
- <translation>Próbuj odzyskać klucze prywatne z uszkodzonego wallet.dat</translation>
- </message>
- <message>
<source>Block creation options:</source>
<translation>Opcje tworzenia bloku:</translation>
</message>
@@ -2976,10 +2956,6 @@
<translation>Musisz przebudować bazę używając parametru -reindex aby zmienić -txindex</translation>
</message>
<message>
- <source>Imports blocks from external blk000??.dat file</source>
- <translation>Importuj bloki z zewnętrznego pliku blk000??.dat</translation>
- </message>
- <message>
<source>Allow JSON-RPC connections from specified source. Valid for &lt;ip&gt; are a single IP (e.g. 1.2.3.4), a network/netmask (e.g. 1.2.3.4/255.255.255.0) or a network/CIDR (e.g. 1.2.3.4/24). This option can be specified multiple times</source>
<translation>Pozwól na połączenia JSON-RPC z podanego źródła. Jako &lt;ip&gt; prawidłowe jest pojedyncze IP (np. 1.2.3.4), podsieć/maska (np. 1.2.3.4/255.255.255.0) lub sieć/CIDR (np. 1.2.3.4/24). Opcja ta może być użyta wiele razy.</translation>
</message>
@@ -3216,10 +3192,6 @@
<translation>Usuwam wszystkie transakcje z portfela...</translation>
</message>
<message>
- <source>on startup</source>
- <translation>podczas uruchamiania</translation>
- </message>
- <message>
<source>wallet.dat corrupt, salvage failed</source>
<translation>wallet.dat uszkodzony, odtworzenie się nie powiodło</translation>
</message>
@@ -3232,14 +3204,6 @@
<translation>Wykonaj polecenie kiedy najlepszy blok ulegnie zmianie (%s w komendzie zastanie zastąpione przez hash bloku)</translation>
</message>
<message>
- <source>Upgrade wallet to latest format</source>
- <translation>Zaktualizuj portfel do najnowszego formatu.</translation>
- </message>
- <message>
- <source>Rescan the block chain for missing wallet transactions</source>
- <translation>Przeskanuj łańcuch bloków w poszukiwaniu zaginionych transakcji portfela</translation>
- </message>
- <message>
<source>This help message</source>
<translation>Ta wiadomość pomocy</translation>
</message>
diff --git a/src/qt/locale/bitcoin_pt_BR.ts b/src/qt/locale/bitcoin_pt_BR.ts
index da28365de0..4863591ac4 100644
--- a/src/qt/locale/bitcoin_pt_BR.ts
+++ b/src/qt/locale/bitcoin_pt_BR.ts
@@ -222,7 +222,15 @@
</context>
<context>
<name>BanTableModel</name>
- </context>
+ <message>
+ <source>IP/Netmask</source>
+ <translation>IP/Máscara</translation>
+ </message>
+ <message>
+ <source>Banned Until</source>
+ <translation>Banido até</translation>
+ </message>
+</context>
<context>
<name>BitcoinGUI</name>
<message>
@@ -379,7 +387,7 @@
</message>
<message>
<source>&amp;Settings</source>
- <translation>&amp;Configurações</translation>
+ <translation>&amp;definições</translation>
</message>
<message>
<source>&amp;Help</source>
@@ -1068,6 +1076,30 @@
<translation>Porta do serviço de proxy (ex. 9050)</translation>
</message>
<message>
+ <source>Used for reaching peers via:</source>
+ <translation>Usado para alcançar participantes via:</translation>
+ </message>
+ <message>
+ <source>IPv4</source>
+ <translation>IPv4</translation>
+ </message>
+ <message>
+ <source>IPv6</source>
+ <translation>IPv6</translation>
+ </message>
+ <message>
+ <source>Tor</source>
+ <translation>Tor</translation>
+ </message>
+ <message>
+ <source>Connect to the Bitcoin network through a separate SOCKS5 proxy for Tor hidden services.</source>
+ <translation>Conecte-se à rede Bitcoin através de um proxy SOCKS5 separado para utilizar serviços ocultos Tor.</translation>
+ </message>
+ <message>
+ <source>Use separate SOCKS5 proxy to reach peers via Tor hidden services:</source>
+ <translation>Use um proxy SOCKS5 separado para alcançar participantes da rede via serviços ocultos Tor:</translation>
+ </message>
+ <message>
<source>&amp;Window</source>
<translation>&amp;Janela</translation>
</message>
@@ -1454,10 +1486,18 @@
<translation>&amp;Pares</translation>
</message>
<message>
+ <source>Banned peers</source>
+ <translation>Nós banidos</translation>
+ </message>
+ <message>
<source>Select a peer to view detailed information.</source>
<translation>Selecione um cliente para ver informações detalhadas.</translation>
</message>
<message>
+ <source>Whitelisted</source>
+ <translation>Lista branca</translation>
+ </message>
+ <message>
<source>Direction</source>
<translation>Direção</translation>
</message>
@@ -1466,6 +1506,18 @@
<translation>Versão</translation>
</message>
<message>
+ <source>Starting Block</source>
+ <translation>Bloco inicial</translation>
+ </message>
+ <message>
+ <source>Synced Headers</source>
+ <translation>Cabeçalhos Sincronizados</translation>
+ </message>
+ <message>
+ <source>Synced Blocks</source>
+ <translation>Blocos Sincronizados</translation>
+ </message>
+ <message>
<source>User Agent</source>
<translation>User Agent</translation>
</message>
@@ -1490,18 +1542,14 @@
<translation>Ultimo Recebido</translation>
</message>
<message>
- <source>Bytes Sent</source>
- <translation>Bytes Enviados</translation>
- </message>
- <message>
- <source>Bytes Received</source>
- <translation>Bytes recebidos</translation>
- </message>
- <message>
<source>Ping Time</source>
<translation>Ping</translation>
</message>
<message>
+ <source>The duration of a currently outstanding ping.</source>
+ <translation>A duração de um ping excepcional no momento.</translation>
+ </message>
+ <message>
<source>Last block time</source>
<translation>Horário do último bloco</translation>
</message>
@@ -1546,6 +1594,34 @@
<translation>Limpar console</translation>
</message>
<message>
+ <source>&amp;Disconnect Node</source>
+ <translation>&amp;Desconectar Nó</translation>
+ </message>
+ <message>
+ <source>Ban Node for</source>
+ <translation>Banir nó por</translation>
+ </message>
+ <message>
+ <source>1 &amp;hour</source>
+ <translation>1 &amp;hora</translation>
+ </message>
+ <message>
+ <source>1 &amp;day</source>
+ <translation>1 &amp;dia</translation>
+ </message>
+ <message>
+ <source>1 &amp;week</source>
+ <translation>1 &amp;semana</translation>
+ </message>
+ <message>
+ <source>1 &amp;year</source>
+ <translation>1 &amp;ano</translation>
+ </message>
+ <message>
+ <source>&amp;Unban Node</source>
+ <translation>&amp;Desbanir nó</translation>
+ </message>
+ <message>
<source>Welcome to the Bitcoin Core RPC console.</source>
<translation>Bem vindo ao console de RPC do Bitcoin.</translation>
</message>
@@ -1574,6 +1650,10 @@
<translation>%1 GB</translation>
</message>
<message>
+ <source>(node id: %1)</source>
+ <translation>(id do nó: %1)</translation>
+ </message>
+ <message>
<source>via %1</source>
<translation>por %1</translation>
</message>
@@ -1966,6 +2046,10 @@
<translation>Copia alteração</translation>
</message>
<message>
+ <source>Total Amount %1</source>
+ <translation>Quantia Total %1</translation>
+ </message>
+ <message>
<source>or</source>
<translation>ou</translation>
</message>
@@ -1997,15 +2081,15 @@
<source>Payment request expired.</source>
<translation>Pedido de pagamento expirado.</translation>
</message>
+ <message>
+ <source>Pay only the required fee of %1</source>
+ <translation>Pagar somente a taxa requerida de %1</translation>
+ </message>
<message numerus="yes">
<source>Estimated to begin confirmation within %n block(s).</source>
<translation><numerusform>Confirmação estimada em %n bloco.</numerusform><numerusform>Confirmação estimada em %n blocos.</numerusform></translation>
</message>
<message>
- <source>Pay only the minimum fee of %1</source>
- <translation>Pagar somente a taxa mínima de %1</translation>
- </message>
- <message>
<source>The recipient address is not valid. Please recheck.</source>
<translation>O endereço do destinatário é inválido. Favor confirmar.</translation>
</message>
@@ -2780,6 +2864,18 @@
<translation>Aceitar linha de comando e comandos JSON-RPC</translation>
</message>
<message>
+ <source>If &lt;category&gt; is not supplied or if &lt;category&gt; = 1, output all debugging information.</source>
+ <translation>Se &lt;category&gt; não for suprida ou se &lt;category&gt; = 1, mostrar toda informação de depuração.</translation>
+ </message>
+ <message>
+ <source>Error: A fatal internal error occurred, see debug.log for details</source>
+ <translation>Erro: Um erro interno fatal ocorreu, veja debug.log para detalhes</translation>
+ </message>
+ <message>
+ <source>Fee (in %s/kB) to add to transactions you send (default: %s)</source>
+ <translation>Taxa (em %s/kB) a ser adicionada às transações que você mandar (padrão: %s)</translation>
+ </message>
+ <message>
<source>Pruning blockstore...</source>
<translation>Prunando os blocos existentes...</translation>
</message>
@@ -2788,6 +2884,10 @@
<translation>Rodar em segundo plano como serviço e aceitar comandos</translation>
</message>
<message>
+ <source>Unable to start HTTP server. See debug log for details.</source>
+ <translation>Não foi possível iniciar o servidor HTTP. Veja o log para detaihes.</translation>
+ </message>
+ <message>
<source>Accept connections from outside (default: 1 if no -proxy or -connect)</source>
<translation>Aceitar conexões externas (padrão: 1 se opções -proxy ou -connect não estiverem presentes)</translation>
</message>
@@ -2812,6 +2912,10 @@
<translation>Define o número de threads de verificação de script (%u a %d, 0 = automático, &lt;0 = número de cores deixados livres, padrão: %d)</translation>
</message>
<message>
+ <source>The block database contains a block which appears to be from the future. This may be due to your computer's date and time being set incorrectly. Only rebuild the block database if you are sure that your computer's date and time are correct</source>
+ <translation>O banco de dados de blocos contém um bloco que parece ser do futuro. Isso pode ser devido à data e hora do seu computador estarem configuradas incorretamente. Apenas reconstrua o banco de dados de blocos se você estiver certo de que a data e hora de seu computador estão corretas.</translation>
+ </message>
+ <message>
<source>This is a pre-release test build - use at your own risk - do not use for mining or merchant applications</source>
<translation>Este pode ser um build de teste pré-lançamento - use por sua conta e risco - não use para mineração ou aplicações de comércio.</translation>
</message>
@@ -2820,6 +2924,14 @@
<translation>Impossível ouvir em %s neste computador. Provavelmente o Bitcoin já está sendo executado.</translation>
</message>
<message>
+ <source>Use UPnP to map the listening port (default: 1 when listening and no -proxy)</source>
+ <translation>Use UPnP para mapear a porta escutada (padrão: 1 quando escutando e sem -proxy)</translation>
+ </message>
+ <message>
+ <source>WARNING: abnormally high number of blocks generated, %d blocks received in the last %d hours (%d expected)</source>
+ <translation>AVISO: números estranhamente altos de blocos gerados, %d blocos recebidos nas últimas %d horas (%d esperados)</translation>
+ </message>
+ <message>
<source>WARNING: check your network connection, %d blocks received in the last %d hours (%d expected)</source>
<translation>ATENÇÃO: verifique sua conexão %d blocos recebidos nas últimas %d horas (%d tempo estimado)</translation>
</message>
@@ -2844,12 +2956,12 @@
<translation>(padrão: 1)</translation>
</message>
<message>
- <source>&lt;category&gt; can be:</source>
- <translation>&lt;category&gt; pode ser:</translation>
+ <source>-maxmempool must be at least %d MB</source>
+ <translation>-maxmempool deve ser pelo menos %d MB</translation>
</message>
<message>
- <source>Attempt to recover private keys from a corrupt wallet.dat</source>
- <translation>Tentar recuperar chaves privadas de um arquivo wallet.dat corrompido</translation>
+ <source>&lt;category&gt; can be:</source>
+ <translation>&lt;category&gt; pode ser:</translation>
</message>
<message>
<source>Block creation options:</source>
@@ -2916,6 +3028,10 @@
<translation>Endereço -onion inválido: '%s'</translation>
</message>
<message>
+ <source>Keep the transaction memory pool below &lt;n&gt; megabytes (default: %u)</source>
+ <translation>Mantenha a mempool de transações abaixo de &lt;n&gt; megabytes (padrão: %u)</translation>
+ </message>
+ <message>
<source>Not enough file descriptors available.</source>
<translation>Decriptadores de arquivos disponíveis insuficientes.</translation>
</message>
@@ -2944,10 +3060,26 @@
<translation>Especifique o arquivo da carteira (dentro do diretório de dados)</translation>
</message>
<message>
+ <source>Unsupported argument -benchmark ignored, use -debug=bench.</source>
+ <translation>Argumento não suportado -benchmark ignorado, use -debug=bench.</translation>
+ </message>
+ <message>
+ <source>Unsupported argument -debugnet ignored, use -debug=net.</source>
+ <translation>Argumento não suportado -debugnet ignorado, use -debug=net</translation>
+ </message>
+ <message>
+ <source>Unsupported argument -tor found, use -onion.</source>
+ <translation>Argumento não suportador encontrado: -tor. Use -onion.</translation>
+ </message>
+ <message>
<source>Use UPnP to map the listening port (default: %u)</source>
<translation>Use UPnP para mapear a porta de entrada (padrão: %u)</translation>
</message>
<message>
+ <source>User Agent comment (%s) contains unsafe characters.</source>
+ <translation>Comentário do Agente de Usuário (%s) contém caracteres inseguros.</translation>
+ </message>
+ <message>
<source>Verifying blocks...</source>
<translation>Verificando blocos...</translation>
</message>
@@ -2972,10 +3104,6 @@
<translation>Você precisa reconstruir o banco de dados utilizando -reindex</translation>
</message>
<message>
- <source>Imports blocks from external blk000??.dat file</source>
- <translation>Importar blocos de um arquivo externo blk000??.dat</translation>
- </message>
- <message>
<source>Allow JSON-RPC connections from specified source. Valid for &lt;ip&gt; are a single IP (e.g. 1.2.3.4), a network/netmask (e.g. 1.2.3.4/255.255.255.0) or a network/CIDR (e.g. 1.2.3.4/24). This option can be specified multiple times</source>
<translation>Permitir conexões JSON-RPC de uma fonte específica. Válido para um único ip (ex. 1.2.3.4), até uma rede/máscara (ex. 1.2.3.4/255.255.255.0) ou uma rede/CIDR (ex. 1.2.3.4/24). Esta opção pode ser usada múltiplas vezes</translation>
</message>
@@ -2988,6 +3116,10 @@
<translation>Não foi possível obter acesso exclusivo ao diretório de dados %s. Provavelmente Bitcoin já está sendo executado.</translation>
</message>
<message>
+ <source>Create new files with system default permissions, instead of umask 077 (only effective with disabled wallet functionality)</source>
+ <translation>Criar novos arquivos com permissões padrão do sistema, em vez de umask 077 (apenas efetivo com funcionalidade de carteira desabilitada)</translation>
+ </message>
+ <message>
<source>Discover own IP addresses (default: 1 when listening and no -externalip or -proxy)</source>
<translation>Descobrir o próprio IP (padrão: 1 enquanto aguardando conexões e sem -externalip ou -proxy)</translation>
</message>
@@ -3000,6 +3132,10 @@
<translation>Executa um comando quando um alerta relevante é recebido ou vemos uma longa segregação (%s em cmd é substituído pela mensagem)</translation>
</message>
<message>
+ <source>Query for peer addresses via DNS lookup, if low on addresses (default: 1 unless -connect)</source>
+ <translation>Buscar por endereços de peers via busca DNS, se estiver baixo em endereços (padrão: 1 a não ser que -connect)</translation>
+ </message>
+ <message>
<source>Set maximum size of high-priority/low-fee transactions in bytes (default: %d)</source>
<translation>Define o tamanho máximo de alta-prioridade por taxa baixa nas transações em bytes (padrão: %d)</translation>
</message>
@@ -3168,10 +3304,6 @@
<translation>Aniquilando todas as transações da carteira...</translation>
</message>
<message>
- <source>on startup</source>
- <translation>ao iniciar</translation>
- </message>
- <message>
<source>wallet.dat corrupt, salvage failed</source>
<translation>wallet.dat corrompido, recuperação falhou</translation>
</message>
@@ -3184,14 +3316,6 @@
<translation>Executa um comando quando o melhor bloco mudar (%s no comando será substituído pelo hash do bloco)</translation>
</message>
<message>
- <source>Upgrade wallet to latest format</source>
- <translation>Atualizar carteira para o formato mais recente</translation>
- </message>
- <message>
- <source>Rescan the block chain for missing wallet transactions</source>
- <translation>Re-escanear blocos procurando por transações perdidas da carteira</translation>
- </message>
- <message>
<source>This help message</source>
<translation>Exibe esta mensagem de ajuda</translation>
</message>
@@ -3212,6 +3336,10 @@
<translation>(padrão: %s)</translation>
</message>
<message>
+ <source>Always query for peer addresses via DNS lookup (default: %u)</source>
+ <translation>Sempre pergunte pelo endereço de peer via pesquisa DNS (padrão: %u)</translation>
+ </message>
+ <message>
<source>Error loading wallet.dat</source>
<translation>Erro ao carregar wallet.dat</translation>
</message>
@@ -3232,10 +3360,22 @@
<translation>Endereço -proxy inválido: '%s'</translation>
</message>
<message>
+ <source>Listen for JSON-RPC connections on &lt;port&gt; (default: %u or testnet: %u)</source>
+ <translation>Escutar por conexões JSON-RPC na porta &lt;port&gt; (padrão: %u ou testnet: %u)</translation>
+ </message>
+ <message>
<source>Listen for connections on &lt;port&gt; (default: %u or testnet: %u)</source>
<translation>Aguardar por conexões na porta &lt;port&gt; (padrão: %u ou testnet: %u)</translation>
</message>
<message>
+ <source>Maintain at most &lt;n&gt; connections to peers (default: %u)</source>
+ <translation>Manter, no máximo, &lt;n&gt; conexões com peers (padrão: %u)</translation>
+ </message>
+ <message>
+ <source>Make the wallet broadcast transactions</source>
+ <translation>Fazer a carteira transmitir transações</translation>
+ </message>
+ <message>
<source>Prepend debug output with timestamp (default: %u)</source>
<translation>Adiciona timestamp como prefixo no debug (default: %u)</translation>
</message>
@@ -3264,6 +3404,10 @@
<translation>Especificar aqrquivo pid (default: %s)</translation>
</message>
<message>
+ <source>Spend unconfirmed change when sending transactions (default: %u)</source>
+ <translation>Gastar troco não confirmado quando enviar transações (padrão: %u)</translation>
+ </message>
+ <message>
<source>Unknown network specified in -onlynet: '%s'</source>
<translation>Rede desconhecida especificada em -onlynet: '%s'</translation>
</message>
diff --git a/src/qt/locale/bitcoin_pt_PT.ts b/src/qt/locale/bitcoin_pt_PT.ts
index 8d1d364935..4549066363 100644
--- a/src/qt/locale/bitcoin_pt_PT.ts
+++ b/src/qt/locale/bitcoin_pt_PT.ts
@@ -1491,14 +1491,6 @@
<translation>Ultimo Recebimento</translation>
</message>
<message>
- <source>Bytes Sent</source>
- <translation>Bytes Enviados</translation>
- </message>
- <message>
- <source>Bytes Received</source>
- <translation>Bytes Recebidos</translation>
- </message>
- <message>
<source>Ping Time</source>
<translation>Tempo de Latência</translation>
</message>
@@ -1987,10 +1979,6 @@
<translation>Pedido de pagamento expirou.</translation>
</message>
<message>
- <source>Pay only the minimum fee of %1</source>
- <translation>Pagar somente a taxa minima de %1</translation>
- </message>
- <message>
<source>Warning: Invalid Bitcoin address</source>
<translation>Aviso: Endereço Bitcoin inválido</translation>
</message>
@@ -2793,10 +2781,6 @@
<translation>&lt;categoria&gt; pode ser:</translation>
</message>
<message>
- <source>Attempt to recover private keys from a corrupt wallet.dat</source>
- <translation>Tentar recuperar chaves privadas de um wallet.dat corrupto</translation>
- </message>
- <message>
<source>Block creation options:</source>
<translation>Opções de criação de bloco:</translation>
</message>
@@ -2909,10 +2893,6 @@
<translation>É necessário reconstruir as bases de dados usando -reindex para mudar o -txindex</translation>
</message>
<message>
- <source>Imports blocks from external blk000??.dat file</source>
- <translation>Importar blocos de um ficheiro blk000??.dat externo</translation>
- </message>
- <message>
<source>Allow JSON-RPC connections from specified source. Valid for &lt;ip&gt; are a single IP (e.g. 1.2.3.4), a network/netmask (e.g. 1.2.3.4/255.255.255.0) or a network/CIDR (e.g. 1.2.3.4/24). This option can be specified multiple times</source>
<translation>Permitir conexções JSON-RPC de fontes especificas. Valido para &lt;ip&gt; um unico IP (ex. 1.2.3.4), uma rede/netmask (ex. 1.2.3.4/255.255.255.0) ou uma rede/CIDR (ex. 1.2.3.4/24). Esta opção pode ser especificada varias vezes</translation>
</message>
@@ -3033,14 +3013,6 @@
<translation>Executar comando quando o melhor bloco mudar (no comando, %s é substituído pela hash do bloco)</translation>
</message>
<message>
- <source>Upgrade wallet to latest format</source>
- <translation>Atualize a carteira para o formato mais recente</translation>
- </message>
- <message>
- <source>Rescan the block chain for missing wallet transactions</source>
- <translation>Procurar transações em falta na cadeia de blocos</translation>
- </message>
- <message>
<source>This help message</source>
<translation>Esta mensagem de ajuda</translation>
</message>
diff --git a/src/qt/locale/bitcoin_ro_RO.ts b/src/qt/locale/bitcoin_ro_RO.ts
index 7617150829..72ab2c5bdb 100644
--- a/src/qt/locale/bitcoin_ro_RO.ts
+++ b/src/qt/locale/bitcoin_ro_RO.ts
@@ -1466,14 +1466,6 @@
<translation>Ultima primire</translation>
</message>
<message>
- <source>Bytes Sent</source>
- <translation>Octeţi trimişi</translation>
- </message>
- <message>
- <source>Bytes Received</source>
- <translation>Octeţi primiţi</translation>
- </message>
- <message>
<source>Ping Time</source>
<translation>Timp ping</translation>
</message>
@@ -1942,10 +1934,6 @@
<translation>Cererea de plată a expirat.</translation>
</message>
<message>
- <source>Pay only the minimum fee of %1</source>
- <translation>Plăteşte doar taxa minimă de %1</translation>
- </message>
- <message>
<source>The recipient address is not valid. Please recheck.</source>
<translation>Adresa destinatarului nu este validă, vă rugăm să o verificaţi.</translation>
</message>
@@ -2736,10 +2724,6 @@
<translation>&lt;category&gt; poate fi:</translation>
</message>
<message>
- <source>Attempt to recover private keys from a corrupt wallet.dat</source>
- <translation>Încercare de recuperare a cheilor private dintr-un wallet.dat corupt</translation>
- </message>
- <message>
<source>Block creation options:</source>
<translation>Opţiuni creare bloc:</translation>
</message>
@@ -2848,10 +2832,6 @@
<translation>Trebuie să reconstruiţi baza de date folosind -reindex pentru a schimba -txindex</translation>
</message>
<message>
- <source>Imports blocks from external blk000??.dat file</source>
- <translation>Importă blocuri dintr-un fişier extern blk000??.dat</translation>
- </message>
- <message>
<source>Allow JSON-RPC connections from specified source. Valid for &lt;ip&gt; are a single IP (e.g. 1.2.3.4), a network/netmask (e.g. 1.2.3.4/255.255.255.0) or a network/CIDR (e.g. 1.2.3.4/24). This option can be specified multiple times</source>
<translation>Permite conexiunile JSON-RPC din sursa specificată. Valid pentru &lt;ip&gt; sînt IP singulare (ex. 1.2.3.4), o reţea/mască-reţea (ex. 1.2.3.4/255.255.255.0) sau o reţea/CIDR (ex. 1.2.3.4/24). Această opţiune poate fi specificată de mai multe ori</translation>
</message>
@@ -3004,10 +2984,6 @@
<translation>Şterge toate tranzacţiile din portofel...</translation>
</message>
<message>
- <source>on startup</source>
- <translation>la pornire</translation>
- </message>
- <message>
<source>wallet.dat corrupt, salvage failed</source>
<translation>wallet.dat corupt, salvare nereuşită</translation>
</message>
@@ -3020,14 +2996,6 @@
<translation>Execută comanda cînd cel mai bun bloc se modifică (%s în cmd este înlocuit cu hash-ul blocului)</translation>
</message>
<message>
- <source>Upgrade wallet to latest format</source>
- <translation>Actualizează portofelul la ultimul format</translation>
- </message>
- <message>
- <source>Rescan the block chain for missing wallet transactions</source>
- <translation>Rescanează lanţul de bloc pentru tranzacţiile portofel lipsă</translation>
- </message>
- <message>
<source>This help message</source>
<translation>Acest mesaj de ajutor</translation>
</message>
diff --git a/src/qt/locale/bitcoin_ru.ts b/src/qt/locale/bitcoin_ru.ts
index d4f37479ee..b69a3bda54 100644
--- a/src/qt/locale/bitcoin_ru.ts
+++ b/src/qt/locale/bitcoin_ru.ts
@@ -1044,6 +1044,10 @@
<translation>Порт прокси-сервера (например, 9050)</translation>
</message>
<message>
+ <source>Tor</source>
+ <translation>Tor</translation>
+ </message>
+ <message>
<source>&amp;Window</source>
<translation>&amp;Окно</translation>
</message>
@@ -1466,14 +1470,6 @@
<translation>Последний раз получено</translation>
</message>
<message>
- <source>Bytes Sent</source>
- <translation>Байт передано</translation>
- </message>
- <message>
- <source>Bytes Received</source>
- <translation>Байт получено</translation>
- </message>
- <message>
<source>Ping Time</source>
<translation>Время задержки</translation>
</message>
@@ -1978,10 +1974,6 @@
<translation>Запрос платежа просрочен.</translation>
</message>
<message>
- <source>Total Amount %1&lt;span style='font-size:10pt;font-weight:normal;'&gt;&lt;br /&gt;(=%2)&lt;/span&gt;</source>
- <translation>Всего %1&lt;span style='font-size:10pt;font-weight:normal;'&gt;&lt;br /&gt;(=%2)&lt;/span&gt;</translation>
- </message>
- <message>
<source>The recipient address is not valid. Please recheck.</source>
<translation>Адрес получателя неверный. Пожалуйста, перепроверьте.</translation>
</message>
@@ -2816,10 +2808,6 @@
<translation>&lt;category&gt; может быть:</translation>
</message>
<message>
- <source>Attempt to recover private keys from a corrupt wallet.dat</source>
- <translation>Попытаться восстановить приватные ключи из повреждённого wallet.dat</translation>
- </message>
- <message>
<source>Block creation options:</source>
<translation>Параметры создания блоков:</translation>
</message>
@@ -2940,10 +2928,6 @@
<translation>Вам необходимо пересобрать базы данных с помощью -reindex, чтобы изменить -txindex</translation>
</message>
<message>
- <source>Imports blocks from external blk000??.dat file</source>
- <translation>Импортировать блоки из внешнего файла blk000??.dat</translation>
- </message>
- <message>
<source>Allow JSON-RPC connections from specified source. Valid for &lt;ip&gt; are a single IP (e.g. 1.2.3.4), a network/netmask (e.g. 1.2.3.4/255.255.255.0) or a network/CIDR (e.g. 1.2.3.4/24). This option can be specified multiple times</source>
<translation>Разрешить подключения JSON-RPC с указанного источника. Разрешённые значения для &lt;ip&gt; — отдельный IP (например, 1.2.3.4), сеть/маска сети (например, 1.2.3.4/255.255.255.0) или сеть/CIDR (например, 1.2.3.4/24). Эту опцию можно использовать многократно</translation>
</message>
@@ -3192,10 +3176,6 @@
<translation>Стираем все транзакции из кошелька...</translation>
</message>
<message>
- <source>on startup</source>
- <translation>при запуске</translation>
- </message>
- <message>
<source>wallet.dat corrupt, salvage failed</source>
<translation>wallet.dat повреждён, спасение данных не удалось</translation>
</message>
@@ -3208,14 +3188,6 @@
<translation>Выполнить команду, когда появляется новый блок (%s в команде заменяется на хэш блока)</translation>
</message>
<message>
- <source>Upgrade wallet to latest format</source>
- <translation>Обновить бумажник до последнего формата</translation>
- </message>
- <message>
- <source>Rescan the block chain for missing wallet transactions</source>
- <translation>Перепроверить цепь блоков на предмет отсутствующих в бумажнике транзакций</translation>
- </message>
- <message>
<source>This help message</source>
<translation>Эта справка</translation>
</message>
diff --git a/src/qt/locale/bitcoin_sk.ts b/src/qt/locale/bitcoin_sk.ts
index f8ae906128..83f5f2c8e7 100644
--- a/src/qt/locale/bitcoin_sk.ts
+++ b/src/qt/locale/bitcoin_sk.ts
@@ -1494,14 +1494,6 @@
<translation>Posledné prijatie</translation>
</message>
<message>
- <source>Bytes Sent</source>
- <translation>Odoslaných bajtov</translation>
- </message>
- <message>
- <source>Bytes Received</source>
- <translation>Prijatých bajtov</translation>
- </message>
- <message>
<source>Ping Time</source>
<translation>Čas odozvy</translation>
</message>
@@ -1998,10 +1990,6 @@
<translation>Vypršala platnosť požiadavky na platbu.</translation>
</message>
<message>
- <source>Pay only the minimum fee of %1</source>
- <translation>Zaplatiť minimálny poplatok %1</translation>
- </message>
- <message>
<source>The recipient address is not valid. Please recheck.</source>
<translation>Adresa príjemcu je neplatná. Prosím, overte ju.</translation>
</message>
@@ -2818,10 +2806,6 @@ The network does not appear to fully agree! Some miners appear to be experiencin
<translation>&lt;category&gt; môže byť:</translation>
</message>
<message>
- <source>Attempt to recover private keys from a corrupt wallet.dat</source>
- <translation>Pokus zachrániť súkromné kľúče z poškodeného wallet.dat</translation>
- </message>
- <message>
<source>Block creation options:</source>
<translation>Voľby vytvorenia bloku:</translation>
</message>
@@ -2930,10 +2914,6 @@ The network does not appear to fully agree! Some miners appear to be experiencin
<translation>Potrebujete prebudovať databázu použitím -reindex zmeniť -txindex</translation>
</message>
<message>
- <source>Imports blocks from external blk000??.dat file</source>
- <translation>Importuje bloky z externého súboru blk000??.dat</translation>
- </message>
- <message>
<source>Allow JSON-RPC connections from specified source. Valid for &lt;ip&gt; are a single IP (e.g. 1.2.3.4), a network/netmask (e.g. 1.2.3.4/255.255.255.0) or a network/CIDR (e.g. 1.2.3.4/24). This option can be specified multiple times</source>
<translation>Povoliť JSON-RPC pripojenia zo zadaného zdroja. Pre &lt;ip&gt; sú platné jednoduché IP (napr. 1.2.3.4), sieť/netmask (napr. 1.2.3.4/255.255.255.0) alebo sieť/CIDR (napr. 1.2.3.4/24). Táto možnosť môže byť zadaná niekoľko krát</translation>
</message>
@@ -3146,10 +3126,6 @@ The network does not appear to fully agree! Some miners appear to be experiencin
<translation>Zmazať všetky transakcie z peňaženky...</translation>
</message>
<message>
- <source>on startup</source>
- <translation>pri štarte</translation>
- </message>
- <message>
<source>wallet.dat corrupt, salvage failed</source>
<translation>wallet.dat je poškodený, záchrana zlyhala</translation>
</message>
@@ -3162,14 +3138,6 @@ The network does not appear to fully agree! Some miners appear to be experiencin
<translation>Vykonaj príkaz, ak zmeny v najlepšom bloku (%s v príkaze nahradí blok hash)</translation>
</message>
<message>
- <source>Upgrade wallet to latest format</source>
- <translation>Aktualizuj peňaženku na najnovší formát.</translation>
- </message>
- <message>
- <source>Rescan the block chain for missing wallet transactions</source>
- <translation>Znovu skenovať reťaz blokov pre chýbajúce transakcie</translation>
- </message>
- <message>
<source>This help message</source>
<translation>Táto pomocná správa</translation>
</message>
diff --git a/src/qt/locale/bitcoin_sl_SI.ts b/src/qt/locale/bitcoin_sl_SI.ts
index 4378c74cd8..ca65810396 100644
--- a/src/qt/locale/bitcoin_sl_SI.ts
+++ b/src/qt/locale/bitcoin_sl_SI.ts
@@ -1490,14 +1490,6 @@
<translation>Nazadnje prejeto</translation>
</message>
<message>
- <source>Bytes Sent</source>
- <translation>Oddanih bajtov</translation>
- </message>
- <message>
- <source>Bytes Received</source>
- <translation>Prejetih bajtov</translation>
- </message>
- <message>
<source>Ping Time</source>
<translation>Odzivni čas</translation>
</message>
@@ -2006,10 +1998,6 @@
<translation><numerusform>Predviden začetek potrditev po %n najdenem bloku.</numerusform><numerusform>Predviden začetek potrditev po %n najdenih blokih.</numerusform><numerusform>Predviden začetek potrditev po %n najdenih blokih.</numerusform><numerusform>Predviden začetek potrditev po %n najdenih blokih.</numerusform></translation>
</message>
<message>
- <source>Pay only the minimum fee of %1</source>
- <translation>Plačilo samo minimalne provizije v znesku %1</translation>
- </message>
- <message>
<source>The recipient address is not valid. Please recheck.</source>
<translation>Naslov prejemnika je neveljaven. Prosimo, preverite.</translation>
</message>
@@ -2852,10 +2840,6 @@
<translation>&lt;category&gt; je lahko:</translation>
</message>
<message>
- <source>Attempt to recover private keys from a corrupt wallet.dat</source>
- <translation>Skušaj obnoviti zasebne ključe iz okvarjene datoteke wallet.dat</translation>
- </message>
- <message>
<source>Block creation options:</source>
<translation>Možnosti ustvarjanja blokov:</translation>
</message>
@@ -2976,10 +2960,6 @@
<translation>Ob spremembi vrednosti opcije -txindex boste morali obnoviti bazo podatkov z uporabo opcije -reindex</translation>
</message>
<message>
- <source>Imports blocks from external blk000??.dat file</source>
- <translation>Uvozi bloke iz zunanje datoteke blk000??.dat</translation>
- </message>
- <message>
<source>Allow JSON-RPC connections from specified source. Valid for &lt;ip&gt; are a single IP (e.g. 1.2.3.4), a network/netmask (e.g. 1.2.3.4/255.255.255.0) or a network/CIDR (e.g. 1.2.3.4/24). This option can be specified multiple times</source>
<translation>Iz navedenega vira dovoli povezave na JSON-RPC. Veljavne oblike vrednosti parametra &lt;ip&gt; so: edinstven naslov IP (npr.: 1.2.3.4), kombinacija omrežje/netmask (npr.: 1.2.3.4/255.255.255.0), ali pa kombinacija omrežje/CIDR (1.2.3.4/24). To opcijo lahko navedete večkrat.</translation>
</message>
@@ -3116,10 +3096,6 @@
<translation>Brišem vse transakcije iz denarnice ...</translation>
</message>
<message>
- <source>on startup</source>
- <translation>ob zagonu</translation>
- </message>
- <message>
<source>wallet.dat corrupt, salvage failed</source>
<translation>Datoteka wallet.dat je poškodovana in je ni bilo mogoče obnoviti.</translation>
</message>
@@ -3132,14 +3108,6 @@
<translation>Izvedi ukaz, ko je najden najboljši blok (niz %s v ukazu bo zamenjan s hash vrednostjo bloka)</translation>
</message>
<message>
- <source>Upgrade wallet to latest format</source>
- <translation>Nadgradi denarnico na najnovejšo različico</translation>
- </message>
- <message>
- <source>Rescan the block chain for missing wallet transactions</source>
- <translation>S ponovnim pregledom verige blokov poišči manjkajoče transakcije iz denarnice</translation>
- </message>
- <message>
<source>This help message</source>
<translation>To sporočilo pomoči</translation>
</message>
diff --git a/src/qt/locale/bitcoin_sr.ts b/src/qt/locale/bitcoin_sr.ts
index bb8583fc09..425c077b2b 100644
--- a/src/qt/locale/bitcoin_sr.ts
+++ b/src/qt/locale/bitcoin_sr.ts
@@ -762,10 +762,6 @@
<translation>Lozinka za JSON-RPC konekcije</translation>
</message>
<message>
- <source>Rescan the block chain for missing wallet transactions</source>
- <translation>Ponovo skeniraj lanac blokova za nedostajuće transakcije iz novčanika</translation>
- </message>
- <message>
<source>This help message</source>
<translation>Ova poruka Pomoći</translation>
</message>
diff --git a/src/qt/locale/bitcoin_sv.ts b/src/qt/locale/bitcoin_sv.ts
index 4691d7d204..69c175645b 100644
--- a/src/qt/locale/bitcoin_sv.ts
+++ b/src/qt/locale/bitcoin_sv.ts
@@ -1547,14 +1547,6 @@ Var vänlig och försök igen.</translation>
<translation>Senast mottagen</translation>
</message>
<message>
- <source>Bytes Sent</source>
- <translation>Bytes sänt</translation>
- </message>
- <message>
- <source>Bytes Received</source>
- <translation>Bytes mottaget</translation>
- </message>
- <message>
<source>Ping Time</source>
<translation>Pingtid</translation>
</message>
@@ -2099,14 +2091,6 @@ Var vänlig och försök igen.</translation>
<translation><numerusform>Uppskattas till att påbörja bekräftelse inom %n block.</numerusform><numerusform>Uppskattas till att påbörja bekräftelse inom %n block.</numerusform></translation>
</message>
<message>
- <source>Pay only the minimum fee of %1</source>
- <translation>Betala endast den minimala avgiften på %1</translation>
- </message>
- <message>
- <source>Total Amount %1&lt;span style='font-size:10pt;font-weight:normal;'&gt;&lt;br /&gt;(=%2)&lt;/span&gt;</source>
- <translation>Total summa %1&lt;span style='font-size:10pt;font-weight:normal;'&gt;&lt;br /&gt;(=%2)&lt;/span&gt;</translation>
- </message>
- <message>
<source>The recipient address is not valid. Please recheck.</source>
<translation>Mottagarens adress är ogiltig. Kontrollera igen.</translation>
</message>
@@ -2881,10 +2865,6 @@ Var vänlig och försök igen.</translation>
<translation>Tillåt kommandon från kommandotolken och JSON-RPC-kommandon</translation>
</message>
<message>
- <source>Fees (in %s/kB) smaller than this are considered zero fee for relaying (default: %s)</source>
- <translation>Avgift (i %s/kB) mindre än detta betraktas som nollavgift för vidarebefordran(standard: %s)</translation>
- </message>
- <message>
<source>If &lt;category&gt; is not supplied or if &lt;category&gt; = 1, output all debugging information.</source>
<translation>Om &lt;kategori&gt; inte anges eller om &lt;category&gt; = 1, visa all avlusningsinformation.</translation>
</message>
@@ -3009,10 +2989,6 @@ Var vänlig och försök igen.</translation>
<translation>&lt;category&gt; Kan vara:</translation>
</message>
<message>
- <source>Attempt to recover private keys from a corrupt wallet.dat</source>
- <translation>Försök att rädda de privata nycklarna från en korrupt wallet.dat</translation>
- </message>
- <message>
<source>Block creation options:</source>
<translation>Block skapande inställningar:</translation>
</message>
@@ -3169,10 +3145,6 @@ Var vänlig och försök igen.</translation>
<translation>Du måste återskapa databasen med -reindex för att ändra -txindex</translation>
</message>
<message>
- <source>Imports blocks from external blk000??.dat file</source>
- <translation>Importerar block från extern blk000??.dat fil</translation>
- </message>
- <message>
<source>Allow JSON-RPC connections from specified source. Valid for &lt;ip&gt; are a single IP (e.g. 1.2.3.4), a network/netmask (e.g. 1.2.3.4/255.255.255.0) or a network/CIDR (e.g. 1.2.3.4/24). This option can be specified multiple times</source>
<translation>Tillåt JSON-RPC-anslutningar från specifik källa. Tillåtna &lt;ip&gt; är enkel IP (t.ex 1.2.3.4), en nätverk/nätmask (t.ex. 1.2.3.4/255.255.255.0) eller ett nätverk/CIDR (t.ex. 1.2.3.4/24). Detta alternativ anges flera gånger</translation>
</message>
@@ -3425,10 +3397,6 @@ Var vänlig och försök igen.</translation>
<translation>ZeroMQ-alternativ för notiser:</translation>
</message>
<message>
- <source>on startup</source>
- <translation>under uppstarten</translation>
- </message>
- <message>
<source>wallet.dat corrupt, salvage failed</source>
<translation>wallet.dat korrupt, räddning misslyckades</translation>
</message>
@@ -3441,14 +3409,6 @@ Var vänlig och försök igen.</translation>
<translation>Exekvera kommando när det bästa blocket ändras (%s i cmd är utbytt av blockhash)</translation>
</message>
<message>
- <source>Upgrade wallet to latest format</source>
- <translation>Uppgradera plånboken till senaste formatet</translation>
- </message>
- <message>
- <source>Rescan the block chain for missing wallet transactions</source>
- <translation>Sök i blockkedjan efter saknade plånboks transaktioner</translation>
- </message>
- <message>
<source>This help message</source>
<translation>Det här hjälp medelandet</translation>
</message>
diff --git a/src/qt/locale/bitcoin_tr.ts b/src/qt/locale/bitcoin_tr.ts
index 8d2945fba7..fa8392b3df 100644
--- a/src/qt/locale/bitcoin_tr.ts
+++ b/src/qt/locale/bitcoin_tr.ts
@@ -1494,14 +1494,6 @@
<translation>Son Alma</translation>
</message>
<message>
- <source>Bytes Sent</source>
- <translation>Yollanan Baytlar</translation>
- </message>
- <message>
- <source>Bytes Received</source>
- <translation>Alınan Baytlar</translation>
- </message>
- <message>
<source>Ping Time</source>
<translation>Ping Süresi</translation>
</message>
@@ -2006,10 +1998,6 @@
<translation>Ödeme talebinin ömrü doldu.</translation>
</message>
<message>
- <source>Pay only the minimum fee of %1</source>
- <translation>Sadece asgari ücret olan %1 tutarını öde</translation>
- </message>
- <message>
<source>The recipient address is not valid. Please recheck.</source>
<translation>Alıcı adresi geçerli değildir. Lütfen denetleyiniz.</translation>
</message>
@@ -2856,10 +2844,6 @@
<translation>&lt;kategori&gt; şunlar olabilir:</translation>
</message>
<message>
- <source>Attempt to recover private keys from a corrupt wallet.dat</source>
- <translation>Bozuk bir wallet.dat dosyasından özel anahtarları geri kazanmayı dene</translation>
- </message>
- <message>
<source>Block creation options:</source>
<translation>Blok oluşturma seçenekleri:</translation>
</message>
@@ -2980,10 +2964,6 @@
<translation>-txindex'i değiştirmek için veritabanını -reindex kullanarak tekrar inşa etmeniz gerekmektedir</translation>
</message>
<message>
- <source>Imports blocks from external blk000??.dat file</source>
- <translation>Harici blk000??.dat dosyasından blokları içe aktarır</translation>
- </message>
- <message>
<source>Allow JSON-RPC connections from specified source. Valid for &lt;ip&gt; are a single IP (e.g. 1.2.3.4), a network/netmask (e.g. 1.2.3.4/255.255.255.0) or a network/CIDR (e.g. 1.2.3.4/24). This option can be specified multiple times</source>
<translation>Belirtilen kaynaktan JSON-RPC bağlantılarını kabul et. Bir &lt;ip&gt; için geçerli olanlar şunlardır: salt IP adresi (mesela 1.2.3.4), bir şebeke/ağ maskesi (örneğin 1.2.3.4/255.255.255.0) ya da bir şebeke/CIDR (mesela 1.2.3.4/24). Bu seçenek birden fazla kez belirtilebilir</translation>
</message>
@@ -3232,10 +3212,6 @@
<translation>Cüzdandaki tüm muameleler kaldırılıyor...</translation>
</message>
<message>
- <source>on startup</source>
- <translation>başlangıçta</translation>
- </message>
- <message>
<source>wallet.dat corrupt, salvage failed</source>
<translation>wallet.dat bozuk, geri kazanım başarısız oldu</translation>
</message>
@@ -3248,14 +3224,6 @@
<translation>En iyi blok değiştiğinde komutu çalıştır (komut için %s parametresi blok hash değeri ile değiştirilecektir)</translation>
</message>
<message>
- <source>Upgrade wallet to latest format</source>
- <translation>Cüzdanı en yeni biçime güncelle</translation>
- </message>
- <message>
- <source>Rescan the block chain for missing wallet transactions</source>
- <translation>Blok zincirini eksik cüzdan muameleleri için tekrar tara</translation>
- </message>
- <message>
<source>This help message</source>
<translation>Bu yardım mesajı</translation>
</message>
diff --git a/src/qt/locale/bitcoin_uk.ts b/src/qt/locale/bitcoin_uk.ts
index 4ab318425c..e0afa8eff8 100644
--- a/src/qt/locale/bitcoin_uk.ts
+++ b/src/qt/locale/bitcoin_uk.ts
@@ -1546,14 +1546,6 @@
<translation>Востаннє отримано</translation>
</message>
<message>
- <source>Bytes Sent</source>
- <translation>Байтів відправлено</translation>
- </message>
- <message>
- <source>Bytes Received</source>
- <translation>Байтів отримано</translation>
- </message>
- <message>
<source>Ping Time</source>
<translation>Затримка</translation>
</message>
@@ -2102,14 +2094,6 @@
<translation><numerusform>Перше підтвердження очікується протягом %n блоку.</numerusform><numerusform>Перше підтвердження очікується протягом %n блоків.</numerusform><numerusform>Перше підтвердження очікується протягом %n блоків.</numerusform></translation>
</message>
<message>
- <source>Pay only the minimum fee of %1</source>
- <translation>Платити тільки мінімальну комісію у розмірі %1</translation>
- </message>
- <message>
- <source>Total Amount %1&lt;span style='font-size:10pt;font-weight:normal;'&gt;&lt;br /&gt;(=%2)&lt;/span&gt;</source>
- <translation>Всього %1&lt;span style='font-size:10pt;font-weight:normal;'&gt;&lt;br /&gt;(=%2)&lt;/span&gt;</translation>
- </message>
- <message>
<source>The recipient address is not valid. Please recheck.</source>
<translation>Адреса отримувача неправильна. Будь ласка, перевірте її.</translation>
</message>
@@ -2888,10 +2872,6 @@
<translation>Приймати команди із командного рядка та команди JSON-RPC</translation>
</message>
<message>
- <source>Fees (in %s/kB) smaller than this are considered zero fee for relaying (default: %s)</source>
- <translation>Комісії (в %s/КБ), що менші за вказану, вважатимуться нульовими (для ретрансляції) (типово: %s)</translation>
- </message>
- <message>
<source>If &lt;category&gt; is not supplied or if &lt;category&gt; = 1, output all debugging information.</source>
<translation>Якщо &lt;category&gt; не задано, або ж якщо &lt;category&gt; = 1, виводить всю налагоджувальну інформацію.</translation>
</message>
@@ -3012,10 +2992,6 @@
<translation>&lt;category&gt; може бути:</translation>
</message>
<message>
- <source>Attempt to recover private keys from a corrupt wallet.dat</source>
- <translation>Спроба відновити закриті ключі з пошкодженого wallet.dat</translation>
- </message>
- <message>
<source>Block creation options:</source>
<translation>Опції створення блоку:</translation>
</message>
@@ -3156,10 +3132,6 @@
<translation>Вам необхідно перебудувати базу даних з використанням -reindex для того, щоб змінити -txindex</translation>
</message>
<message>
- <source>Imports blocks from external blk000??.dat file</source>
- <translation>Імпорт блоків з зовнішнього файлу blk000??.dat</translation>
- </message>
- <message>
<source>Allow JSON-RPC connections from specified source. Valid for &lt;ip&gt; are a single IP (e.g. 1.2.3.4), a network/netmask (e.g. 1.2.3.4/255.255.255.0) or a network/CIDR (e.g. 1.2.3.4/24). This option can be specified multiple times</source>
<translation>Дозволити підключення по протоколу JSON-RPC зі вказаного джерела. Правильною для &lt;ip&gt; є окрема IP-адреса (наприклад, 1.2.3.4), IP-адреса та маска підмережі (наприклад, 1.2.3.4/255.255.255.0) або CIDR-адреса (наприклад, 1.2.3.4/24). Цей параметр можна вказувати декілька разів.</translation>
</message>
@@ -3416,10 +3388,6 @@
<translation>Параметри сповіщень ZeroMQ:</translation>
</message>
<message>
- <source>on startup</source>
- <translation>під час запуску</translation>
- </message>
- <message>
<source>wallet.dat corrupt, salvage failed</source>
<translation>wallet.dat пошкоджено, відновлення не вдалося</translation>
</message>
@@ -3432,14 +3400,6 @@
<translation>Виконати команду, коли з'явиться новий блок (%s в команді змінюється на хеш блоку)</translation>
</message>
<message>
- <source>Upgrade wallet to latest format</source>
- <translation>Модернізувати гаманець до найновішого формату</translation>
- </message>
- <message>
- <source>Rescan the block chain for missing wallet transactions</source>
- <translation>Пересканувати ланцюжок блоків, в пошуку втрачених транзакцій</translation>
- </message>
- <message>
<source>This help message</source>
<translation>Дана довідка</translation>
</message>
diff --git a/src/qt/locale/bitcoin_uz@Cyrl.ts b/src/qt/locale/bitcoin_uz@Cyrl.ts
index 0b382ac6c0..004857cf01 100644
--- a/src/qt/locale/bitcoin_uz@Cyrl.ts
+++ b/src/qt/locale/bitcoin_uz@Cyrl.ts
@@ -1220,14 +1220,6 @@
<translation>Сўнгги қабул қилинган</translation>
</message>
<message>
- <source>Bytes Sent</source>
- <translation>Жўнатилган байтлар</translation>
- </message>
- <message>
- <source>Bytes Received</source>
- <translation>Қабул қилинган байтлар</translation>
- </message>
- <message>
<source>Ping Time</source>
<translation>Ping вақти</translation>
</message>
diff --git a/src/qt/locale/bitcoin_vi_VN.ts b/src/qt/locale/bitcoin_vi_VN.ts
index 1695f26ae7..c55aecd82d 100644
--- a/src/qt/locale/bitcoin_vi_VN.ts
+++ b/src/qt/locale/bitcoin_vi_VN.ts
@@ -686,10 +686,6 @@
<translation>Chú ý</translation>
</message>
<message>
- <source>on startup</source>
- <translation>khi khởi động</translation>
- </message>
- <message>
<source>This help message</source>
<translation>Thông điệp trợ giúp này</translation>
</message>
diff --git a/src/qt/locale/bitcoin_zh_CN.ts b/src/qt/locale/bitcoin_zh_CN.ts
index ecb35b0c4f..1cd7eed503 100644
--- a/src/qt/locale/bitcoin_zh_CN.ts
+++ b/src/qt/locale/bitcoin_zh_CN.ts
@@ -1522,14 +1522,6 @@
<translation>最后接收</translation>
</message>
<message>
- <source>Bytes Sent</source>
- <translation>发送字节</translation>
- </message>
- <message>
- <source>Bytes Received</source>
- <translation>接收字节</translation>
- </message>
- <message>
<source>Ping Time</source>
<translation>Ping 时间</translation>
</message>
@@ -2058,14 +2050,6 @@
<translation><numerusform>预计 %n 个数据块后被确认。</numerusform></translation>
</message>
<message>
- <source>Pay only the minimum fee of %1</source>
- <translation>只支付最小费用 %1</translation>
- </message>
- <message>
- <source>Total Amount %1&lt;span style='font-size:10pt;font-weight:normal;'&gt;&lt;br /&gt;(=%2)&lt;/span&gt;</source>
- <translation>总金额 %1&lt;span style='font-size:10pt;font-weight:normal;'&gt;&lt;br /&gt;(=%2)&lt;/span&gt;</translation>
- </message>
- <message>
<source>The recipient address is not valid. Please recheck.</source>
<translation>接收人地址无效。请重新检查。</translation>
</message>
@@ -2925,10 +2909,6 @@
<translation>&lt;category&gt; 可能是:</translation>
</message>
<message>
- <source>Attempt to recover private keys from a corrupt wallet.dat</source>
- <translation>尝试从损坏的钱包文件wallet.dat中恢复私钥</translation>
- </message>
- <message>
<source>Block creation options:</source>
<translation>数据块创建选项:</translation>
</message>
@@ -3049,10 +3029,6 @@
<translation>您需要将 -reindex 改为 -txindex 以重建数据库</translation>
</message>
<message>
- <source>Imports blocks from external blk000??.dat file</source>
- <translation>从blk000??.dat文件导入数据块</translation>
- </message>
- <message>
<source>Allow JSON-RPC connections from specified source. Valid for &lt;ip&gt; are a single IP (e.g. 1.2.3.4), a network/netmask (e.g. 1.2.3.4/255.255.255.0) or a network/CIDR (e.g. 1.2.3.4/24). This option can be specified multiple times</source>
<translation>允许来自指定地址的 JSON-RPC 连接。 &lt;ip&gt;为单一IP (如: 1.2.3.4), 网络/掩码 (如: 1.2.3.4/255.255.255.0), 网络/CIDR (如: 1.2.3.4/24)。该选项可多次指定。</translation>
</message>
@@ -3302,10 +3278,6 @@
<translation>ZeroMQ 通知选项:</translation>
</message>
<message>
- <source>on startup</source>
- <translation>启动中</translation>
- </message>
- <message>
<source>wallet.dat corrupt, salvage failed</source>
<translation>钱包文件wallet.dat损坏,抢救备份失败</translation>
</message>
@@ -3319,14 +3291,6 @@
<translation>当最佳数据块变化时执行命令 (命令行中的 %s 会被替换成数据块哈希值)</translation>
</message>
<message>
- <source>Upgrade wallet to latest format</source>
- <translation>将钱包升级到最新的格式</translation>
- </message>
- <message>
- <source>Rescan the block chain for missing wallet transactions</source>
- <translation>重新扫描区块链以查找遗漏的钱包交易</translation>
- </message>
- <message>
<source>This help message</source>
<translation>本帮助信息
</translation>
diff --git a/src/qt/locale/bitcoin_zh_TW.ts b/src/qt/locale/bitcoin_zh_TW.ts
index 8a92be31b5..b4dbf85a33 100644
--- a/src/qt/locale/bitcoin_zh_TW.ts
+++ b/src/qt/locale/bitcoin_zh_TW.ts
@@ -1550,14 +1550,6 @@
<translation>最近收到</translation>
</message>
<message>
- <source>Bytes Sent</source>
- <translation>送出位元組</translation>
- </message>
- <message>
- <source>Bytes Received</source>
- <translation>收到位元組</translation>
- </message>
- <message>
<source>Ping Time</source>
<translation>Ping 時間</translation>
</message>
@@ -2070,6 +2062,10 @@
<translation>複製找零金額</translation>
</message>
<message>
+ <source>Total Amount %1</source>
+ <translation>總金額 %1</translation>
+ </message>
+ <message>
<source>or</source>
<translation>或</translation>
</message>
@@ -2102,12 +2098,8 @@
<translation>付款的要求過期了。</translation>
</message>
<message>
- <source>Pay only the minimum fee of %1</source>
- <translation>只付最低手續費 %1</translation>
- </message>
- <message>
- <source>Total Amount %1&lt;span style='font-size:10pt;font-weight:normal;'&gt;&lt;br /&gt;(=%2)&lt;/span&gt;</source>
- <translation>總金額 %1&lt;span style='font-size:10pt;font-weight:normal;'&gt;&lt;br /&gt;(=%2)&lt;/span&gt;</translation>
+ <source>Pay only the required fee of %1</source>
+ <translation>只付必要的手續費 %1</translation>
</message>
<message>
<source>The recipient address is not valid. Please recheck.</source>
@@ -2889,10 +2881,6 @@
</translation>
</message>
<message>
- <source>Fees (in %s/kB) smaller than this are considered zero fee for relaying (default: %s)</source>
- <translation>當處理轉發的交易時,如果每千位元組(kB)的手續費比這個值(單位是 %s)低,就視為沒付手續費(預設值: %s)</translation>
- </message>
- <message>
<source>If &lt;category&gt; is not supplied or if &lt;category&gt; = 1, output all debugging information.</source>
<translation>如果沒有提供 &lt;category&gt; 或是值為 1 就會輸出所有的除錯資訊。</translation>
</message>
@@ -3017,10 +3005,6 @@
<translation>&lt;category&gt; 可以是:</translation>
</message>
<message>
- <source>Attempt to recover private keys from a corrupt wallet.dat</source>
- <translation>嘗試從壞掉的錢包檔 wallet.dat 復原密鑰</translation>
- </message>
- <message>
<source>Block creation options:</source>
<translation>區塊製造選項:</translation>
</message>
@@ -3173,10 +3157,6 @@
<translation>改變 -txindex 參數後,必須要用 -reindex 參數來重建資料庫</translation>
</message>
<message>
- <source>Imports blocks from external blk000??.dat file</source>
- <translation>從其它來源的 blk000??.dat 檔匯入區塊</translation>
- </message>
- <message>
<source>Allow JSON-RPC connections from specified source. Valid for &lt;ip&gt; are a single IP (e.g. 1.2.3.4), a network/netmask (e.g. 1.2.3.4/255.255.255.0) or a network/CIDR (e.g. 1.2.3.4/24). This option can be specified multiple times</source>
<translation>允許指定的來源建立 JSON-RPC 連線。&lt;ip&gt; 的有效值可以是一個單獨位址(像是 1.2.3.4),一個網段/網段罩遮值(像是 1.2.3.4/255.255.255.0),或是網段/CIDR值(像是 1.2.3.4/24)。這個選項可以設定多次。</translation>
</message>
@@ -3209,6 +3189,10 @@
<translation>當收到相關警示,或發現相當長的分支時,所要執行的指令(指令中的 %s 會被取代成警示訊息)</translation>
</message>
<message>
+ <source>Fees (in %s/kB) smaller than this are considered zero fee for relaying, mining and transaction creation (default: %s)</source>
+ <translation>當處理轉發的交易、挖礦、或製造交易時,如果每千位元組(kB)的手續費比這個值(單位是 %s)低,就視為沒付手續費(預設值: %s)</translation>
+ </message>
+ <message>
<source>If paytxfee is not set, include enough fee so transactions begin confirmation on average within n blocks (default: %u)</source>
<translation>當沒有設定 paytxfee 時,自動包含可以讓交易能在平均 n 個區塊內開始確認的手續費(預設值: %u)</translation>
</message>
@@ -3265,6 +3249,10 @@
<translation>啟用最佳鏈結...</translation>
</message>
<message>
+ <source>Attempt to recover private keys from a corrupt wallet.dat on startup</source>
+ <translation>啟動時嘗試從壞掉的錢包檔 wallet.dat 復原密鑰</translation>
+ </message>
+ <message>
<source>Cannot resolve -whitebind address: '%s'</source>
<translation>沒辦法解析 -whitebind 指定的位址: '%s'</translation>
</message>
@@ -3289,6 +3277,10 @@
<translation>讀取資料庫時發生錯誤,要關閉了。</translation>
</message>
<message>
+ <source>Imports blocks from external blk000??.dat file on startup</source>
+ <translation>啟動時從其它來源的 blk000??.dat 檔匯入區塊</translation>
+ </message>
+ <message>
<source>Information</source>
<translation>資訊</translation>
</message>
@@ -3345,6 +3337,10 @@
<translation>因為系統的限制,將 -maxconnections 參數從 %d 降到了 %d</translation>
</message>
<message>
+ <source>Rescan the block chain for missing wallet transactions on startup</source>
+ <translation>啟動時重新掃描區塊鏈,來尋找錢包可能漏掉的交易。</translation>
+ </message>
+ <message>
<source>Send trace/debug info to console instead of debug.log file</source>
<translation>在終端機顯示追蹤或除錯資訊,而不是寫到檔案 debug.log 中</translation>
</message>
@@ -3413,6 +3409,10 @@
<translation>無法和這台電腦上的 %s 繫結(回傳錯誤 %s)</translation>
</message>
<message>
+ <source>Upgrade wallet to latest format on startup</source>
+ <translation>啟動時把錢包檔案升級成最新的格式</translation>
+ </message>
+ <message>
<source>Username for JSON-RPC connections</source>
<translation>JSON-RPC 連線使用者名稱</translation>
</message>
@@ -3433,10 +3433,6 @@
<translation>ZeroMQ 通知選項:</translation>
</message>
<message>
- <source>on startup</source>
- <translation>當啟動時</translation>
- </message>
- <message>
<source>wallet.dat corrupt, salvage failed</source>
<translation>錢包檔 weallet.dat 壞掉了,拯救失敗</translation>
</message>
@@ -3449,14 +3445,6 @@
<translation>當最新區塊改變時要執行的指令(指令中的 %s 會被取代成區塊雜湊值)</translation>
</message>
<message>
- <source>Upgrade wallet to latest format</source>
- <translation>把錢包檔案升級成最新的格式</translation>
- </message>
- <message>
- <source>Rescan the block chain for missing wallet transactions</source>
- <translation>重新掃描區塊鏈,來尋找錢包可能漏掉的交易。</translation>
- </message>
- <message>
<source>This help message</source>
<translation>這些說明訊息</translation>
</message>
diff --git a/src/qt/optionsdialog.cpp b/src/qt/optionsdialog.cpp
index d0191fa6d8..647c860bdc 100644
--- a/src/qt/optionsdialog.cpp
+++ b/src/qt/optionsdialog.cpp
@@ -34,8 +34,7 @@ OptionsDialog::OptionsDialog(QWidget *parent, bool enableWallet) :
QDialog(parent),
ui(new Ui::OptionsDialog),
model(0),
- mapper(0),
- fProxyIpsValid(true)
+ mapper(0)
{
ui->setupUi(this);
@@ -60,12 +59,11 @@ OptionsDialog::OptionsDialog(QWidget *parent, bool enableWallet) :
connect(ui->connectSocks, SIGNAL(toggled(bool)), ui->proxyIp, SLOT(setEnabled(bool)));
connect(ui->connectSocks, SIGNAL(toggled(bool)), ui->proxyPort, SLOT(setEnabled(bool)));
+ connect(ui->connectSocks, SIGNAL(toggled(bool)), this, SLOT(updateProxyValidationState()));
connect(ui->connectSocksTor, SIGNAL(toggled(bool)), ui->proxyIpTor, SLOT(setEnabled(bool)));
connect(ui->connectSocksTor, SIGNAL(toggled(bool)), ui->proxyPortTor, SLOT(setEnabled(bool)));
-
- ui->proxyIp->installEventFilter(this);
- ui->proxyIpTor->installEventFilter(this);
+ connect(ui->connectSocksTor, SIGNAL(toggled(bool)), this, SLOT(updateProxyValidationState()));
/* Window elements init */
#ifdef Q_OS_MAC
@@ -119,7 +117,12 @@ OptionsDialog::OptionsDialog(QWidget *parent, bool enableWallet) :
mapper->setOrientation(Qt::Vertical);
/* setup/change UI elements when proxy IPs are invalid/valid */
- connect(this, SIGNAL(proxyIpChecks(QValidatedLineEdit *, int)), this, SLOT(doProxyIpChecks(QValidatedLineEdit *, int)));
+ ui->proxyIp->setCheckValidator(new ProxyAddressValidator(parent));
+ ui->proxyIpTor->setCheckValidator(new ProxyAddressValidator(parent));
+ connect(ui->proxyIp, SIGNAL(validationDidChange(QValidatedLineEdit *)), this, SLOT(updateProxyValidationState()));
+ connect(ui->proxyIpTor, SIGNAL(validationDidChange(QValidatedLineEdit *)), this, SLOT(updateProxyValidationState()));
+ connect(ui->proxyPort, SIGNAL(textChanged(const QString&)), this, SLOT(updateProxyValidationState()));
+ connect(ui->proxyPortTor, SIGNAL(textChanged(const QString&)), this, SLOT(updateProxyValidationState()));
}
OptionsDialog::~OptionsDialog()
@@ -200,18 +203,6 @@ void OptionsDialog::setMapper()
mapper->addMapping(ui->thirdPartyTxUrls, OptionsModel::ThirdPartyTxUrls);
}
-void OptionsDialog::enableOkButton()
-{
- /* prevent enabling of the OK button when data modified, if there is an invalid proxy address present */
- if(fProxyIpsValid)
- setOkButtonState(true);
-}
-
-void OptionsDialog::disableOkButton()
-{
- setOkButtonState(false);
-}
-
void OptionsDialog::setOkButtonState(bool fState)
{
ui->okButton->setEnabled(fState);
@@ -269,24 +260,20 @@ void OptionsDialog::clearStatusLabel()
ui->statusLabel->clear();
}
-void OptionsDialog::doProxyIpChecks(QValidatedLineEdit *pUiProxyIp, int nProxyPort)
+void OptionsDialog::updateProxyValidationState()
{
- Q_UNUSED(nProxyPort);
-
- CService addrProxy;
-
- /* Check for a valid IPv4 / IPv6 address */
- if (!(fProxyIpsValid = LookupNumeric(pUiProxyIp->text().toStdString().c_str(), addrProxy)))
+ QValidatedLineEdit *pUiProxyIp = ui->proxyIp;
+ QValidatedLineEdit *otherProxyWidget = (pUiProxyIp == ui->proxyIpTor) ? ui->proxyIp : ui->proxyIpTor;
+ if (pUiProxyIp->isValid() && (!ui->proxyPort->isEnabled() || ui->proxyPort->text().toInt() > 0) && (!ui->proxyPortTor->isEnabled() || ui->proxyPortTor->text().toInt() > 0))
{
- disableOkButton();
- pUiProxyIp->setValid(false);
- ui->statusLabel->setStyleSheet("QLabel { color: red; }");
- ui->statusLabel->setText(tr("The supplied proxy address is invalid."));
+ setOkButtonState(otherProxyWidget->isValid()); //only enable ok button if both proxys are valid
+ ui->statusLabel->clear();
}
else
{
- enableOkButton();
- ui->statusLabel->clear();
+ setOkButtonState(false);
+ ui->statusLabel->setStyleSheet("QLabel { color: red; }");
+ ui->statusLabel->setText(tr("The supplied proxy address is invalid."));
}
}
@@ -312,18 +299,18 @@ void OptionsDialog::updateDefaultProxyNets()
(strProxy == strDefaultProxyGUI.toStdString()) ? ui->proxyReachTor->setChecked(true) : ui->proxyReachTor->setChecked(false);
}
-bool OptionsDialog::eventFilter(QObject *object, QEvent *event)
+ProxyAddressValidator::ProxyAddressValidator(QObject *parent) :
+QValidator(parent)
{
- if(event->type() == QEvent::FocusOut)
- {
- if(object == ui->proxyIp)
- {
- Q_EMIT proxyIpChecks(ui->proxyIp, ui->proxyPort->text().toInt());
- }
- else if(object == ui->proxyIpTor)
- {
- Q_EMIT proxyIpChecks(ui->proxyIpTor, ui->proxyPortTor->text().toInt());
- }
- }
- return QDialog::eventFilter(object, event);
+}
+
+QValidator::State ProxyAddressValidator::validate(QString &input, int &pos) const
+{
+ Q_UNUSED(pos);
+ // Validate the proxy
+ proxyType addrProxy = proxyType(CService(input.toStdString(), 9050), true);
+ if (addrProxy.IsValid())
+ return QValidator::Acceptable;
+
+ return QValidator::Invalid;
}
diff --git a/src/qt/optionsdialog.h b/src/qt/optionsdialog.h
index 348489c599..489e35da49 100644
--- a/src/qt/optionsdialog.h
+++ b/src/qt/optionsdialog.h
@@ -6,6 +6,7 @@
#define BITCOIN_QT_OPTIONSDIALOG_H
#include <QDialog>
+#include <QValidator>
class OptionsModel;
class QValidatedLineEdit;
@@ -18,6 +19,18 @@ namespace Ui {
class OptionsDialog;
}
+/** Proxy address widget validator, checks for a valid proxy address.
+ */
+class ProxyAddressValidator : public QValidator
+{
+ Q_OBJECT
+
+public:
+ explicit ProxyAddressValidator(QObject *parent);
+
+ State validate(QString &input, int &pos) const;
+};
+
/** Preferences dialog. */
class OptionsDialog : public QDialog
{
@@ -30,14 +43,7 @@ public:
void setModel(OptionsModel *model);
void setMapper();
-protected:
- bool eventFilter(QObject *object, QEvent *event);
-
private Q_SLOTS:
- /* enable OK button */
- void enableOkButton();
- /* disable OK button */
- void disableOkButton();
/* set OK button state (enabled / disabled) */
void setOkButtonState(bool fState);
void on_resetButton_clicked();
@@ -46,7 +52,7 @@ private Q_SLOTS:
void showRestartWarning(bool fPersistent = false);
void clearStatusLabel();
- void doProxyIpChecks(QValidatedLineEdit *pUiProxyIp, int nProxyPort);
+ void updateProxyValidationState();
/* query the networks, for which the default proxy is used */
void updateDefaultProxyNets();
@@ -57,7 +63,6 @@ private:
Ui::OptionsDialog *ui;
OptionsModel *model;
QDataWidgetMapper *mapper;
- bool fProxyIpsValid;
};
#endif // BITCOIN_QT_OPTIONSDIALOG_H
diff --git a/src/qt/optionsmodel.cpp b/src/qt/optionsmodel.cpp
index 65e490570e..3e5c6c72b1 100644
--- a/src/qt/optionsmodel.cpp
+++ b/src/qt/optionsmodel.cpp
@@ -26,10 +26,10 @@
#include <QSettings>
#include <QStringList>
-OptionsModel::OptionsModel(QObject *parent) :
+OptionsModel::OptionsModel(QObject *parent, bool resetSettings) :
QAbstractListModel(parent)
{
- Init();
+ Init(resetSettings);
}
void OptionsModel::addOverriddenOption(const std::string &option)
@@ -38,8 +38,11 @@ void OptionsModel::addOverriddenOption(const std::string &option)
}
// Writes all missing QSettings with their default values
-void OptionsModel::Init()
+void OptionsModel::Init(bool resetSettings)
{
+ if (resetSettings)
+ Reset();
+
QSettings settings;
// Ensure restart flag is unset on client startup
diff --git a/src/qt/optionsmodel.h b/src/qt/optionsmodel.h
index 8448cad8de..d5bddb1a94 100644
--- a/src/qt/optionsmodel.h
+++ b/src/qt/optionsmodel.h
@@ -24,7 +24,7 @@ class OptionsModel : public QAbstractListModel
Q_OBJECT
public:
- explicit OptionsModel(QObject *parent = 0);
+ explicit OptionsModel(QObject *parent = 0, bool resetSettings = false);
enum OptionID {
StartAtStartup, // bool
@@ -48,7 +48,7 @@ public:
OptionIDRowCount,
};
- void Init();
+ void Init(bool resetSettings = false);
void Reset();
int rowCount(const QModelIndex & parent = QModelIndex()) const;
diff --git a/src/qt/paymentrequestplus.cpp b/src/qt/paymentrequestplus.cpp
index f7eae3d79c..1000c143f3 100644
--- a/src/qt/paymentrequestplus.cpp
+++ b/src/qt/paymentrequestplus.cpp
@@ -145,7 +145,7 @@ bool PaymentRequestPlus::getMerchant(X509_STORE* certStore, QString& merchant) c
int error = X509_STORE_CTX_get_error(store_ctx);
// For testing payment requests, we allow self signed root certs!
// This option is just shown in the UI options, if -help-debug is enabled.
- if (!(error == X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT && GetBoolArg("-allowselfsignedrootcertificates", false))) {
+ if (!(error == X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT && GetBoolArg("-allowselfsignedrootcertificates", DEFAULT_SELFSIGNED_ROOTCERTS))) {
throw SSLVerifyError(X509_verify_cert_error_string(error));
} else {
qDebug() << "PaymentRequestPlus::getMerchant: Allowing self signed root certificate, because -allowselfsignedrootcertificates is true.";
diff --git a/src/qt/paymentrequestplus.h b/src/qt/paymentrequestplus.h
index 99a7186b85..8a7c4c0623 100644
--- a/src/qt/paymentrequestplus.h
+++ b/src/qt/paymentrequestplus.h
@@ -15,6 +15,8 @@
#include <QList>
#include <QString>
+static const bool DEFAULT_SELFSIGNED_ROOTCERTS = false;
+
//
// Wraps dumb protocol buffer paymentRequest
// with extra methods
diff --git a/src/qt/qvalidatedlineedit.cpp b/src/qt/qvalidatedlineedit.cpp
index 346369392c..5658a0bdcf 100644
--- a/src/qt/qvalidatedlineedit.cpp
+++ b/src/qt/qvalidatedlineedit.cpp
@@ -99,9 +99,25 @@ void QValidatedLineEdit::checkValidity()
}
else
setValid(false);
+
+ Q_EMIT validationDidChange(this);
}
void QValidatedLineEdit::setCheckValidator(const QValidator *v)
{
checkValidator = v;
}
+
+bool QValidatedLineEdit::isValid()
+{
+ // use checkValidator in case the QValidatedLineEdit is disabled
+ if (checkValidator)
+ {
+ QString address = text();
+ int pos = 0;
+ if (checkValidator->validate(address, pos) == QValidator::Acceptable)
+ return true;
+ }
+
+ return valid;
+}
diff --git a/src/qt/qvalidatedlineedit.h b/src/qt/qvalidatedlineedit.h
index 8665acda5e..8cb6a425fa 100644
--- a/src/qt/qvalidatedlineedit.h
+++ b/src/qt/qvalidatedlineedit.h
@@ -18,6 +18,7 @@ public:
explicit QValidatedLineEdit(QWidget *parent);
void clear();
void setCheckValidator(const QValidator *v);
+ bool isValid();
protected:
void focusInEvent(QFocusEvent *evt);
@@ -31,6 +32,9 @@ public Q_SLOTS:
void setValid(bool valid);
void setEnabled(bool enabled);
+Q_SIGNALS:
+ void validationDidChange(QValidatedLineEdit *validatedLineEdit);
+
private Q_SLOTS:
void markValid();
void checkValidity();
diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp
index 8401701821..30e551de19 100644
--- a/src/qt/rpcconsole.cpp
+++ b/src/qt/rpcconsole.cpp
@@ -263,7 +263,13 @@ RPCConsole::RPCConsole(const PlatformStyle *platformStyle, QWidget *parent) :
connect(ui->btnClearTrafficGraph, SIGNAL(clicked()), ui->trafficGraph, SLOT(clear()));
// set library version labels
+
+#if (OPENSSL_VERSION_NUMBER < 0x10100000L)
ui->openSSLVersion->setText(SSLeay_version(SSLEAY_VERSION));
+#else
+ ui->openSSLVersion->setText(OpenSSL_version(OPENSSL_VERSION));
+#endif
+
#ifdef ENABLE_WALLET
ui->berkeleyDBVersion->setText(DbEnv::version(0, 0, 0));
#else
@@ -337,12 +343,14 @@ void RPCConsole::setClientModel(ClientModel *model)
setNumConnections(model->getNumConnections());
connect(model, SIGNAL(numConnectionsChanged(int)), this, SLOT(setNumConnections(int)));
- setNumBlocks(model->getNumBlocks(), model->getLastBlockDate());
- connect(model, SIGNAL(numBlocksChanged(int,QDateTime)), this, SLOT(setNumBlocks(int,QDateTime)));
+ setNumBlocks(model->getNumBlocks(), model->getLastBlockDate(), model->getVerificationProgress(NULL));
+ connect(model, SIGNAL(numBlocksChanged(int,QDateTime,double)), this, SLOT(setNumBlocks(int,QDateTime,double)));
updateTrafficStats(model->getTotalBytesRecv(), model->getTotalBytesSent());
connect(model, SIGNAL(bytesChanged(quint64,quint64)), this, SLOT(updateTrafficStats(quint64, quint64)));
+ connect(model, SIGNAL(mempoolSizeChanged(long,size_t)), this, SLOT(setMempoolSize(long,size_t)));
+
// set up peer table
ui->peerWidget->setModel(model->getPeerTableModel());
ui->peerWidget->verticalHeader()->hide();
@@ -517,12 +525,22 @@ void RPCConsole::setNumConnections(int count)
ui->numberOfConnections->setText(connections);
}
-void RPCConsole::setNumBlocks(int count, const QDateTime& blockDate)
+void RPCConsole::setNumBlocks(int count, const QDateTime& blockDate, double nVerificationProgress)
{
ui->numberOfBlocks->setText(QString::number(count));
ui->lastBlockTime->setText(blockDate.toString());
}
+void RPCConsole::setMempoolSize(long numberOfTxs, size_t dynUsage)
+{
+ ui->mempoolNumberTxs->setText(QString::number(numberOfTxs));
+
+ if (dynUsage < 1000000)
+ ui->mempoolSize->setText(QString::number(dynUsage/1000.0, 'f', 2) + " KB");
+ else
+ ui->mempoolSize->setText(QString::number(dynUsage/1000000.0, 'f', 2) + " MB");
+}
+
void RPCConsole::on_lineEdit_returnPressed()
{
QString cmd = ui->lineEdit->text();
@@ -856,3 +874,8 @@ void RPCConsole::showOrHideBanTableIfRequired()
ui->banlistWidget->setVisible(visible);
ui->banHeading->setVisible(visible);
}
+
+void RPCConsole::setTabFocus(enum TabTypes tabType)
+{
+ ui->tabWidget->setCurrentIndex(tabType);
+}
diff --git a/src/qt/rpcconsole.h b/src/qt/rpcconsole.h
index d5932ff149..4aebad480c 100644
--- a/src/qt/rpcconsole.h
+++ b/src/qt/rpcconsole.h
@@ -44,6 +44,13 @@ public:
CMD_ERROR
};
+ enum TabTypes {
+ TAB_INFO = 0,
+ TAB_CONSOLE = 1,
+ TAB_GRAPH = 2,
+ TAB_PEERS = 3
+ };
+
protected:
virtual bool eventFilter(QObject* obj, QEvent *event);
void keyPressEvent(QKeyEvent *);
@@ -76,7 +83,9 @@ public Q_SLOTS:
/** Set number of connections shown in the UI */
void setNumConnections(int count);
/** Set number of blocks and last block date shown in the UI */
- void setNumBlocks(int count, const QDateTime& blockDate);
+ void setNumBlocks(int count, const QDateTime& blockDate, double nVerificationProgress);
+ /** Set size (number of transactions and memory usage) of the mempool in the UI */
+ void setMempoolSize(long numberOfTxs, size_t dynUsage);
/** Go forward or back in history */
void browseHistory(int offset);
/** Scroll console view to end */
@@ -91,6 +100,8 @@ public Q_SLOTS:
void banSelectedNode(int bantime);
/** Unban a selected node on the Bans tab */
void unbanSelectedNode();
+ /** set which tab has the focus (is visible) */
+ void setTabFocus(enum TabTypes tabType);
Q_SIGNALS:
// For RPC command executor
diff --git a/src/qt/sendcoinsdialog.cpp b/src/qt/sendcoinsdialog.cpp
index 0ee08a1b0c..ec4e598bf9 100644
--- a/src/qt/sendcoinsdialog.cpp
+++ b/src/qt/sendcoinsdialog.cpp
@@ -124,7 +124,7 @@ void SendCoinsDialog::setClientModel(ClientModel *clientModel)
this->clientModel = clientModel;
if (clientModel) {
- connect(clientModel, SIGNAL(numBlocksChanged(int,QDateTime)), this, SLOT(updateSmartFeeLabel()));
+ connect(clientModel, SIGNAL(numBlocksChanged(int,QDateTime,double)), this, SLOT(updateSmartFeeLabel()));
}
}
@@ -531,7 +531,7 @@ void SendCoinsDialog::processSendCoinsReturn(const WalletModel::SendCoinsReturn
msgParams.second = CClientUIInterface::MSG_ERROR;
break;
case WalletModel::AbsurdFee:
- msgParams.first = tr("A fee higher than %1 is considered an absurdly high fee.").arg(BitcoinUnits::formatWithUnit(model->getOptionsModel()->getDisplayUnit(), 10000000));
+ msgParams.first = tr("A fee higher than %1 is considered an absurdly high fee.").arg(BitcoinUnits::formatWithUnit(model->getOptionsModel()->getDisplayUnit(), maxTxFee));
break;
case WalletModel::PaymentRequestExpired:
msgParams.first = tr("Payment request expired.");
@@ -585,7 +585,7 @@ void SendCoinsDialog::updateFeeSectionControls()
ui->checkBoxMinimumFee ->setEnabled(ui->radioCustomFee->isChecked());
ui->labelMinFeeWarning ->setEnabled(ui->radioCustomFee->isChecked());
ui->radioCustomPerKilobyte ->setEnabled(ui->radioCustomFee->isChecked() && !ui->checkBoxMinimumFee->isChecked());
- ui->radioCustomAtLeast ->setEnabled(ui->radioCustomFee->isChecked() && !ui->checkBoxMinimumFee->isChecked());
+ ui->radioCustomAtLeast ->setEnabled(ui->radioCustomFee->isChecked() && !ui->checkBoxMinimumFee->isChecked() && CoinControlDialog::coinControl->HasSelected());
ui->customFee ->setEnabled(ui->radioCustomFee->isChecked() && !ui->checkBoxMinimumFee->isChecked());
}
@@ -600,7 +600,10 @@ void SendCoinsDialog::updateGlobalFeeVariables()
{
nTxConfirmTarget = defaultConfirmTarget;
payTxFee = CFeeRate(ui->customFee->value());
- fPayAtLeastCustomFee = ui->radioCustomAtLeast->isChecked();
+
+ // if user has selected to set a minimum absolute fee, pass the value to coincontrol
+ // set nMinimumTotalFee to 0 in case of user has selected that the fee is per KB
+ CoinControlDialog::coinControl->nMinimumTotalFee = ui->radioCustomAtLeast->isChecked() ? ui->customFee->value() : 0;
}
fSendFreeTransactions = ui->checkBoxFreeTx->isChecked();
@@ -633,7 +636,8 @@ void SendCoinsDialog::updateSmartFeeLabel()
return;
int nBlocksToConfirm = defaultConfirmTarget - ui->sliderSmartFee->value();
- CFeeRate feeRate = mempool.estimateFee(nBlocksToConfirm);
+ int estimateFoundAtBlocks = nBlocksToConfirm;
+ CFeeRate feeRate = mempool.estimateSmartFee(nBlocksToConfirm, &estimateFoundAtBlocks);
if (feeRate <= CFeeRate(0)) // not enough data => minfee
{
ui->labelSmartFee->setText(BitcoinUnits::formatWithUnit(model->getOptionsModel()->getDisplayUnit(), CWallet::GetRequiredFee(1000)) + "/kB");
@@ -644,7 +648,7 @@ void SendCoinsDialog::updateSmartFeeLabel()
{
ui->labelSmartFee->setText(BitcoinUnits::formatWithUnit(model->getOptionsModel()->getDisplayUnit(), feeRate.GetFeePerK()) + "/kB");
ui->labelSmartFee2->hide();
- ui->labelFeeEstimation->setText(tr("Estimated to begin confirmation within %n block(s).", "", nBlocksToConfirm));
+ ui->labelFeeEstimation->setText(tr("Estimated to begin confirmation within %n block(s).", "", estimateFoundAtBlocks));
}
updateFeeMinimizedLabel();
@@ -706,8 +710,7 @@ void SendCoinsDialog::coinControlFeatureChanged(bool checked)
if (!checked && model) // coin control features disabled
CoinControlDialog::coinControl->SetNull();
- if (checked)
- coinControlUpdateLabels();
+ coinControlUpdateLabels();
}
// Coin Control: button inputs -> show actual coin control dialog
@@ -781,9 +784,24 @@ void SendCoinsDialog::coinControlChangeEdited(const QString& text)
// Coin Control: update labels
void SendCoinsDialog::coinControlUpdateLabels()
{
- if (!model || !model->getOptionsModel() || !model->getOptionsModel()->getCoinControlFeatures())
+ if (!model || !model->getOptionsModel())
return;
+ if (model->getOptionsModel()->getCoinControlFeatures())
+ {
+ // enable minium absolute fee UI controls
+ ui->radioCustomAtLeast->setVisible(true);
+
+ // only enable the feature if inputs are selected
+ ui->radioCustomAtLeast->setEnabled(CoinControlDialog::coinControl->HasSelected());
+ }
+ else
+ {
+ // in case coin control is disabled (=default), hide minimum absolute fee UI controls
+ ui->radioCustomAtLeast->setVisible(false);
+ return;
+ }
+
// set pay amounts
CoinControlDialog::payAmounts.clear();
CoinControlDialog::fSubtractFeeFromAmount = false;
diff --git a/src/qt/transactiontablemodel.cpp b/src/qt/transactiontablemodel.cpp
index 98ad1a44b6..e8ada9f762 100644
--- a/src/qt/transactiontablemodel.cpp
+++ b/src/qt/transactiontablemodel.cpp
@@ -13,6 +13,7 @@
#include "transactionrecord.h"
#include "walletmodel.h"
+#include "core_io.h"
#include "main.h"
#include "sync.h"
#include "uint256.h"
@@ -220,6 +221,18 @@ public:
}
return QString();
}
+
+ QString getTxHex(TransactionRecord *rec)
+ {
+ LOCK2(cs_main, wallet->cs_wallet);
+ std::map<uint256, CWalletTx>::iterator mi = wallet->mapWallet.find(rec->hash);
+ if(mi != wallet->mapWallet.end())
+ {
+ std::string strHex = EncodeHexTx(static_cast<CTransaction>(mi->second));
+ return QString::fromStdString(strHex);
+ }
+ return QString();
+ }
};
TransactionTableModel::TransactionTableModel(const PlatformStyle *platformStyle, CWallet* wallet, WalletModel *parent):
@@ -594,6 +607,8 @@ QVariant TransactionTableModel::data(const QModelIndex &index, int role) const
return rec->getTxID();
case TxHashRole:
return QString::fromStdString(rec->hash.ToString());
+ case TxHexRole:
+ return priv->getTxHex(rec);
case ConfirmedRole:
return rec->status.countsForBalance;
case FormattedAmountRole:
diff --git a/src/qt/transactiontablemodel.h b/src/qt/transactiontablemodel.h
index 2089f703a6..601f893d47 100644
--- a/src/qt/transactiontablemodel.h
+++ b/src/qt/transactiontablemodel.h
@@ -60,6 +60,8 @@ public:
TxIDRole,
/** Transaction hash */
TxHashRole,
+ /** Transaction data, hex-encoded */
+ TxHexRole,
/** Is transaction confirmed? */
ConfirmedRole,
/** Formatted amount, without brackets when unconfirmed */
diff --git a/src/qt/transactionview.cpp b/src/qt/transactionview.cpp
index 54e5a82720..11e6d750ac 100644
--- a/src/qt/transactionview.cpp
+++ b/src/qt/transactionview.cpp
@@ -141,6 +141,7 @@ TransactionView::TransactionView(const PlatformStyle *platformStyle, QWidget *pa
QAction *copyLabelAction = new QAction(tr("Copy label"), this);
QAction *copyAmountAction = new QAction(tr("Copy amount"), this);
QAction *copyTxIDAction = new QAction(tr("Copy transaction ID"), this);
+ QAction *copyTxHexAction = new QAction(tr("Copy raw transaction"), this);
QAction *editLabelAction = new QAction(tr("Edit label"), this);
QAction *showDetailsAction = new QAction(tr("Show transaction details"), this);
@@ -149,6 +150,7 @@ TransactionView::TransactionView(const PlatformStyle *platformStyle, QWidget *pa
contextMenu->addAction(copyLabelAction);
contextMenu->addAction(copyAmountAction);
contextMenu->addAction(copyTxIDAction);
+ contextMenu->addAction(copyTxHexAction);
contextMenu->addAction(editLabelAction);
contextMenu->addAction(showDetailsAction);
@@ -170,6 +172,7 @@ TransactionView::TransactionView(const PlatformStyle *platformStyle, QWidget *pa
connect(copyLabelAction, SIGNAL(triggered()), this, SLOT(copyLabel()));
connect(copyAmountAction, SIGNAL(triggered()), this, SLOT(copyAmount()));
connect(copyTxIDAction, SIGNAL(triggered()), this, SLOT(copyTxID()));
+ connect(copyTxHexAction, SIGNAL(triggered()), this, SLOT(copyTxHex()));
connect(editLabelAction, SIGNAL(triggered()), this, SLOT(editLabel()));
connect(showDetailsAction, SIGNAL(triggered()), this, SLOT(showDetails()));
}
@@ -380,6 +383,11 @@ void TransactionView::copyTxID()
GUIUtil::copyEntryData(transactionView, 0, TransactionTableModel::TxIDRole);
}
+void TransactionView::copyTxHex()
+{
+ GUIUtil::copyEntryData(transactionView, 0, TransactionTableModel::TxHexRole);
+}
+
void TransactionView::editLabel()
{
if(!transactionView->selectionModel() ||!model)
diff --git a/src/qt/transactionview.h b/src/qt/transactionview.h
index ac157fb98d..dde700c4d1 100644
--- a/src/qt/transactionview.h
+++ b/src/qt/transactionview.h
@@ -93,6 +93,7 @@ private Q_SLOTS:
void copyLabel();
void copyAmount();
void copyTxID();
+ void copyTxHex();
void openThirdPartyTxUrl(QString url);
void updateWatchOnlyColumn(bool fHaveWatchOnly);
diff --git a/src/qt/utilitydialog.cpp b/src/qt/utilitydialog.cpp
index 5e26f3e01b..f609289749 100644
--- a/src/qt/utilitydialog.cpp
+++ b/src/qt/utilitydialog.cpp
@@ -8,6 +8,9 @@
#include "bitcoingui.h"
#include "clientmodel.h"
+#include "guiconstants.h"
+#include "intro.h"
+#include "paymentrequestplus.h"
#include "guiutil.h"
#include "clientversion.h"
@@ -70,7 +73,22 @@ HelpMessageDialog::HelpMessageDialog(QWidget *parent, bool about) :
cursor.insertText(header);
cursor.insertBlock();
- QString coreOptions = QString::fromStdString(HelpMessage(HMM_BITCOIN_QT));
+ std::string strUsage = HelpMessage(HMM_BITCOIN_QT);
+ const bool showDebug = GetBoolArg("-help-debug", false);
+ strUsage += HelpMessageGroup(_("UI Options:"));
+ if (showDebug) {
+ strUsage += HelpMessageOpt("-allowselfsignedrootcertificates", strprintf("Allow self signed root certificates (default: %u)", DEFAULT_SELFSIGNED_ROOTCERTS));
+ }
+ strUsage += HelpMessageOpt("-choosedatadir", strprintf(_("Choose data directory on startup (default: %u)"), DEFAULT_CHOOSE_DATADIR));
+ strUsage += HelpMessageOpt("-lang=<lang>", _("Set language, for example \"de_DE\" (default: system locale)"));
+ strUsage += HelpMessageOpt("-min", _("Start minimized"));
+ strUsage += HelpMessageOpt("-rootcertificates=<file>", _("Set SSL root certificates for payment request (default: -system-)"));
+ strUsage += HelpMessageOpt("-splash", strprintf(_("Show splash screen on startup (default: %u)"), DEFAULT_SPLASHSCREEN));
+ strUsage += HelpMessageOpt("-resetguisettings", _("Reset all settings changes made over the GUI"));
+ if (showDebug) {
+ strUsage += HelpMessageOpt("-uiplatform", strprintf("Select platform to customize UI for (one of windows, macosx, other; default: %s)", BitcoinGUI::DEFAULT_UIPLATFORM));
+ }
+ QString coreOptions = QString::fromStdString(strUsage);
text = version + "\n" + header + "\n" + coreOptions;
QTextTableFormat tf;
diff --git a/src/qt/walletmodel.cpp b/src/qt/walletmodel.cpp
index 5c21db8bdf..690ea0811e 100644
--- a/src/qt/walletmodel.cpp
+++ b/src/qt/walletmodel.cpp
@@ -290,8 +290,10 @@ WalletModel::SendCoinsReturn WalletModel::prepareTransaction(WalletModelTransact
return TransactionCreationFailed;
}
- // reject absurdly high fee > 0.1 bitcoin
- if (nFeeRequired > 10000000)
+ // reject absurdly high fee. (This can never happen because the
+ // wallet caps the fee at maxTxFee. This merely serves as a
+ // belt-and-suspenders check)
+ if (nFeeRequired > maxTxFee)
return AbsurdFee;
}
diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp
index 9c0e78f772..c872822759 100644
--- a/src/rpcblockchain.cpp
+++ b/src/rpcblockchain.cpp
@@ -10,6 +10,7 @@
#include "coins.h"
#include "consensus/validation.h"
#include "main.h"
+#include "policy/policy.h"
#include "primitives/transaction.h"
#include "rpcserver.h"
#include "streams.h"
@@ -71,6 +72,7 @@ UniValue blockheaderToJSON(const CBlockIndex* blockindex)
result.push_back(Pair("version", blockindex->nVersion));
result.push_back(Pair("merkleroot", blockindex->hashMerkleRoot.GetHex()));
result.push_back(Pair("time", (int64_t)blockindex->nTime));
+ result.push_back(Pair("mediantime", (int64_t)blockindex->GetMedianTimePast()));
result.push_back(Pair("nonce", (uint64_t)blockindex->nNonce));
result.push_back(Pair("bits", strprintf("%08x", blockindex->nBits)));
result.push_back(Pair("difficulty", GetDifficulty(blockindex)));
@@ -111,6 +113,7 @@ UniValue blockToJSON(const CBlock& block, const CBlockIndex* blockindex, bool tx
}
result.push_back(Pair("tx", txs));
result.push_back(Pair("time", block.GetBlockTime()));
+ result.push_back(Pair("mediantime", (int64_t)blockindex->GetMedianTimePast()));
result.push_back(Pair("nonce", (uint64_t)block.nNonce));
result.push_back(Pair("bits", strprintf("%08x", block.nBits)));
result.push_back(Pair("difficulty", GetDifficulty(blockindex)));
@@ -313,6 +316,7 @@ UniValue getblockheader(const UniValue& params, bool fHelp)
" \"version\" : n, (numeric) The block version\n"
" \"merkleroot\" : \"xxxx\", (string) The merkle root\n"
" \"time\" : ttt, (numeric) The block time in seconds since epoch (Jan 1 1970 GMT)\n"
+ " \"mediantime\" : ttt, (numeric) The median block time in seconds since epoch (Jan 1 1970 GMT)\n"
" \"nonce\" : n, (numeric) The nonce\n"
" \"bits\" : \"1d00ffff\", (string) The bits\n"
" \"difficulty\" : x.xxx, (numeric) The difficulty\n"
@@ -374,6 +378,7 @@ UniValue getblock(const UniValue& params, bool fHelp)
" ,...\n"
" ],\n"
" \"time\" : ttt, (numeric) The block time in seconds since epoch (Jan 1 1970 GMT)\n"
+ " \"mediantime\" : ttt, (numeric) The median block time in seconds since epoch (Jan 1 1970 GMT)\n"
" \"nonce\" : n, (numeric) The nonce\n"
" \"bits\" : \"1d00ffff\", (string) The bits\n"
" \"difficulty\" : x.xxx, (numeric) The difficulty\n"
@@ -562,7 +567,7 @@ UniValue verifychain(const UniValue& params, bool fHelp)
if (params.size() > 1)
nCheckDepth = params[1].get_int();
- return CVerifyDB().VerifyDB(pcoinsTip, nCheckLevel, nCheckDepth);
+ return CVerifyDB().VerifyDB(Params(), pcoinsTip, nCheckLevel, nCheckDepth);
}
/** Implementation of IsSuperMajority with better feedback */
@@ -608,6 +613,7 @@ UniValue getblockchaininfo(const UniValue& params, bool fHelp)
" \"headers\": xxxxxx, (numeric) the current number of headers we have validated\n"
" \"bestblockhash\": \"...\", (string) the hash of the currently best block\n"
" \"difficulty\": xxxxxx, (numeric) the current difficulty\n"
+ " \"mediantime\": xxxxxx, (numeric) median time for the current best block\n"
" \"verificationprogress\": xxxx, (numeric) estimate of verification progress [0..1]\n"
" \"chainwork\": \"xxxx\" (string) total amount of work in active chain, in hexadecimal\n"
" \"pruned\": xx, (boolean) if the blocks are subject to pruning\n"
@@ -639,6 +645,7 @@ UniValue getblockchaininfo(const UniValue& params, bool fHelp)
obj.push_back(Pair("headers", pindexBestHeader ? pindexBestHeader->nHeight : -1));
obj.push_back(Pair("bestblockhash", chainActive.Tip()->GetBlockHash().GetHex()));
obj.push_back(Pair("difficulty", (double)GetDifficulty()));
+ obj.push_back(Pair("mediantime", (int64_t)chainActive.Tip()->GetMedianTimePast()));
obj.push_back(Pair("verificationprogress", Checkpoints::GuessVerificationProgress(Params().Checkpoints(), chainActive.Tip())));
obj.push_back(Pair("chainwork", chainActive.Tip()->nChainWork.GetHex()));
obj.push_back(Pair("pruned", fPruneMode));
@@ -828,7 +835,7 @@ UniValue invalidateblock(const UniValue& params, bool fHelp)
}
if (state.IsValid()) {
- ActivateBestChain(state);
+ ActivateBestChain(state, Params());
}
if (!state.IsValid()) {
@@ -867,7 +874,7 @@ UniValue reconsiderblock(const UniValue& params, bool fHelp)
}
if (state.IsValid()) {
- ActivateBestChain(state);
+ ActivateBestChain(state, Params());
}
if (!state.IsValid()) {
diff --git a/src/rpcclient.cpp b/src/rpcclient.cpp
index 343b6234d4..cab5819017 100644
--- a/src/rpcclient.cpp
+++ b/src/rpcclient.cpp
@@ -96,6 +96,8 @@ static const CRPCConvertParam vRPCConvertParams[] =
{ "getrawmempool", 0 },
{ "estimatefee", 0 },
{ "estimatepriority", 0 },
+ { "estimatesmartfee", 0 },
+ { "estimatesmartpriority", 0 },
{ "prioritisetransaction", 1 },
{ "prioritisetransaction", 2 },
{ "setban", 2 },
diff --git a/src/rpcmining.cpp b/src/rpcmining.cpp
index f42b31627c..c8649ec27d 100644
--- a/src/rpcmining.cpp
+++ b/src/rpcmining.cpp
@@ -99,7 +99,7 @@ UniValue getgenerate(const UniValue& params, bool fHelp)
throw runtime_error(
"getgenerate\n"
"\nReturn if the server is set to generate coins or not. The default is false.\n"
- "It is set with the command line argument -gen (or bitcoin.conf setting gen)\n"
+ "It is set with the command line argument -gen (or " + std::string(BITCOIN_CONF_FILENAME) + " setting gen)\n"
"It can also be set with the setgenerate call.\n"
"\nResult\n"
"true|false (boolean) If the server is set to generate coins or not\n"
@@ -109,7 +109,7 @@ UniValue getgenerate(const UniValue& params, bool fHelp)
);
LOCK(cs_main);
- return GetBoolArg("-gen", false);
+ return GetBoolArg("-gen", DEFAULT_GENERATE);
}
UniValue generate(const UniValue& params, bool fHelp)
@@ -157,7 +157,7 @@ UniValue generate(const UniValue& params, bool fHelp)
UniValue blockHashes(UniValue::VARR);
while (nHeight < nHeightEnd)
{
- auto_ptr<CBlockTemplate> pblocktemplate(CreateNewBlock(coinbaseScript->reserveScript));
+ auto_ptr<CBlockTemplate> pblocktemplate(CreateNewBlock(Params(), coinbaseScript->reserveScript));
if (!pblocktemplate.get())
throw JSONRPCError(RPC_INTERNAL_ERROR, "Couldn't create new block");
CBlock *pblock = &pblocktemplate->block;
@@ -171,7 +171,7 @@ UniValue generate(const UniValue& params, bool fHelp)
++pblock->nNonce;
}
CValidationState state;
- if (!ProcessNewBlock(state, NULL, pblock, true, NULL))
+ if (!ProcessNewBlock(state, Params(), NULL, pblock, true, NULL))
throw JSONRPCError(RPC_INTERNAL_ERROR, "ProcessNewBlock, block not accepted");
++nHeight;
blockHashes.push_back(pblock->GetHash().GetHex());
@@ -426,7 +426,7 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp)
if (block.hashPrevBlock != pindexPrev->GetBlockHash())
return "inconclusive-not-best-prevblk";
CValidationState state;
- TestBlockValidity(state, block, pindexPrev, false, true);
+ TestBlockValidity(state, Params(), block, pindexPrev, false, true);
return BIP22ValidationResult(state);
}
}
@@ -510,7 +510,7 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp)
pblocktemplate = NULL;
}
CScript scriptDummy = CScript() << OP_TRUE;
- pblocktemplate = CreateNewBlock(scriptDummy);
+ pblocktemplate = CreateNewBlock(Params(), scriptDummy);
if (!pblocktemplate)
throw JSONRPCError(RPC_OUT_OF_MEMORY, "Out of memory");
@@ -652,7 +652,7 @@ UniValue submitblock(const UniValue& params, bool fHelp)
CValidationState state;
submitblock_StateCatcher sc(block.GetHash());
RegisterValidationInterface(&sc);
- bool fAccepted = ProcessNewBlock(state, NULL, &block, true, NULL);
+ bool fAccepted = ProcessNewBlock(state, Params(), NULL, &block, true, NULL);
UnregisterValidationInterface(&sc);
if (fBlockPresent)
{
@@ -726,3 +726,75 @@ UniValue estimatepriority(const UniValue& params, bool fHelp)
return mempool.estimatePriority(nBlocks);
}
+
+UniValue estimatesmartfee(const UniValue& params, bool fHelp)
+{
+ if (fHelp || params.size() != 1)
+ throw runtime_error(
+ "estimatesmartfee nblocks\n"
+ "\nWARNING: This interface is unstable and may disappear or change!\n"
+ "\nEstimates the approximate fee per kilobyte needed for a transaction to begin\n"
+ "confirmation within nblocks blocks if possible and return the number of blocks\n"
+ "for which the estimate is valid.\n"
+ "\nArguments:\n"
+ "1. nblocks (numeric)\n"
+ "\nResult:\n"
+ "{\n"
+ " \"feerate\" : x.x, (numeric) estimate fee-per-kilobyte (in BTC)\n"
+ " \"blocks\" : n (numeric) block number where estimate was found\n"
+ "}\n"
+ "\n"
+ "A negative value is returned if not enough transactions and blocks\n"
+ "have been observed to make an estimate for any number of blocks.\n"
+ "However it will not return a value below the mempool reject fee.\n"
+ "\nExample:\n"
+ + HelpExampleCli("estimatesmartfee", "6")
+ );
+
+ RPCTypeCheck(params, boost::assign::list_of(UniValue::VNUM));
+
+ int nBlocks = params[0].get_int();
+
+ UniValue result(UniValue::VOBJ);
+ int answerFound;
+ CFeeRate feeRate = mempool.estimateSmartFee(nBlocks, &answerFound);
+ result.push_back(Pair("feerate", feeRate == CFeeRate(0) ? -1.0 : ValueFromAmount(feeRate.GetFeePerK())));
+ result.push_back(Pair("blocks", answerFound));
+ return result;
+}
+
+UniValue estimatesmartpriority(const UniValue& params, bool fHelp)
+{
+ if (fHelp || params.size() != 1)
+ throw runtime_error(
+ "estimatesmartpriority nblocks\n"
+ "\nWARNING: This interface is unstable and may disappear or change!\n"
+ "\nEstimates the approximate priority a zero-fee transaction needs to begin\n"
+ "confirmation within nblocks blocks if possible and return the number of blocks\n"
+ "for which the estimate is valid.\n"
+ "\nArguments:\n"
+ "1. nblocks (numeric)\n"
+ "\nResult:\n"
+ "{\n"
+ " \"priority\" : x.x, (numeric) estimated priority\n"
+ " \"blocks\" : n (numeric) block number where estimate was found\n"
+ "}\n"
+ "\n"
+ "A negative value is returned if not enough transactions and blocks\n"
+ "have been observed to make an estimate for any number of blocks.\n"
+ "However if the mempool reject fee is set it will return 1e9 * MAX_MONEY.\n"
+ "\nExample:\n"
+ + HelpExampleCli("estimatesmartpriority", "6")
+ );
+
+ RPCTypeCheck(params, boost::assign::list_of(UniValue::VNUM));
+
+ int nBlocks = params[0].get_int();
+
+ UniValue result(UniValue::VOBJ);
+ int answerFound;
+ double priority = mempool.estimateSmartPriority(nBlocks, &answerFound);
+ result.push_back(Pair("priority", priority));
+ result.push_back(Pair("blocks", answerFound));
+ return result;
+}
diff --git a/src/rpcnet.cpp b/src/rpcnet.cpp
index 9bf017e385..2578848891 100644
--- a/src/rpcnet.cpp
+++ b/src/rpcnet.cpp
@@ -90,6 +90,7 @@ UniValue getpeerinfo(const UniValue& params, bool fHelp)
" \"addr\":\"host:port\", (string) The ip address and port of the peer\n"
" \"addrlocal\":\"ip:port\", (string) local address\n"
" \"services\":\"xxxxxxxxxxxxxxxx\", (string) The services offered\n"
+ " \"relaytxes\":true|false, (boolean) Whether peer has asked us to relay transactions to it\n"
" \"lastsend\": ttt, (numeric) The time in seconds since epoch (Jan 1 1970 GMT) of the last send\n"
" \"lastrecv\": ttt, (numeric) The time in seconds since epoch (Jan 1 1970 GMT) of the last receive\n"
" \"bytessent\": n, (numeric) The total bytes sent\n"
@@ -134,6 +135,7 @@ UniValue getpeerinfo(const UniValue& params, bool fHelp)
if (!(stats.addrLocal.empty()))
obj.push_back(Pair("addrlocal", stats.addrLocal));
obj.push_back(Pair("services", strprintf("%016x", stats.nServices)));
+ obj.push_back(Pair("relaytxes", stats.fRelayTxes));
obj.push_back(Pair("lastsend", stats.nLastSend));
obj.push_back(Pair("lastrecv", stats.nLastRecv));
obj.push_back(Pair("bytessent", stats.nSendBytes));
@@ -368,7 +370,16 @@ UniValue getnettotals(const UniValue& params, bool fHelp)
"{\n"
" \"totalbytesrecv\": n, (numeric) Total bytes received\n"
" \"totalbytessent\": n, (numeric) Total bytes sent\n"
- " \"timemillis\": t (numeric) Total cpu time\n"
+ " \"timemillis\": t, (numeric) Total cpu time\n"
+ " \"uploadtarget\":\n"
+ " {\n"
+ " \"timeframe\": n, (numeric) Length of the measuring timeframe in seconds\n"
+ " \"target\": n, (numeric) Target in bytes\n"
+ " \"target_reached\": true|false, (boolean) True if target is reached\n"
+ " \"serve_historical_blocks\": true|false, (boolean) True if serving historical blocks\n"
+ " \"bytes_left_in_cycle\": t, (numeric) Bytes left in current time cycle\n"
+ " \"time_left_in_cycle\": t (numeric) Seconds left in current time cycle\n"
+ " }\n"
"}\n"
"\nExamples:\n"
+ HelpExampleCli("getnettotals", "")
diff --git a/src/rpcrawtransaction.cpp b/src/rpcrawtransaction.cpp
index 11d9a6f2bb..1f2d77aef0 100644
--- a/src/rpcrawtransaction.cpp
+++ b/src/rpcrawtransaction.cpp
@@ -62,6 +62,7 @@ void ScriptPubKeyToJSON(const CScript& scriptPubKey, UniValue& out, bool fInclud
void TxToJSON(const CTransaction& tx, const uint256 hashBlock, UniValue& entry)
{
entry.push_back(Pair("txid", tx.GetHash().GetHex()));
+ entry.push_back(Pair("size", (int)::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION)));
entry.push_back(Pair("version", tx.nVersion));
entry.push_back(Pair("locktime", (int64_t)tx.nLockTime));
UniValue vin(UniValue::VARR);
@@ -133,6 +134,7 @@ UniValue getrawtransaction(const UniValue& params, bool fHelp)
"{\n"
" \"hex\" : \"data\", (string) The serialized, hex-encoded data for 'txid'\n"
" \"txid\" : \"id\", (string) The transaction id (same as provided)\n"
+ " \"size\" : n, (numeric) The transaction size\n"
" \"version\" : n, (numeric) The version\n"
" \"locktime\" : ttt, (numeric) The lock time\n"
" \"vin\" : [ (array of json objects)\n"
@@ -429,6 +431,7 @@ UniValue decoderawtransaction(const UniValue& params, bool fHelp)
"\nResult:\n"
"{\n"
" \"txid\" : \"id\", (string) The transaction id\n"
+ " \"size\" : n, (numeric) The transaction size\n"
" \"version\" : n, (numeric) The version\n"
" \"locktime\" : ttt, (numeric) The lock time\n"
" \"vin\" : [ (array of json objects)\n"
@@ -506,7 +509,6 @@ UniValue decodescript(const UniValue& params, bool fHelp)
+ HelpExampleRpc("decodescript", "\"hexstring\"")
);
- LOCK(cs_main);
RPCTypeCheck(params, boost::assign::list_of(UniValue::VSTR));
UniValue r(UniValue::VOBJ);
diff --git a/src/rpcserver.cpp b/src/rpcserver.cpp
index 8bda5a0373..83d2c2d503 100644
--- a/src/rpcserver.cpp
+++ b/src/rpcserver.cpp
@@ -319,6 +319,8 @@ static const CRPCCommand vRPCCommands[] =
{ "util", "verifymessage", &verifymessage, true },
{ "util", "estimatefee", &estimatefee, true },
{ "util", "estimatepriority", &estimatepriority, true },
+ { "util", "estimatesmartfee", &estimatesmartfee, true },
+ { "util", "estimatesmartpriority", &estimatesmartpriority, true },
/* Not shown in help */
{ "hidden", "invalidateblock", &invalidateblock, true },
diff --git a/src/rpcserver.h b/src/rpcserver.h
index dde8dfdcc3..fc88f82be8 100644
--- a/src/rpcserver.h
+++ b/src/rpcserver.h
@@ -193,6 +193,8 @@ extern UniValue getblocktemplate(const UniValue& params, bool fHelp);
extern UniValue submitblock(const UniValue& params, bool fHelp);
extern UniValue estimatefee(const UniValue& params, bool fHelp);
extern UniValue estimatepriority(const UniValue& params, bool fHelp);
+extern UniValue estimatesmartfee(const UniValue& params, bool fHelp);
+extern UniValue estimatesmartpriority(const UniValue& params, bool fHelp);
extern UniValue getnewaddress(const UniValue& params, bool fHelp); // in rpcwallet.cpp
extern UniValue getaccountaddress(const UniValue& params, bool fHelp);
diff --git a/src/script/bitcoinconsensus.cpp b/src/script/bitcoinconsensus.cpp
index b0d5faaf77..79504f6ad3 100644
--- a/src/script/bitcoinconsensus.cpp
+++ b/src/script/bitcoinconsensus.cpp
@@ -6,6 +6,7 @@
#include "bitcoinconsensus.h"
#include "primitives/transaction.h"
+#include "pubkey.h"
#include "script/interpreter.h"
#include "version.h"
@@ -60,7 +61,13 @@ inline int set_error(bitcoinconsensus_error* ret, bitcoinconsensus_error serror)
return 0;
}
-} // anon namespace
+struct ECCryptoClosure
+{
+ ECCVerifyHandle handle;
+};
+
+ECCryptoClosure instance_of_eccryptoclosure;
+}
int bitcoinconsensus_verify_script(const unsigned char *scriptPubKey, unsigned int scriptPubKeyLen,
const unsigned char *txTo , unsigned int txToLen,
diff --git a/src/script/interpreter.cpp b/src/script/interpreter.cpp
index e0853fef4e..57e0edc4b4 100644
--- a/src/script/interpreter.cpp
+++ b/src/script/interpreter.cpp
@@ -9,7 +9,6 @@
#include "crypto/ripemd160.h"
#include "crypto/sha1.h"
#include "crypto/sha256.h"
-#include "eccryptoverify.h"
#include "pubkey.h"
#include "script/script.h"
#include "uint256.h"
@@ -165,16 +164,8 @@ bool static IsLowDERSignature(const valtype &vchSig, ScriptError* serror) {
if (!IsValidSignatureEncoding(vchSig)) {
return set_error(serror, SCRIPT_ERR_SIG_DER);
}
- unsigned int nLenR = vchSig[3];
- unsigned int nLenS = vchSig[5+nLenR];
- const unsigned char *S = &vchSig[6+nLenR];
- // If the S value is above the order of the curve divided by two, its
- // complement modulo the order could have been used instead, which is
- // one byte shorter when encoded correctly.
- if (!eccrypto::CheckSignatureElement(S, nLenS, true))
- return set_error(serror, SCRIPT_ERR_SIG_HIGH_S);
-
- return true;
+ std::vector<unsigned char> vchSigCopy(vchSig.begin(), vchSig.begin() + vchSig.size() - 1);
+ return CPubKey::CheckLowS(vchSigCopy);
}
bool static IsDefinedHashtypeSignature(const valtype &vchSig) {
diff --git a/src/script/standard.cpp b/src/script/standard.cpp
index bfef8afa17..4863b96391 100644
--- a/src/script/standard.cpp
+++ b/src/script/standard.cpp
@@ -16,6 +16,7 @@ using namespace std;
typedef vector<unsigned char> valtype;
+bool fAcceptDatacarrier = DEFAULT_ACCEPT_DATACARRIER;
unsigned nMaxDatacarrierBytes = MAX_OP_RETURN_RELAY;
CScriptID::CScriptID(const CScript& in) : uint160(Hash160(in.begin(), in.end())) {}
diff --git a/src/script/standard.h b/src/script/standard.h
index ae1bbecca0..2b9fbe78dd 100644
--- a/src/script/standard.h
+++ b/src/script/standard.h
@@ -13,6 +13,8 @@
#include <stdint.h>
+static const bool DEFAULT_ACCEPT_DATACARRIER = true;
+
class CKeyID;
class CScript;
@@ -26,6 +28,7 @@ public:
};
static const unsigned int MAX_OP_RETURN_RELAY = 83; //! bytes (+1 for OP_RETURN, +2 for the pushdata opcodes)
+extern bool fAcceptDatacarrier;
extern unsigned nMaxDatacarrierBytes;
/**
diff --git a/src/secp256k1/Makefile.am b/src/secp256k1/Makefile.am
index f4121f1705..7772a4e9d2 100644
--- a/src/secp256k1/Makefile.am
+++ b/src/secp256k1/Makefile.am
@@ -75,7 +75,7 @@ TESTS = tests
endif
if USE_ECMULT_STATIC_PRECOMPUTATION
-CPPFLAGS_FOR_BUILD +=-I$(top_srcdir)/
+CPPFLAGS_FOR_BUILD +=-I$(top_srcdir)
CFLAGS_FOR_BUILD += -Wall -Wextra -Wno-unused-function
gen_context_OBJECTS = gen_context.o
diff --git a/src/test/accounting_tests.cpp b/src/test/accounting_tests.cpp
index 0c2ade48d6..4a294c6712 100644
--- a/src/test/accounting_tests.cpp
+++ b/src/test/accounting_tests.cpp
@@ -45,7 +45,7 @@ BOOST_AUTO_TEST_CASE(acc_orderupgrade)
ae.nTime = 1333333333;
ae.strOtherAccount = "b";
ae.strComment = "";
- walletdb.WriteAccountingEntry(ae);
+ pwalletMain->AddAccountingEntry(ae, walletdb);
wtx.mapValue["comment"] = "z";
pwalletMain->AddToWallet(wtx, false, &walletdb);
@@ -55,7 +55,7 @@ BOOST_AUTO_TEST_CASE(acc_orderupgrade)
ae.nTime = 1333333336;
ae.strOtherAccount = "c";
- walletdb.WriteAccountingEntry(ae);
+ pwalletMain->AddAccountingEntry(ae, walletdb);
GetResults(walletdb, results);
@@ -71,7 +71,7 @@ BOOST_AUTO_TEST_CASE(acc_orderupgrade)
ae.nTime = 1333333330;
ae.strOtherAccount = "d";
ae.nOrderPos = pwalletMain->IncOrderPosNext();
- walletdb.WriteAccountingEntry(ae);
+ pwalletMain->AddAccountingEntry(ae, walletdb);
GetResults(walletdb, results);
@@ -121,7 +121,7 @@ BOOST_AUTO_TEST_CASE(acc_orderupgrade)
ae.nTime = 1333333334;
ae.strOtherAccount = "e";
ae.nOrderPos = -1;
- walletdb.WriteAccountingEntry(ae);
+ pwalletMain->AddAccountingEntry(ae, walletdb);
GetResults(walletdb, results);
diff --git a/src/test/bignum.h b/src/test/bignum.h
deleted file mode 100644
index e7aeee9db6..0000000000
--- a/src/test/bignum.h
+++ /dev/null
@@ -1,180 +0,0 @@
-// Copyright (c) 2009-2010 Satoshi Nakamoto
-// Copyright (c) 2009-2013 The Bitcoin Core developers
-// Distributed under the MIT software license, see the accompanying
-// file COPYING or http://www.opensource.org/licenses/mit-license.php.
-
-#ifndef BITCOIN_TEST_BIGNUM_H
-#define BITCOIN_TEST_BIGNUM_H
-
-#include <algorithm>
-#include <limits>
-#include <stdexcept>
-#include <stdint.h>
-#include <string>
-#include <vector>
-
-#include <openssl/bn.h>
-
-class bignum_error : public std::runtime_error
-{
-public:
- explicit bignum_error(const std::string& str) : std::runtime_error(str) {}
-};
-
-
-/** C++ wrapper for BIGNUM (OpenSSL bignum) */
-class CBigNum : public BIGNUM
-{
-public:
- CBigNum()
- {
- BN_init(this);
- }
-
- CBigNum(const CBigNum& b)
- {
- BN_init(this);
- if (!BN_copy(this, &b))
- {
- BN_clear_free(this);
- throw bignum_error("CBigNum::CBigNum(const CBigNum&): BN_copy failed");
- }
- }
-
- CBigNum& operator=(const CBigNum& b)
- {
- if (!BN_copy(this, &b))
- throw bignum_error("CBigNum::operator=: BN_copy failed");
- return (*this);
- }
-
- ~CBigNum()
- {
- BN_clear_free(this);
- }
-
- CBigNum(long long n) { BN_init(this); setint64(n); }
-
- explicit CBigNum(const std::vector<unsigned char>& vch)
- {
- BN_init(this);
- setvch(vch);
- }
-
- int getint() const
- {
- BN_ULONG n = BN_get_word(this);
- if (!BN_is_negative(this))
- return (n > (BN_ULONG)std::numeric_limits<int>::max() ? std::numeric_limits<int>::max() : n);
- else
- return (n > (BN_ULONG)std::numeric_limits<int>::max() ? std::numeric_limits<int>::min() : -(int)n);
- }
-
- void setint64(int64_t sn)
- {
- unsigned char pch[sizeof(sn) + 6];
- unsigned char* p = pch + 4;
- bool fNegative;
- uint64_t n;
-
- if (sn < (int64_t)0)
- {
- // Since the minimum signed integer cannot be represented as positive so long as its type is signed,
- // and it's not well-defined what happens if you make it unsigned before negating it,
- // we instead increment the negative integer by 1, convert it, then increment the (now positive) unsigned integer by 1 to compensate
- n = -(sn + 1);
- ++n;
- fNegative = true;
- } else {
- n = sn;
- fNegative = false;
- }
-
- bool fLeadingZeroes = true;
- for (int i = 0; i < 8; i++)
- {
- unsigned char c = (n >> 56) & 0xff;
- n <<= 8;
- if (fLeadingZeroes)
- {
- if (c == 0)
- continue;
- if (c & 0x80)
- *p++ = (fNegative ? 0x80 : 0);
- else if (fNegative)
- c |= 0x80;
- fLeadingZeroes = false;
- }
- *p++ = c;
- }
- unsigned int nSize = p - (pch + 4);
- pch[0] = (nSize >> 24) & 0xff;
- pch[1] = (nSize >> 16) & 0xff;
- pch[2] = (nSize >> 8) & 0xff;
- pch[3] = (nSize) & 0xff;
- BN_mpi2bn(pch, p - pch, this);
- }
-
- void setvch(const std::vector<unsigned char>& vch)
- {
- std::vector<unsigned char> vch2(vch.size() + 4);
- unsigned int nSize = vch.size();
- // BIGNUM's byte stream format expects 4 bytes of
- // big endian size data info at the front
- vch2[0] = (nSize >> 24) & 0xff;
- vch2[1] = (nSize >> 16) & 0xff;
- vch2[2] = (nSize >> 8) & 0xff;
- vch2[3] = (nSize >> 0) & 0xff;
- // swap data to big endian
- reverse_copy(vch.begin(), vch.end(), vch2.begin() + 4);
- BN_mpi2bn(&vch2[0], vch2.size(), this);
- }
-
- std::vector<unsigned char> getvch() const
- {
- unsigned int nSize = BN_bn2mpi(this, NULL);
- if (nSize <= 4)
- return std::vector<unsigned char>();
- std::vector<unsigned char> vch(nSize);
- BN_bn2mpi(this, &vch[0]);
- vch.erase(vch.begin(), vch.begin() + 4);
- reverse(vch.begin(), vch.end());
- return vch;
- }
-
- friend inline const CBigNum operator-(const CBigNum& a, const CBigNum& b);
-};
-
-
-
-inline const CBigNum operator+(const CBigNum& a, const CBigNum& b)
-{
- CBigNum r;
- if (!BN_add(&r, &a, &b))
- throw bignum_error("CBigNum::operator+: BN_add failed");
- return r;
-}
-
-inline const CBigNum operator-(const CBigNum& a, const CBigNum& b)
-{
- CBigNum r;
- if (!BN_sub(&r, &a, &b))
- throw bignum_error("CBigNum::operator-: BN_sub failed");
- return r;
-}
-
-inline const CBigNum operator-(const CBigNum& a)
-{
- CBigNum r(a);
- BN_set_negative(&r, !BN_is_negative(&r));
- return r;
-}
-
-inline bool operator==(const CBigNum& a, const CBigNum& b) { return (BN_cmp(&a, &b) == 0); }
-inline bool operator!=(const CBigNum& a, const CBigNum& b) { return (BN_cmp(&a, &b) != 0); }
-inline bool operator<=(const CBigNum& a, const CBigNum& b) { return (BN_cmp(&a, &b) <= 0); }
-inline bool operator>=(const CBigNum& a, const CBigNum& b) { return (BN_cmp(&a, &b) >= 0); }
-inline bool operator<(const CBigNum& a, const CBigNum& b) { return (BN_cmp(&a, &b) < 0); }
-inline bool operator>(const CBigNum& a, const CBigNum& b) { return (BN_cmp(&a, &b) > 0); }
-
-#endif // BITCOIN_TEST_BIGNUM_H
diff --git a/src/test/coins_tests.cpp b/src/test/coins_tests.cpp
index 13d848311a..9489a19f63 100644
--- a/src/test/coins_tests.cpp
+++ b/src/test/coins_tests.cpp
@@ -6,6 +6,8 @@
#include "random.h"
#include "uint256.h"
#include "test/test_bitcoin.h"
+#include "main.h"
+#include "consensus/validation.h"
#include <vector>
#include <map>
@@ -45,15 +47,18 @@ public:
bool BatchWrite(CCoinsMap& mapCoins, const uint256& hashBlock)
{
for (CCoinsMap::iterator it = mapCoins.begin(); it != mapCoins.end(); ) {
- map_[it->first] = it->second.coins;
- if (it->second.coins.IsPruned() && insecure_rand() % 3 == 0) {
- // Randomly delete empty entries on write.
- map_.erase(it->first);
+ if (it->second.flags & CCoinsCacheEntry::DIRTY) {
+ // Same optimization used in CCoinsViewDB is to only write dirty entries.
+ map_[it->first] = it->second.coins;
+ if (it->second.coins.IsPruned() && insecure_rand() % 3 == 0) {
+ // Randomly delete empty entries on write.
+ map_.erase(it->first);
+ }
}
mapCoins.erase(it++);
}
- mapCoins.clear();
- hashBestBlock_ = hashBlock;
+ if (!hashBlock.IsNull())
+ hashBestBlock_ = hashBlock;
return true;
}
@@ -160,13 +165,22 @@ BOOST_AUTO_TEST_CASE(coins_cache_simulation_test)
}
if (insecure_rand() % 100 == 0) {
+ // Every 100 iterations, flush an intermediate cache
+ if (stack.size() > 1 && insecure_rand() % 2 == 0) {
+ unsigned int flushIndex = insecure_rand() % (stack.size() - 1);
+ stack[flushIndex]->Flush();
+ }
+ }
+ if (insecure_rand() % 100 == 0) {
// Every 100 iterations, change the cache stack.
if (stack.size() > 0 && insecure_rand() % 2 == 0) {
+ //Remove the top cache
stack.back()->Flush();
delete stack.back();
stack.pop_back();
}
if (stack.size() == 0 || (stack.size() < 4 && insecure_rand() % 2)) {
+ //Add a new cache
CCoinsView* tip = &base;
if (stack.size() > 0) {
tip = stack.back();
@@ -197,4 +211,140 @@ BOOST_AUTO_TEST_CASE(coins_cache_simulation_test)
BOOST_CHECK(missed_an_entry);
}
+// This test is similar to the previous test
+// except the emphasis is on testing the functionality of UpdateCoins
+// random txs are created and UpdateCoins is used to update the cache stack
+// In particular it is tested that spending a duplicate coinbase tx
+// has the expected effect (the other duplicate is overwitten at all cache levels)
+BOOST_AUTO_TEST_CASE(updatecoins_simulation_test)
+{
+ bool spent_a_duplicate_coinbase = false;
+ // A simple map to track what we expect the cache stack to represent.
+ std::map<uint256, CCoins> result;
+
+ // The cache stack.
+ CCoinsViewTest base; // A CCoinsViewTest at the bottom.
+ std::vector<CCoinsViewCacheTest*> stack; // A stack of CCoinsViewCaches on top.
+ stack.push_back(new CCoinsViewCacheTest(&base)); // Start with one cache.
+
+ // Track the txids we've used and whether they have been spent or not
+ std::map<uint256, CAmount> coinbaseids;
+ std::set<uint256> alltxids;
+ std::set<uint256> duplicateids;
+
+ for (unsigned int i = 0; i < NUM_SIMULATION_ITERATIONS; i++) {
+ {
+ CMutableTransaction tx;
+ tx.vin.resize(1);
+ tx.vout.resize(1);
+ tx.vout[0].nValue = i; //Keep txs unique unless intended to duplicate
+ unsigned int height = insecure_rand();
+
+ // 1/10 times create a coinbase
+ if (insecure_rand() % 10 == 0 || coinbaseids.size() < 10) {
+ // 1/100 times create a duplicate coinbase
+ if (insecure_rand() % 10 == 0 && coinbaseids.size()) {
+ std::map<uint256, CAmount>::iterator coinbaseIt = coinbaseids.lower_bound(GetRandHash());
+ if (coinbaseIt == coinbaseids.end()) {
+ coinbaseIt = coinbaseids.begin();
+ }
+ //Use same random value to have same hash and be a true duplicate
+ tx.vout[0].nValue = coinbaseIt->second;
+ assert(tx.GetHash() == coinbaseIt->first);
+ duplicateids.insert(coinbaseIt->first);
+ }
+ else {
+ coinbaseids[tx.GetHash()] = tx.vout[0].nValue;
+ }
+ assert(CTransaction(tx).IsCoinBase());
+ }
+ // 9/10 times create a regular tx
+ else {
+ uint256 prevouthash;
+ // equally likely to spend coinbase or non coinbase
+ std::set<uint256>::iterator txIt = alltxids.lower_bound(GetRandHash());
+ if (txIt == alltxids.end()) {
+ txIt = alltxids.begin();
+ }
+ prevouthash = *txIt;
+
+ // Construct the tx to spend the coins of prevouthash
+ tx.vin[0].prevout.hash = prevouthash;
+ tx.vin[0].prevout.n = 0;
+
+ // Update the expected result of prevouthash to know these coins are spent
+ CCoins& oldcoins = result[prevouthash];
+ oldcoins.Clear();
+
+ // It is of particular importance here that once we spend a coinbase tx hash
+ // it is no longer available to be duplicated (or spent again)
+ // BIP 34 in conjunction with enforcing BIP 30 (at least until BIP 34 was active)
+ // results in the fact that no coinbases were duplicated after they were already spent
+ alltxids.erase(prevouthash);
+ coinbaseids.erase(prevouthash);
+
+ // The test is designed to ensure spending a duplicate coinbase will work properly
+ // if that ever happens and not resurrect the previously overwritten coinbase
+ if (duplicateids.count(prevouthash))
+ spent_a_duplicate_coinbase = true;
+
+ assert(!CTransaction(tx).IsCoinBase());
+ }
+ // Track this tx to possibly spend later
+ alltxids.insert(tx.GetHash());
+
+ // Update the expected result to know about the new output coins
+ CCoins &coins = result[tx.GetHash()];
+ coins.FromTx(tx, height);
+
+ CValidationState dummy;
+ UpdateCoins(tx, dummy, *(stack.back()), height);
+ }
+
+ // Once every 1000 iterations and at the end, verify the full cache.
+ if (insecure_rand() % 1000 == 1 || i == NUM_SIMULATION_ITERATIONS - 1) {
+ for (std::map<uint256, CCoins>::iterator it = result.begin(); it != result.end(); it++) {
+ const CCoins* coins = stack.back()->AccessCoins(it->first);
+ if (coins) {
+ BOOST_CHECK(*coins == it->second);
+ } else {
+ BOOST_CHECK(it->second.IsPruned());
+ }
+ }
+ }
+
+ if (insecure_rand() % 100 == 0) {
+ // Every 100 iterations, flush an intermediate cache
+ if (stack.size() > 1 && insecure_rand() % 2 == 0) {
+ unsigned int flushIndex = insecure_rand() % (stack.size() - 1);
+ stack[flushIndex]->Flush();
+ }
+ }
+ if (insecure_rand() % 100 == 0) {
+ // Every 100 iterations, change the cache stack.
+ if (stack.size() > 0 && insecure_rand() % 2 == 0) {
+ stack.back()->Flush();
+ delete stack.back();
+ stack.pop_back();
+ }
+ if (stack.size() == 0 || (stack.size() < 4 && insecure_rand() % 2)) {
+ CCoinsView* tip = &base;
+ if (stack.size() > 0) {
+ tip = stack.back();
+ }
+ stack.push_back(new CCoinsViewCacheTest(tip));
+ }
+ }
+ }
+
+ // Clean up the stack.
+ while (stack.size() > 0) {
+ delete stack.back();
+ stack.pop_back();
+ }
+
+ // Verify coverage.
+ BOOST_CHECK(spent_a_duplicate_coinbase);
+}
+
BOOST_AUTO_TEST_SUITE_END()
diff --git a/src/test/main_tests.cpp b/src/test/main_tests.cpp
index 21ae46d6e9..2b92d239e9 100644
--- a/src/test/main_tests.cpp
+++ b/src/test/main_tests.cpp
@@ -72,5 +72,4 @@ BOOST_AUTO_TEST_CASE(test_combiner_all)
Test.disconnect(&ReturnTrue);
BOOST_CHECK(Test());
}
-
BOOST_AUTO_TEST_SUITE_END()
diff --git a/src/test/mempool_tests.cpp b/src/test/mempool_tests.cpp
index 0cf906a259..896e1237ed 100644
--- a/src/test/mempool_tests.cpp
+++ b/src/test/mempool_tests.cpp
@@ -17,6 +17,7 @@ BOOST_AUTO_TEST_CASE(MempoolRemoveTest)
{
// Test CTxMemPool::remove functionality
+ TestMemPoolEntryHelper entry;
// Parent transaction with three children,
// and three grand-children:
CMutableTransaction txParent;
@@ -60,17 +61,17 @@ BOOST_AUTO_TEST_CASE(MempoolRemoveTest)
BOOST_CHECK_EQUAL(removed.size(), 0);
// Just the parent:
- testPool.addUnchecked(txParent.GetHash(), CTxMemPoolEntry(txParent, 0, 0, 0.0, 1));
+ testPool.addUnchecked(txParent.GetHash(), entry.FromTx(txParent));
testPool.remove(txParent, removed, true);
BOOST_CHECK_EQUAL(removed.size(), 1);
removed.clear();
// Parent, children, grandchildren:
- testPool.addUnchecked(txParent.GetHash(), CTxMemPoolEntry(txParent, 0, 0, 0.0, 1));
+ testPool.addUnchecked(txParent.GetHash(), entry.FromTx(txParent));
for (int i = 0; i < 3; i++)
{
- testPool.addUnchecked(txChild[i].GetHash(), CTxMemPoolEntry(txChild[i], 0, 0, 0.0, 1));
- testPool.addUnchecked(txGrandChild[i].GetHash(), CTxMemPoolEntry(txGrandChild[i], 0, 0, 0.0, 1));
+ testPool.addUnchecked(txChild[i].GetHash(), entry.FromTx(txChild[i]));
+ testPool.addUnchecked(txGrandChild[i].GetHash(), entry.FromTx(txGrandChild[i]));
}
// Remove Child[0], GrandChild[0] should be removed:
testPool.remove(txChild[0], removed, true);
@@ -90,8 +91,8 @@ BOOST_AUTO_TEST_CASE(MempoolRemoveTest)
// Add children and grandchildren, but NOT the parent (simulate the parent being in a block)
for (int i = 0; i < 3; i++)
{
- testPool.addUnchecked(txChild[i].GetHash(), CTxMemPoolEntry(txChild[i], 0, 0, 0.0, 1));
- testPool.addUnchecked(txGrandChild[i].GetHash(), CTxMemPoolEntry(txGrandChild[i], 0, 0, 0.0, 1));
+ testPool.addUnchecked(txChild[i].GetHash(), entry.FromTx(txChild[i]));
+ testPool.addUnchecked(txGrandChild[i].GetHash(), entry.FromTx(txGrandChild[i]));
}
// Now remove the parent, as might happen if a block-re-org occurs but the parent cannot be
// put into the mempool (maybe because it is non-standard):
@@ -114,41 +115,45 @@ void CheckSort(CTxMemPool &pool, std::vector<std::string> &sortedOrder)
BOOST_AUTO_TEST_CASE(MempoolIndexingTest)
{
CTxMemPool pool(CFeeRate(0));
+ TestMemPoolEntryHelper entry;
+ entry.hadNoDependencies = true;
/* 3rd highest fee */
CMutableTransaction tx1 = CMutableTransaction();
tx1.vout.resize(1);
tx1.vout[0].scriptPubKey = CScript() << OP_11 << OP_EQUAL;
tx1.vout[0].nValue = 10 * COIN;
- pool.addUnchecked(tx1.GetHash(), CTxMemPoolEntry(tx1, 10000LL, 0, 10.0, 1, true));
+ pool.addUnchecked(tx1.GetHash(), entry.Fee(10000LL).Priority(10.0).FromTx(tx1));
/* highest fee */
CMutableTransaction tx2 = CMutableTransaction();
tx2.vout.resize(1);
tx2.vout[0].scriptPubKey = CScript() << OP_11 << OP_EQUAL;
tx2.vout[0].nValue = 2 * COIN;
- pool.addUnchecked(tx2.GetHash(), CTxMemPoolEntry(tx2, 20000LL, 0, 9.0, 1, true));
+ pool.addUnchecked(tx2.GetHash(), entry.Fee(20000LL).Priority(9.0).FromTx(tx2));
/* lowest fee */
CMutableTransaction tx3 = CMutableTransaction();
tx3.vout.resize(1);
tx3.vout[0].scriptPubKey = CScript() << OP_11 << OP_EQUAL;
tx3.vout[0].nValue = 5 * COIN;
- pool.addUnchecked(tx3.GetHash(), CTxMemPoolEntry(tx3, 0LL, 0, 100.0, 1, true));
+ pool.addUnchecked(tx3.GetHash(), entry.Fee(0LL).Priority(100.0).FromTx(tx3));
/* 2nd highest fee */
CMutableTransaction tx4 = CMutableTransaction();
tx4.vout.resize(1);
tx4.vout[0].scriptPubKey = CScript() << OP_11 << OP_EQUAL;
tx4.vout[0].nValue = 6 * COIN;
- pool.addUnchecked(tx4.GetHash(), CTxMemPoolEntry(tx4, 15000LL, 0, 1.0, 1, true));
+ pool.addUnchecked(tx4.GetHash(), entry.Fee(15000LL).Priority(1.0).FromTx(tx4));
/* equal fee rate to tx1, but newer */
CMutableTransaction tx5 = CMutableTransaction();
tx5.vout.resize(1);
tx5.vout[0].scriptPubKey = CScript() << OP_11 << OP_EQUAL;
tx5.vout[0].nValue = 11 * COIN;
- pool.addUnchecked(tx5.GetHash(), CTxMemPoolEntry(tx5, 10000LL, 1, 10.0, 1, true));
+ entry.nTime = 1;
+ entry.dPriority = 10.0;
+ pool.addUnchecked(tx5.GetHash(), entry.Fee(10000LL).FromTx(tx5));
BOOST_CHECK_EQUAL(pool.size(), 5);
std::vector<std::string> sortedOrder;
@@ -166,7 +171,7 @@ BOOST_AUTO_TEST_CASE(MempoolIndexingTest)
tx6.vout.resize(1);
tx6.vout[0].scriptPubKey = CScript() << OP_11 << OP_EQUAL;
tx6.vout[0].nValue = 20 * COIN;
- pool.addUnchecked(tx6.GetHash(), CTxMemPoolEntry(tx6, 0LL, 1, 10.0, 1, true));
+ pool.addUnchecked(tx6.GetHash(), entry.Fee(0LL).FromTx(tx6));
BOOST_CHECK_EQUAL(pool.size(), 6);
// Check that at this point, tx6 is sorted low
sortedOrder.insert(sortedOrder.begin(), tx6.GetHash().ToString());
@@ -186,11 +191,10 @@ BOOST_AUTO_TEST_CASE(MempoolIndexingTest)
CTxMemPool::setEntries setAncestorsCalculated;
std::string dummy;
- CTxMemPoolEntry entry7(tx7, 2000000LL, 1, 10.0, 1, true);
- BOOST_CHECK_EQUAL(pool.CalculateMemPoolAncestors(entry7, setAncestorsCalculated, 100, 1000000, 1000, 1000000, dummy), true);
+ BOOST_CHECK_EQUAL(pool.CalculateMemPoolAncestors(entry.Fee(2000000LL).FromTx(tx7), setAncestorsCalculated, 100, 1000000, 1000, 1000000, dummy), true);
BOOST_CHECK(setAncestorsCalculated == setAncestors);
- pool.addUnchecked(tx7.GetHash(), CTxMemPoolEntry(tx7, 2000000LL, 1, 10.0, 1, true), setAncestors);
+ pool.addUnchecked(tx7.GetHash(), entry.FromTx(tx7), setAncestors);
BOOST_CHECK_EQUAL(pool.size(), 7);
// Now tx6 should be sorted higher (high fee child): tx7, tx6, tx2, ...
@@ -208,7 +212,7 @@ BOOST_AUTO_TEST_CASE(MempoolIndexingTest)
tx8.vout[0].scriptPubKey = CScript() << OP_11 << OP_EQUAL;
tx8.vout[0].nValue = 10 * COIN;
setAncestors.insert(pool.mapTx.find(tx7.GetHash()));
- pool.addUnchecked(tx8.GetHash(), CTxMemPoolEntry(tx8, 0LL, 2, 10.0, 1, true), setAncestors);
+ pool.addUnchecked(tx8.GetHash(), entry.Fee(0LL).Time(2).FromTx(tx8), setAncestors);
// Now tx8 should be sorted low, but tx6/tx both high
sortedOrder.insert(sortedOrder.begin(), tx8.GetHash().ToString());
@@ -222,7 +226,7 @@ BOOST_AUTO_TEST_CASE(MempoolIndexingTest)
tx9.vout.resize(1);
tx9.vout[0].scriptPubKey = CScript() << OP_11 << OP_EQUAL;
tx9.vout[0].nValue = 1 * COIN;
- pool.addUnchecked(tx9.GetHash(), CTxMemPoolEntry(tx9, 0LL, 3, 10.0, 1, true), setAncestors);
+ pool.addUnchecked(tx9.GetHash(), entry.Fee(0LL).Time(3).FromTx(tx9), setAncestors);
// tx9 should be sorted low
BOOST_CHECK_EQUAL(pool.size(), 9);
@@ -245,11 +249,10 @@ BOOST_AUTO_TEST_CASE(MempoolIndexingTest)
tx10.vout[0].nValue = 10 * COIN;
setAncestorsCalculated.clear();
- CTxMemPoolEntry entry10(tx10, 200000LL, 4, 10.0, 1, true);
- BOOST_CHECK_EQUAL(pool.CalculateMemPoolAncestors(entry10, setAncestorsCalculated, 100, 1000000, 1000, 1000000, dummy), true);
+ BOOST_CHECK_EQUAL(pool.CalculateMemPoolAncestors(entry.Fee(200000LL).Time(4).FromTx(tx10), setAncestorsCalculated, 100, 1000000, 1000, 1000000, dummy), true);
BOOST_CHECK(setAncestorsCalculated == setAncestors);
- pool.addUnchecked(tx10.GetHash(), CTxMemPoolEntry(tx10, 200000LL, 4, 10.0, 1, true), setAncestors);
+ pool.addUnchecked(tx10.GetHash(), entry.FromTx(tx10), setAncestors);
/**
* tx8 and tx9 should both now be sorted higher
@@ -284,6 +287,8 @@ BOOST_AUTO_TEST_CASE(MempoolIndexingTest)
BOOST_AUTO_TEST_CASE(MempoolSizeLimitTest)
{
CTxMemPool pool(CFeeRate(1000));
+ TestMemPoolEntryHelper entry;
+ entry.dPriority = 10.0;
CMutableTransaction tx1 = CMutableTransaction();
tx1.vin.resize(1);
@@ -291,7 +296,7 @@ BOOST_AUTO_TEST_CASE(MempoolSizeLimitTest)
tx1.vout.resize(1);
tx1.vout[0].scriptPubKey = CScript() << OP_1 << OP_EQUAL;
tx1.vout[0].nValue = 10 * COIN;
- pool.addUnchecked(tx1.GetHash(), CTxMemPoolEntry(tx1, 10000LL, 0, 10.0, 1, pool.HasNoInputsOf(tx1)));
+ pool.addUnchecked(tx1.GetHash(), entry.Fee(10000LL).FromTx(tx1, &pool));
CMutableTransaction tx2 = CMutableTransaction();
tx2.vin.resize(1);
@@ -299,7 +304,7 @@ BOOST_AUTO_TEST_CASE(MempoolSizeLimitTest)
tx2.vout.resize(1);
tx2.vout[0].scriptPubKey = CScript() << OP_2 << OP_EQUAL;
tx2.vout[0].nValue = 10 * COIN;
- pool.addUnchecked(tx2.GetHash(), CTxMemPoolEntry(tx2, 5000LL, 0, 10.0, 1, pool.HasNoInputsOf(tx2)));
+ pool.addUnchecked(tx2.GetHash(), entry.Fee(5000LL).FromTx(tx2, &pool));
pool.TrimToSize(pool.DynamicMemoryUsage()); // should do nothing
BOOST_CHECK(pool.exists(tx1.GetHash()));
@@ -309,7 +314,7 @@ BOOST_AUTO_TEST_CASE(MempoolSizeLimitTest)
BOOST_CHECK(pool.exists(tx1.GetHash()));
BOOST_CHECK(!pool.exists(tx2.GetHash()));
- pool.addUnchecked(tx2.GetHash(), CTxMemPoolEntry(tx2, 5000LL, 0, 10.0, 1, pool.HasNoInputsOf(tx2)));
+ pool.addUnchecked(tx2.GetHash(), entry.FromTx(tx2, &pool));
CMutableTransaction tx3 = CMutableTransaction();
tx3.vin.resize(1);
tx3.vin[0].prevout = COutPoint(tx2.GetHash(), 0);
@@ -317,7 +322,7 @@ BOOST_AUTO_TEST_CASE(MempoolSizeLimitTest)
tx3.vout.resize(1);
tx3.vout[0].scriptPubKey = CScript() << OP_3 << OP_EQUAL;
tx3.vout[0].nValue = 10 * COIN;
- pool.addUnchecked(tx3.GetHash(), CTxMemPoolEntry(tx3, 20000LL, 0, 10.0, 1, pool.HasNoInputsOf(tx3)));
+ pool.addUnchecked(tx3.GetHash(), entry.Fee(20000LL).FromTx(tx3, &pool));
pool.TrimToSize(pool.DynamicMemoryUsage() * 3 / 4); // tx3 should pay for tx2 (CPFP)
BOOST_CHECK(!pool.exists(tx1.GetHash()));
@@ -377,13 +382,13 @@ BOOST_AUTO_TEST_CASE(MempoolSizeLimitTest)
tx7.vout.resize(2);
tx7.vout[0].scriptPubKey = CScript() << OP_7 << OP_EQUAL;
tx7.vout[0].nValue = 10 * COIN;
- tx7.vout[0].scriptPubKey = CScript() << OP_7 << OP_EQUAL;
- tx7.vout[0].nValue = 10 * COIN;
+ tx7.vout[1].scriptPubKey = CScript() << OP_7 << OP_EQUAL;
+ tx7.vout[1].nValue = 10 * COIN;
- pool.addUnchecked(tx4.GetHash(), CTxMemPoolEntry(tx4, 7000LL, 0, 10.0, 1, pool.HasNoInputsOf(tx4)));
- pool.addUnchecked(tx5.GetHash(), CTxMemPoolEntry(tx5, 1000LL, 0, 10.0, 1, pool.HasNoInputsOf(tx5)));
- pool.addUnchecked(tx6.GetHash(), CTxMemPoolEntry(tx6, 1100LL, 0, 10.0, 1, pool.HasNoInputsOf(tx6)));
- pool.addUnchecked(tx7.GetHash(), CTxMemPoolEntry(tx7, 9000LL, 0, 10.0, 1, pool.HasNoInputsOf(tx7)));
+ pool.addUnchecked(tx4.GetHash(), entry.Fee(7000LL).FromTx(tx4, &pool));
+ pool.addUnchecked(tx5.GetHash(), entry.Fee(1000LL).FromTx(tx5, &pool));
+ pool.addUnchecked(tx6.GetHash(), entry.Fee(1100LL).FromTx(tx6, &pool));
+ pool.addUnchecked(tx7.GetHash(), entry.Fee(9000LL).FromTx(tx7, &pool));
// we only require this remove, at max, 2 txn, because its not clear what we're really optimizing for aside from that
pool.TrimToSize(pool.DynamicMemoryUsage() - 1);
@@ -392,8 +397,8 @@ BOOST_AUTO_TEST_CASE(MempoolSizeLimitTest)
BOOST_CHECK(!pool.exists(tx7.GetHash()));
if (!pool.exists(tx5.GetHash()))
- pool.addUnchecked(tx5.GetHash(), CTxMemPoolEntry(tx5, 1000LL, 0, 10.0, 1, pool.HasNoInputsOf(tx5)));
- pool.addUnchecked(tx7.GetHash(), CTxMemPoolEntry(tx7, 9000LL, 0, 10.0, 1, pool.HasNoInputsOf(tx7)));
+ pool.addUnchecked(tx5.GetHash(), entry.Fee(1000LL).FromTx(tx5, &pool));
+ pool.addUnchecked(tx7.GetHash(), entry.Fee(9000LL).FromTx(tx7, &pool));
pool.TrimToSize(pool.DynamicMemoryUsage() / 2); // should maximize mempool size by only removing 5/7
BOOST_CHECK(pool.exists(tx4.GetHash()));
@@ -401,8 +406,8 @@ BOOST_AUTO_TEST_CASE(MempoolSizeLimitTest)
BOOST_CHECK(pool.exists(tx6.GetHash()));
BOOST_CHECK(!pool.exists(tx7.GetHash()));
- pool.addUnchecked(tx5.GetHash(), CTxMemPoolEntry(tx5, 1000LL, 0, 10.0, 1, pool.HasNoInputsOf(tx5)));
- pool.addUnchecked(tx7.GetHash(), CTxMemPoolEntry(tx7, 9000LL, 0, 10.0, 1, pool.HasNoInputsOf(tx7)));
+ pool.addUnchecked(tx5.GetHash(), entry.Fee(1000LL).FromTx(tx5, &pool));
+ pool.addUnchecked(tx7.GetHash(), entry.Fee(9000LL).FromTx(tx7, &pool));
std::vector<CTransaction> vtx;
std::list<CTransaction> conflicts;
diff --git a/src/test/merkle_tests.cpp b/src/test/merkle_tests.cpp
new file mode 100644
index 0000000000..1e31f2e679
--- /dev/null
+++ b/src/test/merkle_tests.cpp
@@ -0,0 +1,136 @@
+// Copyright (c) 2015 The Bitcoin Core developers
+// Distributed under the MIT software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
+#include "consensus/merkle.h"
+#include "test/test_bitcoin.h"
+#include "random.h"
+
+#include <boost/test/unit_test.hpp>
+
+BOOST_FIXTURE_TEST_SUITE(merkle_tests, TestingSetup)
+
+// Older version of the merkle root computation code, for comparison.
+static uint256 BlockBuildMerkleTree(const CBlock& block, bool* fMutated, std::vector<uint256>& vMerkleTree)
+{
+ vMerkleTree.clear();
+ vMerkleTree.reserve(block.vtx.size() * 2 + 16); // Safe upper bound for the number of total nodes.
+ for (std::vector<CTransaction>::const_iterator it(block.vtx.begin()); it != block.vtx.end(); ++it)
+ vMerkleTree.push_back(it->GetHash());
+ int j = 0;
+ bool mutated = false;
+ for (int nSize = block.vtx.size(); nSize > 1; nSize = (nSize + 1) / 2)
+ {
+ for (int i = 0; i < nSize; i += 2)
+ {
+ int i2 = std::min(i+1, nSize-1);
+ if (i2 == i + 1 && i2 + 1 == nSize && vMerkleTree[j+i] == vMerkleTree[j+i2]) {
+ // Two identical hashes at the end of the list at a particular level.
+ mutated = true;
+ }
+ vMerkleTree.push_back(Hash(vMerkleTree[j+i].begin(), vMerkleTree[j+i].end(),
+ vMerkleTree[j+i2].begin(), vMerkleTree[j+i2].end()));
+ }
+ j += nSize;
+ }
+ if (fMutated) {
+ *fMutated = mutated;
+ }
+ return (vMerkleTree.empty() ? uint256() : vMerkleTree.back());
+}
+
+// Older version of the merkle branch computation code, for comparison.
+static std::vector<uint256> BlockGetMerkleBranch(const CBlock& block, const std::vector<uint256>& vMerkleTree, int nIndex)
+{
+ std::vector<uint256> vMerkleBranch;
+ int j = 0;
+ for (int nSize = block.vtx.size(); nSize > 1; nSize = (nSize + 1) / 2)
+ {
+ int i = std::min(nIndex^1, nSize-1);
+ vMerkleBranch.push_back(vMerkleTree[j+i]);
+ nIndex >>= 1;
+ j += nSize;
+ }
+ return vMerkleBranch;
+}
+
+static inline int ctz(uint32_t i) {
+ if (i == 0) return 0;
+ int j = 0;
+ while (!(i & 1)) {
+ j++;
+ i >>= 1;
+ }
+ return j;
+}
+
+BOOST_AUTO_TEST_CASE(merkle_test)
+{
+ for (int i = 0; i < 32; i++) {
+ // Try 32 block sizes: all sizes from 0 to 16 inclusive, and then 15 random sizes.
+ int ntx = (i <= 16) ? i : 17 + (insecure_rand() % 4000);
+ // Try up to 3 mutations.
+ for (int mutate = 0; mutate <= 3; mutate++) {
+ int duplicate1 = mutate >= 1 ? 1 << ctz(ntx) : 0; // The last how many transactions to duplicate first.
+ if (duplicate1 >= ntx) break; // Duplication of the entire tree results in a different root (it adds a level).
+ int ntx1 = ntx + duplicate1; // The resulting number of transactions after the first duplication.
+ int duplicate2 = mutate >= 2 ? 1 << ctz(ntx1) : 0; // Likewise for the second mutation.
+ if (duplicate2 >= ntx1) break;
+ int ntx2 = ntx1 + duplicate2;
+ int duplicate3 = mutate >= 3 ? 1 << ctz(ntx2) : 0; // And for the the third mutation.
+ if (duplicate3 >= ntx2) break;
+ int ntx3 = ntx2 + duplicate3;
+ // Build a block with ntx different transactions.
+ CBlock block;
+ block.vtx.resize(ntx);
+ for (int j = 0; j < ntx; j++) {
+ CMutableTransaction mtx;
+ mtx.nLockTime = j;
+ block.vtx[j] = mtx;
+ }
+ // Compute the root of the block before mutating it.
+ bool unmutatedMutated = false;
+ uint256 unmutatedRoot = BlockMerkleRoot(block, &unmutatedMutated);
+ BOOST_CHECK(unmutatedMutated == false);
+ // Optionally mutate by duplicating the last transactions, resulting in the same merkle root.
+ block.vtx.resize(ntx3);
+ for (int j = 0; j < duplicate1; j++) {
+ block.vtx[ntx + j] = block.vtx[ntx + j - duplicate1];
+ }
+ for (int j = 0; j < duplicate2; j++) {
+ block.vtx[ntx1 + j] = block.vtx[ntx1 + j - duplicate2];
+ }
+ for (int j = 0; j < duplicate3; j++) {
+ block.vtx[ntx2 + j] = block.vtx[ntx2 + j - duplicate3];
+ }
+ // Compute the merkle root and merkle tree using the old mechanism.
+ bool oldMutated = false;
+ std::vector<uint256> merkleTree;
+ uint256 oldRoot = BlockBuildMerkleTree(block, &oldMutated, merkleTree);
+ // Compute the merkle root using the new mechanism.
+ bool newMutated = false;
+ uint256 newRoot = BlockMerkleRoot(block, &newMutated);
+ BOOST_CHECK(oldRoot == newRoot);
+ BOOST_CHECK(newRoot == unmutatedRoot);
+ BOOST_CHECK((newRoot == uint256()) == (ntx == 0));
+ BOOST_CHECK(oldMutated == newMutated);
+ BOOST_CHECK(newMutated == !!mutate);
+ // If no mutation was done (once for every ntx value), try up to 16 branches.
+ if (mutate == 0) {
+ for (int loop = 0; loop < std::min(ntx, 16); loop++) {
+ // If ntx <= 16, try all branches. Otherise, try 16 random ones.
+ int mtx = loop;
+ if (ntx > 16) {
+ mtx = insecure_rand() % ntx;
+ }
+ std::vector<uint256> newBranch = BlockMerkleBranch(block, mtx);
+ std::vector<uint256> oldBranch = BlockGetMerkleBranch(block, merkleTree, mtx);
+ BOOST_CHECK(oldBranch == newBranch);
+ BOOST_CHECK(ComputeMerkleRootFromBranch(block.vtx[mtx].GetHash(), newBranch, mtx) == oldRoot);
+ }
+ }
+ }
+ }
+}
+
+BOOST_AUTO_TEST_SUITE_END()
diff --git a/src/test/miner_tests.cpp b/src/test/miner_tests.cpp
index d92b7ec62e..9c48917850 100644
--- a/src/test/miner_tests.cpp
+++ b/src/test/miner_tests.cpp
@@ -5,6 +5,7 @@
#include "chainparams.h"
#include "coins.h"
#include "consensus/consensus.h"
+#include "consensus/merkle.h"
#include "consensus/validation.h"
#include "main.h"
#include "miner.h"
@@ -59,17 +60,22 @@ struct {
// NOTE: These tests rely on CreateNewBlock doing its own self-validation!
BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
{
+ const CChainParams& chainparams = Params(CBaseChainParams::MAIN);
CScript scriptPubKey = CScript() << ParseHex("04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f") << OP_CHECKSIG;
CBlockTemplate *pblocktemplate;
CMutableTransaction tx,tx2;
CScript script;
uint256 hash;
+ TestMemPoolEntryHelper entry;
+ entry.nFee = 11;
+ entry.dPriority = 111.0;
+ entry.nHeight = 11;
LOCK(cs_main);
fCheckpointsEnabled = false;
// Simple block creation, nothing special yet:
- BOOST_CHECK(pblocktemplate = CreateNewBlock(scriptPubKey));
+ BOOST_CHECK(pblocktemplate = CreateNewBlock(chainparams, scriptPubKey));
// We can't make transactions until we have inputs
// Therefore, load 100 blocks :)
@@ -88,17 +94,17 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
pblock->vtx[0] = CTransaction(txCoinbase);
if (txFirst.size() < 2)
txFirst.push_back(new CTransaction(pblock->vtx[0]));
- pblock->hashMerkleRoot = pblock->ComputeMerkleRoot();
+ pblock->hashMerkleRoot = BlockMerkleRoot(*pblock);
pblock->nNonce = blockinfo[i].nonce;
CValidationState state;
- BOOST_CHECK(ProcessNewBlock(state, NULL, pblock, true, NULL));
+ BOOST_CHECK(ProcessNewBlock(state, chainparams, NULL, pblock, true, NULL));
BOOST_CHECK(state.IsValid());
pblock->hashPrevBlock = pblock->GetHash();
}
delete pblocktemplate;
// Just to make sure we can still make simple blocks
- BOOST_CHECK(pblocktemplate = CreateNewBlock(scriptPubKey));
+ BOOST_CHECK(pblocktemplate = CreateNewBlock(chainparams, scriptPubKey));
delete pblocktemplate;
// block sigops > limit: 1000 CHECKMULTISIG + 1
@@ -113,10 +119,10 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
{
tx.vout[0].nValue -= 1000000;
hash = tx.GetHash();
- mempool.addUnchecked(hash, CTxMemPoolEntry(tx, 11, GetTime(), 111.0, 11));
+ mempool.addUnchecked(hash, entry.Time(GetTime()).FromTx(tx));
tx.vin[0].prevout.hash = hash;
}
- BOOST_CHECK(pblocktemplate = CreateNewBlock(scriptPubKey));
+ BOOST_CHECK(pblocktemplate = CreateNewBlock(chainparams, scriptPubKey));
delete pblocktemplate;
mempool.clear();
@@ -133,17 +139,17 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
{
tx.vout[0].nValue -= 10000000;
hash = tx.GetHash();
- mempool.addUnchecked(hash, CTxMemPoolEntry(tx, 11, GetTime(), 111.0, 11));
+ mempool.addUnchecked(hash, entry.Time(GetTime()).FromTx(tx));
tx.vin[0].prevout.hash = hash;
}
- BOOST_CHECK(pblocktemplate = CreateNewBlock(scriptPubKey));
+ BOOST_CHECK(pblocktemplate = CreateNewBlock(chainparams, scriptPubKey));
delete pblocktemplate;
mempool.clear();
// orphan in mempool
hash = tx.GetHash();
- mempool.addUnchecked(hash, CTxMemPoolEntry(tx, 11, GetTime(), 111.0, 11));
- BOOST_CHECK(pblocktemplate = CreateNewBlock(scriptPubKey));
+ mempool.addUnchecked(hash, entry.Time(GetTime()).FromTx(tx));
+ BOOST_CHECK(pblocktemplate = CreateNewBlock(chainparams, scriptPubKey));
delete pblocktemplate;
mempool.clear();
@@ -152,7 +158,7 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
tx.vin[0].prevout.hash = txFirst[1]->GetHash();
tx.vout[0].nValue = 4900000000LL;
hash = tx.GetHash();
- mempool.addUnchecked(hash, CTxMemPoolEntry(tx, 11, GetTime(), 111.0, 11));
+ mempool.addUnchecked(hash, entry.Time(GetTime()).FromTx(tx));
tx.vin[0].prevout.hash = hash;
tx.vin.resize(2);
tx.vin[1].scriptSig = CScript() << OP_1;
@@ -160,8 +166,8 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
tx.vin[1].prevout.n = 0;
tx.vout[0].nValue = 5900000000LL;
hash = tx.GetHash();
- mempool.addUnchecked(hash, CTxMemPoolEntry(tx, 11, GetTime(), 111.0, 11));
- BOOST_CHECK(pblocktemplate = CreateNewBlock(scriptPubKey));
+ mempool.addUnchecked(hash, entry.Time(GetTime()).FromTx(tx));
+ BOOST_CHECK(pblocktemplate = CreateNewBlock(chainparams, scriptPubKey));
delete pblocktemplate;
mempool.clear();
@@ -171,8 +177,8 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
tx.vin[0].scriptSig = CScript() << OP_0 << OP_1;
tx.vout[0].nValue = 0;
hash = tx.GetHash();
- mempool.addUnchecked(hash, CTxMemPoolEntry(tx, 11, GetTime(), 111.0, 11));
- BOOST_CHECK(pblocktemplate = CreateNewBlock(scriptPubKey));
+ mempool.addUnchecked(hash, entry.Time(GetTime()).FromTx(tx));
+ BOOST_CHECK(pblocktemplate = CreateNewBlock(chainparams, scriptPubKey));
delete pblocktemplate;
mempool.clear();
@@ -184,13 +190,13 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
script = CScript() << OP_0;
tx.vout[0].scriptPubKey = GetScriptForDestination(CScriptID(script));
hash = tx.GetHash();
- mempool.addUnchecked(hash, CTxMemPoolEntry(tx, 11, GetTime(), 111.0, 11));
+ mempool.addUnchecked(hash, entry.Time(GetTime()).FromTx(tx));
tx.vin[0].prevout.hash = hash;
tx.vin[0].scriptSig = CScript() << std::vector<unsigned char>(script.begin(), script.end());
tx.vout[0].nValue -= 1000000;
hash = tx.GetHash();
- mempool.addUnchecked(hash, CTxMemPoolEntry(tx, 11, GetTime(), 111.0, 11));
- BOOST_CHECK(pblocktemplate = CreateNewBlock(scriptPubKey));
+ mempool.addUnchecked(hash, entry.Time(GetTime()).FromTx(tx));
+ BOOST_CHECK(pblocktemplate = CreateNewBlock(chainparams, scriptPubKey));
delete pblocktemplate;
mempool.clear();
@@ -200,21 +206,21 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
tx.vout[0].nValue = 4900000000LL;
tx.vout[0].scriptPubKey = CScript() << OP_1;
hash = tx.GetHash();
- mempool.addUnchecked(hash, CTxMemPoolEntry(tx, 11, GetTime(), 111.0, 11));
+ mempool.addUnchecked(hash, entry.Time(GetTime()).FromTx(tx));
tx.vout[0].scriptPubKey = CScript() << OP_2;
hash = tx.GetHash();
- mempool.addUnchecked(hash, CTxMemPoolEntry(tx, 11, GetTime(), 111.0, 11));
- BOOST_CHECK(pblocktemplate = CreateNewBlock(scriptPubKey));
+ mempool.addUnchecked(hash, entry.Time(GetTime()).FromTx(tx));
+ BOOST_CHECK(pblocktemplate = CreateNewBlock(chainparams, scriptPubKey));
delete pblocktemplate;
mempool.clear();
// subsidy changing
int nHeight = chainActive.Height();
chainActive.Tip()->nHeight = 209999;
- BOOST_CHECK(pblocktemplate = CreateNewBlock(scriptPubKey));
+ BOOST_CHECK(pblocktemplate = CreateNewBlock(chainparams, scriptPubKey));
delete pblocktemplate;
chainActive.Tip()->nHeight = 210000;
- BOOST_CHECK(pblocktemplate = CreateNewBlock(scriptPubKey));
+ BOOST_CHECK(pblocktemplate = CreateNewBlock(chainparams, scriptPubKey));
delete pblocktemplate;
chainActive.Tip()->nHeight = nHeight;
@@ -229,7 +235,7 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
tx.vout[0].scriptPubKey = CScript() << OP_1;
tx.nLockTime = chainActive.Tip()->nHeight+1;
hash = tx.GetHash();
- mempool.addUnchecked(hash, CTxMemPoolEntry(tx, 11, GetTime(), 111.0, 11));
+ mempool.addUnchecked(hash, entry.Time(GetTime()).FromTx(tx));
BOOST_CHECK(!CheckFinalTx(tx, LOCKTIME_MEDIAN_TIME_PAST));
// time locked
@@ -243,10 +249,10 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
tx2.vout[0].scriptPubKey = CScript() << OP_1;
tx2.nLockTime = chainActive.Tip()->GetMedianTimePast()+1;
hash = tx2.GetHash();
- mempool.addUnchecked(hash, CTxMemPoolEntry(tx2, 11, GetTime(), 111.0, 11));
+ mempool.addUnchecked(hash, entry.Time(GetTime()).FromTx(tx2));
BOOST_CHECK(!CheckFinalTx(tx2, LOCKTIME_MEDIAN_TIME_PAST));
- BOOST_CHECK(pblocktemplate = CreateNewBlock(scriptPubKey));
+ BOOST_CHECK(pblocktemplate = CreateNewBlock(chainparams, scriptPubKey));
// Neither tx should have make it into the template.
BOOST_CHECK_EQUAL(pblocktemplate->block.vtx.size(), 1);
@@ -261,7 +267,7 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
//BOOST_CHECK(CheckFinalTx(tx));
//BOOST_CHECK(CheckFinalTx(tx2));
- BOOST_CHECK(pblocktemplate = CreateNewBlock(scriptPubKey));
+ BOOST_CHECK(pblocktemplate = CreateNewBlock(chainparams, scriptPubKey));
BOOST_CHECK_EQUAL(pblocktemplate->block.vtx.size(), 2);
delete pblocktemplate;
diff --git a/src/test/pmt_tests.cpp b/src/test/pmt_tests.cpp
index d9f3c3e467..0d7fb2bc35 100644
--- a/src/test/pmt_tests.cpp
+++ b/src/test/pmt_tests.cpp
@@ -2,6 +2,7 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+#include "consensus/merkle.h"
#include "merkleblock.h"
#include "serialize.h"
#include "streams.h"
@@ -48,7 +49,7 @@ BOOST_AUTO_TEST_CASE(pmt_test1)
}
// calculate actual merkle root and height
- uint256 merkleRoot1 = block.ComputeMerkleRoot();
+ uint256 merkleRoot1 = BlockMerkleRoot(block);
std::vector<uint256> vTxid(nTx, uint256());
for (unsigned int j=0; j<nTx; j++)
vTxid[j] = block.vtx[j].GetHash();
diff --git a/src/test/policyestimator_tests.cpp b/src/test/policyestimator_tests.cpp
index cb64ee7c69..644c3da213 100644
--- a/src/test/policyestimator_tests.cpp
+++ b/src/test/policyestimator_tests.cpp
@@ -16,6 +16,7 @@ BOOST_FIXTURE_TEST_SUITE(policyestimator_tests, BasicTestingSetup)
BOOST_AUTO_TEST_CASE(BlockPolicyEstimates)
{
CTxMemPool mpool(CFeeRate(1000));
+ TestMemPoolEntryHelper entry;
CAmount basefee(2000);
double basepri = 1e6;
CAmount deltaFee(100);
@@ -63,7 +64,7 @@ BOOST_AUTO_TEST_CASE(BlockPolicyEstimates)
for (int k = 0; k < 5; k++) { // add 4 fee txs for every priority tx
tx.vin[0].prevout.n = 10000*blocknum+100*j+k; // make transaction unique
uint256 hash = tx.GetHash();
- mpool.addUnchecked(hash, CTxMemPoolEntry(tx, feeV[k/4][j], GetTime(), priV[k/4][j], blocknum, mpool.HasNoInputsOf(tx)));
+ mpool.addUnchecked(hash, entry.Fee(feeV[k/4][j]).Time(GetTime()).Priority(priV[k/4][j]).Height(blocknum).FromTx(tx, &mpool));
txHashes[j].push_back(hash);
}
}
@@ -83,11 +84,18 @@ BOOST_AUTO_TEST_CASE(BlockPolicyEstimates)
block.clear();
if (blocknum == 30) {
// At this point we should need to combine 5 buckets to get enough data points
- // So estimateFee(1) should fail and estimateFee(2) should return somewhere around
- // 8*baserate
+ // So estimateFee(1,2,3) should fail and estimateFee(4) should return somewhere around
+ // 8*baserate. estimateFee(4) %'s are 100,100,100,100,90 = average 98%
BOOST_CHECK(mpool.estimateFee(1) == CFeeRate(0));
- BOOST_CHECK(mpool.estimateFee(2).GetFeePerK() < 8*baseRate.GetFeePerK() + deltaFee);
- BOOST_CHECK(mpool.estimateFee(2).GetFeePerK() > 8*baseRate.GetFeePerK() - deltaFee);
+ BOOST_CHECK(mpool.estimateFee(2) == CFeeRate(0));
+ BOOST_CHECK(mpool.estimateFee(3) == CFeeRate(0));
+ BOOST_CHECK(mpool.estimateFee(4).GetFeePerK() < 8*baseRate.GetFeePerK() + deltaFee);
+ BOOST_CHECK(mpool.estimateFee(4).GetFeePerK() > 8*baseRate.GetFeePerK() - deltaFee);
+ int answerFound;
+ BOOST_CHECK(mpool.estimateSmartFee(1, &answerFound) == mpool.estimateFee(4) && answerFound == 4);
+ BOOST_CHECK(mpool.estimateSmartFee(3, &answerFound) == mpool.estimateFee(4) && answerFound == 4);
+ BOOST_CHECK(mpool.estimateSmartFee(4, &answerFound) == mpool.estimateFee(4) && answerFound == 4);
+ BOOST_CHECK(mpool.estimateSmartFee(8, &answerFound) == mpool.estimateFee(8) && answerFound == 8);
}
}
@@ -96,9 +104,9 @@ BOOST_AUTO_TEST_CASE(BlockPolicyEstimates)
// Highest feerate is 10*baseRate and gets in all blocks,
// second highest feerate is 9*baseRate and gets in 9/10 blocks = 90%,
// third highest feerate is 8*base rate, and gets in 8/10 blocks = 80%,
- // so estimateFee(1) should return 9*baseRate.
- // Third highest feerate has 90% chance of being included by 2 blocks,
- // so estimateFee(2) should return 8*baseRate etc...
+ // so estimateFee(1) should return 10*baseRate.
+ // Second highest feerate has 100% chance of being included by 2 blocks,
+ // so estimateFee(2) should return 9*baseRate etc...
for (int i = 1; i < 10;i++) {
origFeeEst.push_back(mpool.estimateFee(i).GetFeePerK());
origPriEst.push_back(mpool.estimatePriority(i));
@@ -106,10 +114,11 @@ BOOST_AUTO_TEST_CASE(BlockPolicyEstimates)
BOOST_CHECK(origFeeEst[i-1] <= origFeeEst[i-2]);
BOOST_CHECK(origPriEst[i-1] <= origPriEst[i-2]);
}
- BOOST_CHECK(origFeeEst[i-1] < (10-i)*baseRate.GetFeePerK() + deltaFee);
- BOOST_CHECK(origFeeEst[i-1] > (10-i)*baseRate.GetFeePerK() - deltaFee);
- BOOST_CHECK(origPriEst[i-1] < pow(10,10-i) * basepri + deltaPri);
- BOOST_CHECK(origPriEst[i-1] > pow(10,10-i) * basepri - deltaPri);
+ int mult = 11-i;
+ BOOST_CHECK(origFeeEst[i-1] < mult*baseRate.GetFeePerK() + deltaFee);
+ BOOST_CHECK(origFeeEst[i-1] > mult*baseRate.GetFeePerK() - deltaFee);
+ BOOST_CHECK(origPriEst[i-1] < pow(10,mult) * basepri + deltaPri);
+ BOOST_CHECK(origPriEst[i-1] > pow(10,mult) * basepri - deltaPri);
}
// Mine 50 more blocks with no transactions happening, estimates shouldn't change
@@ -132,16 +141,19 @@ BOOST_AUTO_TEST_CASE(BlockPolicyEstimates)
for (int k = 0; k < 5; k++) { // add 4 fee txs for every priority tx
tx.vin[0].prevout.n = 10000*blocknum+100*j+k;
uint256 hash = tx.GetHash();
- mpool.addUnchecked(hash, CTxMemPoolEntry(tx, feeV[k/4][j], GetTime(), priV[k/4][j], blocknum, mpool.HasNoInputsOf(tx)));
+ mpool.addUnchecked(hash, entry.Fee(feeV[k/4][j]).Time(GetTime()).Priority(priV[k/4][j]).Height(blocknum).FromTx(tx, &mpool));
txHashes[j].push_back(hash);
}
}
mpool.removeForBlock(block, ++blocknum, dummyConflicted);
}
+ int answerFound;
for (int i = 1; i < 10;i++) {
- BOOST_CHECK(mpool.estimateFee(i).GetFeePerK() > origFeeEst[i-1] - deltaFee);
- BOOST_CHECK(mpool.estimatePriority(i) > origPriEst[i-1] - deltaPri);
+ BOOST_CHECK(mpool.estimateFee(i) == CFeeRate(0) || mpool.estimateFee(i).GetFeePerK() > origFeeEst[i-1] - deltaFee);
+ BOOST_CHECK(mpool.estimateSmartFee(i, &answerFound).GetFeePerK() > origFeeEst[answerFound-1] - deltaFee);
+ BOOST_CHECK(mpool.estimatePriority(i) == -1 || mpool.estimatePriority(i) > origPriEst[i-1] - deltaPri);
+ BOOST_CHECK(mpool.estimateSmartPriority(i, &answerFound) > origPriEst[answerFound-1] - deltaPri);
}
// Mine all those transactions
@@ -161,14 +173,14 @@ BOOST_AUTO_TEST_CASE(BlockPolicyEstimates)
BOOST_CHECK(mpool.estimatePriority(i) > origPriEst[i-1] - deltaPri);
}
- // Mine 100 more blocks where everything is mined every block
- // Estimates should be below original estimates (not possible for last estimate)
- while (blocknum < 365) {
+ // Mine 200 more blocks where everything is mined every block
+ // Estimates should be below original estimates
+ while (blocknum < 465) {
for (int j = 0; j < 10; j++) { // For each fee/pri multiple
for (int k = 0; k < 5; k++) { // add 4 fee txs for every priority tx
tx.vin[0].prevout.n = 10000*blocknum+100*j+k;
uint256 hash = tx.GetHash();
- mpool.addUnchecked(hash, CTxMemPoolEntry(tx, feeV[k/4][j], GetTime(), priV[k/4][j], blocknum, mpool.HasNoInputsOf(tx)));
+ mpool.addUnchecked(hash, entry.Fee(feeV[k/4][j]).Time(GetTime()).Priority(priV[k/4][j]).Height(blocknum).FromTx(tx, &mpool));
CTransaction btx;
if (mpool.lookup(hash, btx))
block.push_back(btx);
@@ -177,10 +189,22 @@ BOOST_AUTO_TEST_CASE(BlockPolicyEstimates)
mpool.removeForBlock(block, ++blocknum, dummyConflicted);
block.clear();
}
- for (int i = 1; i < 9; i++) {
+ for (int i = 1; i < 10; i++) {
BOOST_CHECK(mpool.estimateFee(i).GetFeePerK() < origFeeEst[i-1] - deltaFee);
BOOST_CHECK(mpool.estimatePriority(i) < origPriEst[i-1] - deltaPri);
}
+
+ // Test that if the mempool is limited, estimateSmartFee won't return a value below the mempool min fee
+ // and that estimateSmartPriority returns essentially an infinite value
+ mpool.addUnchecked(tx.GetHash(), entry.Fee(feeV[0][5]).Time(GetTime()).Priority(priV[1][5]).Height(blocknum).FromTx(tx, &mpool));
+ // evict that transaction which should set a mempool min fee of minRelayTxFee + feeV[0][5]
+ mpool.TrimToSize(1);
+ BOOST_CHECK(mpool.GetMinFee(1).GetFeePerK() > feeV[0][5]);
+ for (int i = 1; i < 10; i++) {
+ BOOST_CHECK(mpool.estimateSmartFee(i).GetFeePerK() >= mpool.estimateFee(i).GetFeePerK());
+ BOOST_CHECK(mpool.estimateSmartFee(i).GetFeePerK() >= mpool.GetMinFee(1).GetFeePerK());
+ BOOST_CHECK(mpool.estimateSmartPriority(i) == INF_PRIORITY);
+ }
}
BOOST_AUTO_TEST_SUITE_END()
diff --git a/src/test/rpc_tests.cpp b/src/test/rpc_tests.cpp
index 2a486f08e4..ce22975005 100644
--- a/src/test/rpc_tests.cpp
+++ b/src/test/rpc_tests.cpp
@@ -72,6 +72,7 @@ BOOST_AUTO_TEST_CASE(rpc_rawparams)
BOOST_CHECK_THROW(CallRPC("decoderawtransaction DEADBEEF"), runtime_error);
string rawtx = "0100000001a15d57094aa7a21a28cb20b59aab8fc7d1149a3bdbcddba9c622e4f5f6a99ece010000006c493046022100f93bb0e7d8db7bd46e40132d1f8242026e045f03a0efe71bbb8e3f475e970d790221009337cd7f1f929f00cc6ff01f03729b069a7c21b59b1736ddfee5db5946c5da8c0121033b9b137ee87d5a812d6f506efdd37f0affa7ffc310711c06c7f3e097c9447c52ffffffff0100e1f505000000001976a9140389035a9225b3839e2bbf32d826a1e222031fd888ac00000000";
BOOST_CHECK_NO_THROW(r = CallRPC(string("decoderawtransaction ")+rawtx));
+ BOOST_CHECK_EQUAL(find_value(r.get_obj(), "size").get_int(), 193);
BOOST_CHECK_EQUAL(find_value(r.get_obj(), "version").get_int(), 1);
BOOST_CHECK_EQUAL(find_value(r.get_obj(), "locktime").get_int(), 0);
BOOST_CHECK_THROW(r = CallRPC(string("decoderawtransaction ")+rawtx+" extra"), runtime_error);
diff --git a/src/test/scriptnum10.h b/src/test/scriptnum10.h
new file mode 100644
index 0000000000..00419746b7
--- /dev/null
+++ b/src/test/scriptnum10.h
@@ -0,0 +1,183 @@
+// Copyright (c) 2009-2010 Satoshi Nakamoto
+// Copyright (c) 2009-2013 The Bitcoin Core developers
+// Distributed under the MIT software license, see the accompanying
+// file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
+#ifndef BITCOIN_TEST_SCRIPTNUM10_H
+#define BITCOIN_TEST_SCRIPTNUM10_H
+
+#include <algorithm>
+#include <limits>
+#include <stdexcept>
+#include <stdint.h>
+#include <string>
+#include <vector>
+#include "assert.h"
+
+class scriptnum10_error : public std::runtime_error
+{
+public:
+ explicit scriptnum10_error(const std::string& str) : std::runtime_error(str) {}
+};
+
+class CScriptNum10
+{
+/**
+ * The ScriptNum implementation from Bitcoin Core 0.10.0, for cross-comparison.
+ */
+public:
+
+ explicit CScriptNum10(const int64_t& n)
+ {
+ m_value = n;
+ }
+
+ static const size_t nDefaultMaxNumSize = 4;
+
+ explicit CScriptNum10(const std::vector<unsigned char>& vch, bool fRequireMinimal,
+ const size_t nMaxNumSize = nDefaultMaxNumSize)
+ {
+ if (vch.size() > nMaxNumSize) {
+ throw scriptnum10_error("script number overflow");
+ }
+ if (fRequireMinimal && vch.size() > 0) {
+ // Check that the number is encoded with the minimum possible
+ // number of bytes.
+ //
+ // If the most-significant-byte - excluding the sign bit - is zero
+ // then we're not minimal. Note how this test also rejects the
+ // negative-zero encoding, 0x80.
+ if ((vch.back() & 0x7f) == 0) {
+ // One exception: if there's more than one byte and the most
+ // significant bit of the second-most-significant-byte is set
+ // it would conflict with the sign bit. An example of this case
+ // is +-255, which encode to 0xff00 and 0xff80 respectively.
+ // (big-endian).
+ if (vch.size() <= 1 || (vch[vch.size() - 2] & 0x80) == 0) {
+ throw scriptnum10_error("non-minimally encoded script number");
+ }
+ }
+ }
+ m_value = set_vch(vch);
+ }
+
+ inline bool operator==(const int64_t& rhs) const { return m_value == rhs; }
+ inline bool operator!=(const int64_t& rhs) const { return m_value != rhs; }
+ inline bool operator<=(const int64_t& rhs) const { return m_value <= rhs; }
+ inline bool operator< (const int64_t& rhs) const { return m_value < rhs; }
+ inline bool operator>=(const int64_t& rhs) const { return m_value >= rhs; }
+ inline bool operator> (const int64_t& rhs) const { return m_value > rhs; }
+
+ inline bool operator==(const CScriptNum10& rhs) const { return operator==(rhs.m_value); }
+ inline bool operator!=(const CScriptNum10& rhs) const { return operator!=(rhs.m_value); }
+ inline bool operator<=(const CScriptNum10& rhs) const { return operator<=(rhs.m_value); }
+ inline bool operator< (const CScriptNum10& rhs) const { return operator< (rhs.m_value); }
+ inline bool operator>=(const CScriptNum10& rhs) const { return operator>=(rhs.m_value); }
+ inline bool operator> (const CScriptNum10& rhs) const { return operator> (rhs.m_value); }
+
+ inline CScriptNum10 operator+( const int64_t& rhs) const { return CScriptNum10(m_value + rhs);}
+ inline CScriptNum10 operator-( const int64_t& rhs) const { return CScriptNum10(m_value - rhs);}
+ inline CScriptNum10 operator+( const CScriptNum10& rhs) const { return operator+(rhs.m_value); }
+ inline CScriptNum10 operator-( const CScriptNum10& rhs) const { return operator-(rhs.m_value); }
+
+ inline CScriptNum10& operator+=( const CScriptNum10& rhs) { return operator+=(rhs.m_value); }
+ inline CScriptNum10& operator-=( const CScriptNum10& rhs) { return operator-=(rhs.m_value); }
+
+ inline CScriptNum10 operator-() const
+ {
+ assert(m_value != std::numeric_limits<int64_t>::min());
+ return CScriptNum10(-m_value);
+ }
+
+ inline CScriptNum10& operator=( const int64_t& rhs)
+ {
+ m_value = rhs;
+ return *this;
+ }
+
+ inline CScriptNum10& operator+=( const int64_t& rhs)
+ {
+ assert(rhs == 0 || (rhs > 0 && m_value <= std::numeric_limits<int64_t>::max() - rhs) ||
+ (rhs < 0 && m_value >= std::numeric_limits<int64_t>::min() - rhs));
+ m_value += rhs;
+ return *this;
+ }
+
+ inline CScriptNum10& operator-=( const int64_t& rhs)
+ {
+ assert(rhs == 0 || (rhs > 0 && m_value >= std::numeric_limits<int64_t>::min() + rhs) ||
+ (rhs < 0 && m_value <= std::numeric_limits<int64_t>::max() + rhs));
+ m_value -= rhs;
+ return *this;
+ }
+
+ int getint() const
+ {
+ if (m_value > std::numeric_limits<int>::max())
+ return std::numeric_limits<int>::max();
+ else if (m_value < std::numeric_limits<int>::min())
+ return std::numeric_limits<int>::min();
+ return m_value;
+ }
+
+ std::vector<unsigned char> getvch() const
+ {
+ return serialize(m_value);
+ }
+
+ static std::vector<unsigned char> serialize(const int64_t& value)
+ {
+ if(value == 0)
+ return std::vector<unsigned char>();
+
+ std::vector<unsigned char> result;
+ const bool neg = value < 0;
+ uint64_t absvalue = neg ? -value : value;
+
+ while(absvalue)
+ {
+ result.push_back(absvalue & 0xff);
+ absvalue >>= 8;
+ }
+
+// - If the most significant byte is >= 0x80 and the value is positive, push a
+// new zero-byte to make the significant byte < 0x80 again.
+
+// - If the most significant byte is >= 0x80 and the value is negative, push a
+// new 0x80 byte that will be popped off when converting to an integral.
+
+// - If the most significant byte is < 0x80 and the value is negative, add
+// 0x80 to it, since it will be subtracted and interpreted as a negative when
+// converting to an integral.
+
+ if (result.back() & 0x80)
+ result.push_back(neg ? 0x80 : 0);
+ else if (neg)
+ result.back() |= 0x80;
+
+ return result;
+ }
+
+private:
+ static int64_t set_vch(const std::vector<unsigned char>& vch)
+ {
+ if (vch.empty())
+ return 0;
+
+ int64_t result = 0;
+ for (size_t i = 0; i != vch.size(); ++i)
+ result |= static_cast<int64_t>(vch[i]) << 8*i;
+
+ // If the input vector's most significant byte is 0x80, remove it from
+ // the result's msb and return a negative.
+ if (vch.back() & 0x80)
+ return -((int64_t)(result & ~(0x80ULL << (8 * (vch.size() - 1)))));
+
+ return result;
+ }
+
+ int64_t m_value;
+};
+
+
+#endif // BITCOIN_TEST_BIGNUM_H
diff --git a/src/test/scriptnum_tests.cpp b/src/test/scriptnum_tests.cpp
index d95724dbe1..2405ab3ffc 100644
--- a/src/test/scriptnum_tests.cpp
+++ b/src/test/scriptnum_tests.cpp
@@ -2,7 +2,7 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
-#include "bignum.h"
+#include "scriptnum10.h"
#include "script/script.h"
#include "test/test_bitcoin.h"
@@ -16,45 +16,48 @@ static const int64_t values[] = \
{ 0, 1, CHAR_MIN, CHAR_MAX, UCHAR_MAX, SHRT_MIN, USHRT_MAX, INT_MIN, INT_MAX, UINT_MAX, LONG_MIN, LONG_MAX };
static const int64_t offsets[] = { 1, 0x79, 0x80, 0x81, 0xFF, 0x7FFF, 0x8000, 0xFFFF, 0x10000};
-static bool verify(const CBigNum& bignum, const CScriptNum& scriptnum)
+static bool verify(const CScriptNum10& bignum, const CScriptNum& scriptnum)
{
return bignum.getvch() == scriptnum.getvch() && bignum.getint() == scriptnum.getint();
}
static void CheckCreateVch(const int64_t& num)
{
- CBigNum bignum(num);
+ CScriptNum10 bignum(num);
CScriptNum scriptnum(num);
BOOST_CHECK(verify(bignum, scriptnum));
- CBigNum bignum2(bignum.getvch());
+ std::vector<unsigned char> vch = bignum.getvch();
+
+ CScriptNum10 bignum2(bignum.getvch(), false);
+ vch = scriptnum.getvch();
CScriptNum scriptnum2(scriptnum.getvch(), false);
BOOST_CHECK(verify(bignum2, scriptnum2));
- CBigNum bignum3(scriptnum2.getvch());
+ CScriptNum10 bignum3(scriptnum2.getvch(), false);
CScriptNum scriptnum3(bignum2.getvch(), false);
BOOST_CHECK(verify(bignum3, scriptnum3));
}
static void CheckCreateInt(const int64_t& num)
{
- CBigNum bignum(num);
+ CScriptNum10 bignum(num);
CScriptNum scriptnum(num);
BOOST_CHECK(verify(bignum, scriptnum));
- BOOST_CHECK(verify(bignum.getint(), CScriptNum(scriptnum.getint())));
- BOOST_CHECK(verify(scriptnum.getint(), CScriptNum(bignum.getint())));
- BOOST_CHECK(verify(CBigNum(scriptnum.getint()).getint(), CScriptNum(CScriptNum(bignum.getint()).getint())));
+ BOOST_CHECK(verify(CScriptNum10(bignum.getint()), CScriptNum(scriptnum.getint())));
+ BOOST_CHECK(verify(CScriptNum10(scriptnum.getint()), CScriptNum(bignum.getint())));
+ BOOST_CHECK(verify(CScriptNum10(CScriptNum10(scriptnum.getint()).getint()), CScriptNum(CScriptNum(bignum.getint()).getint())));
}
static void CheckAdd(const int64_t& num1, const int64_t& num2)
{
- const CBigNum bignum1(num1);
- const CBigNum bignum2(num2);
+ const CScriptNum10 bignum1(num1);
+ const CScriptNum10 bignum2(num2);
const CScriptNum scriptnum1(num1);
const CScriptNum scriptnum2(num2);
- CBigNum bignum3(num1);
- CBigNum bignum4(num1);
+ CScriptNum10 bignum3(num1);
+ CScriptNum10 bignum4(num1);
CScriptNum scriptnum3(num1);
CScriptNum scriptnum4(num1);
@@ -71,7 +74,7 @@ static void CheckAdd(const int64_t& num1, const int64_t& num2)
static void CheckNegate(const int64_t& num)
{
- const CBigNum bignum(num);
+ const CScriptNum10 bignum(num);
const CScriptNum scriptnum(num);
// -INT64_MIN is undefined
@@ -81,8 +84,8 @@ static void CheckNegate(const int64_t& num)
static void CheckSubtract(const int64_t& num1, const int64_t& num2)
{
- const CBigNum bignum1(num1);
- const CBigNum bignum2(num2);
+ const CScriptNum10 bignum1(num1);
+ const CScriptNum10 bignum2(num2);
const CScriptNum scriptnum1(num1);
const CScriptNum scriptnum2(num2);
bool invalid = false;
@@ -107,8 +110,8 @@ static void CheckSubtract(const int64_t& num1, const int64_t& num2)
static void CheckCompare(const int64_t& num1, const int64_t& num2)
{
- const CBigNum bignum1(num1);
- const CBigNum bignum2(num2);
+ const CScriptNum10 bignum1(num1);
+ const CScriptNum10 bignum2(num2);
const CScriptNum scriptnum1(num1);
const CScriptNum scriptnum2(num2);
@@ -149,7 +152,7 @@ static void RunCreate(const int64_t& num)
CheckCreateVch(num);
else
{
- BOOST_CHECK_THROW (CheckCreateVch(num), scriptnum_error);
+ BOOST_CHECK_THROW (CheckCreateVch(num), scriptnum10_error);
}
}
diff --git a/src/test/test_bitcoin.cpp b/src/test/test_bitcoin.cpp
index 23e5e66d84..351870014d 100644
--- a/src/test/test_bitcoin.cpp
+++ b/src/test/test_bitcoin.cpp
@@ -15,6 +15,7 @@
#include "pubkey.h"
#include "random.h"
#include "txdb.h"
+#include "txmempool.h"
#include "ui_interface.h"
#include "util.h"
#ifdef ENABLE_WALLET
@@ -50,6 +51,7 @@ BasicTestingSetup::~BasicTestingSetup()
TestingSetup::TestingSetup(const std::string& chainName) : BasicTestingSetup(chainName)
{
+ const CChainParams& chainparams = Params();
#ifdef ENABLE_WALLET
bitdb.MakeMock();
#endif
@@ -60,7 +62,7 @@ TestingSetup::TestingSetup(const std::string& chainName) : BasicTestingSetup(cha
pblocktree = new CBlockTreeDB(1 << 20, true);
pcoinsdbview = new CCoinsViewDB(1 << 23, true);
pcoinsTip = new CCoinsViewCache(pcoinsdbview);
- InitBlockIndex();
+ InitBlockIndex(chainparams);
#ifdef ENABLE_WALLET
bool fFirstRun;
pwalletMain = new CWallet("wallet.dat");
@@ -114,7 +116,8 @@ TestChain100Setup::TestChain100Setup() : TestingSetup(CBaseChainParams::REGTEST)
CBlock
TestChain100Setup::CreateAndProcessBlock(const std::vector<CMutableTransaction>& txns, const CScript& scriptPubKey)
{
- CBlockTemplate *pblocktemplate = CreateNewBlock(scriptPubKey);
+ const CChainParams& chainparams = Params();
+ CBlockTemplate *pblocktemplate = CreateNewBlock(chainparams, scriptPubKey);
CBlock& block = pblocktemplate->block;
// Replace mempool-selected txns with just coinbase plus passed-in txns:
@@ -125,10 +128,10 @@ TestChain100Setup::CreateAndProcessBlock(const std::vector<CMutableTransaction>&
unsigned int extraNonce = 0;
IncrementExtraNonce(&block, chainActive.Tip(), extraNonce);
- while (!CheckProofOfWork(block.GetHash(), block.nBits, Params(CBaseChainParams::REGTEST).GetConsensus())) ++block.nNonce;
+ while (!CheckProofOfWork(block.GetHash(), block.nBits, chainparams.GetConsensus())) ++block.nNonce;
CValidationState state;
- ProcessNewBlock(state, NULL, &block, true, NULL);
+ ProcessNewBlock(state, chainparams, NULL, &block, true, NULL);
CBlock result = block;
delete pblocktemplate;
@@ -139,6 +142,17 @@ TestChain100Setup::~TestChain100Setup()
{
}
+
+CTxMemPoolEntry TestMemPoolEntryHelper::FromTx(CMutableTransaction &tx, CTxMemPool *pool) {
+ CTransaction txn(tx);
+ bool hasNoDependencies = pool ? pool->HasNoInputsOf(tx) : hadNoDependencies;
+ // Hack to assume either its completely dependent on other mempool txs or not at all
+ CAmount inChainValue = hasNoDependencies ? txn.GetValueOut() : 0;
+
+ return CTxMemPoolEntry(txn, nFee, nTime, dPriority, nHeight,
+ hasNoDependencies, inChainValue);
+}
+
void Shutdown(void* parg)
{
exit(0);
diff --git a/src/test/test_bitcoin.h b/src/test/test_bitcoin.h
index 0bab4b6831..815b227411 100644
--- a/src/test/test_bitcoin.h
+++ b/src/test/test_bitcoin.h
@@ -3,6 +3,7 @@
#include "chainparamsbase.h"
#include "key.h"
+#include "pubkey.h"
#include "txdb.h"
#include <boost/filesystem.hpp>
@@ -12,6 +13,8 @@
* This just configures logging and chain parameters.
*/
struct BasicTestingSetup {
+ ECCVerifyHandle globalVerifyHandle;
+
BasicTestingSetup(const std::string& chainName = CBaseChainParams::MAIN);
~BasicTestingSetup();
};
@@ -51,4 +54,29 @@ struct TestChain100Setup : public TestingSetup {
CKey coinbaseKey; // private/public key needed to spend coinbase transactions
};
+class CTxMemPoolEntry;
+class CTxMemPool;
+
+struct TestMemPoolEntryHelper
+{
+ // Default values
+ CAmount nFee;
+ int64_t nTime;
+ double dPriority;
+ unsigned int nHeight;
+ bool hadNoDependencies;
+
+ TestMemPoolEntryHelper() :
+ nFee(0), nTime(0), dPriority(0.0), nHeight(1),
+ hadNoDependencies(false) { }
+
+ CTxMemPoolEntry FromTx(CMutableTransaction &tx, CTxMemPool *pool = NULL);
+
+ // Change the default value
+ TestMemPoolEntryHelper &Fee(CAmount _fee) { nFee = _fee; return *this; }
+ TestMemPoolEntryHelper &Time(int64_t _time) { nTime = _time; return *this; }
+ TestMemPoolEntryHelper &Priority(double _priority) { dPriority = _priority; return *this; }
+ TestMemPoolEntryHelper &Height(unsigned int _height) { nHeight = _height; return *this; }
+ TestMemPoolEntryHelper &HadNoDependencies(bool _hnd) { hadNoDependencies = _hnd; return *this; }
+};
#endif
diff --git a/src/timedata.cpp b/src/timedata.cpp
index 0641009537..861c375989 100644
--- a/src/timedata.cpp
+++ b/src/timedata.cpp
@@ -55,7 +55,7 @@ void AddTimeData(const CNetAddr& ip, int64_t nOffsetSample)
// Add data
static CMedianFilter<int64_t> vTimeOffsets(BITCOIN_TIMEDATA_MAX_SAMPLES, 0);
vTimeOffsets.input(nOffsetSample);
- LogPrintf("Added time data, samples %d, offset %+d (%+d minutes)\n", vTimeOffsets.size(), nOffsetSample, nOffsetSample/60);
+ LogPrint("net","added time data, samples %d, offset %+d (%+d minutes)\n", vTimeOffsets.size(), nOffsetSample, nOffsetSample/60);
// There is a known issue here (see issue #4521):
//
@@ -105,11 +105,11 @@ void AddTimeData(const CNetAddr& ip, int64_t nOffsetSample)
}
}
}
- if (fDebug) {
- BOOST_FOREACH(int64_t n, vSorted)
- LogPrintf("%+d ", n);
- LogPrintf("| ");
- }
- LogPrintf("nTimeOffset = %+d (%+d minutes)\n", nTimeOffset, nTimeOffset/60);
+
+ BOOST_FOREACH(int64_t n, vSorted)
+ LogPrint("net", "%+d ", n);
+ LogPrint("net", "| ");
+
+ LogPrint("net", "nTimeOffset = %+d (%+d minutes)\n", nTimeOffset, nTimeOffset/60);
}
}
diff --git a/src/torcontrol.cpp b/src/torcontrol.cpp
index 08644f2968..8eccc81e30 100644
--- a/src/torcontrol.cpp
+++ b/src/torcontrol.cpp
@@ -449,6 +449,15 @@ void TorController::auth_cb(TorControlConnection& conn, const TorControlReply& r
{
if (reply.code == 250) {
LogPrint("tor", "tor: Authentication succesful\n");
+
+ // Now that we know Tor is running setup the proxy for onion addresses
+ // if -onion isn't set to something else.
+ if (GetArg("-onion", "") == "") {
+ proxyType addrOnion = proxyType(CService("127.0.0.1", 9050), true);
+ SetProxy(NET_TOR, addrOnion);
+ SetReachable(NET_TOR);
+ }
+
// Finally - now create the service
if (private_key.empty()) // No private key, generate one
private_key = "NEW:BEST";
@@ -608,7 +617,9 @@ void TorController::disconnected_cb(TorControlConnection& conn)
service = CService();
if (!reconnect)
return;
- LogPrintf("tor: Disconnected from Tor control port %s, trying to reconnect\n", target);
+
+ LogPrint("tor", "tor: Disconnected from Tor control port %s, trying to reconnect\n", target);
+
// Single-shot timer for reconnect. Use exponential backoff.
struct timeval time = MillisToTimeval(int64_t(reconnect_timeout * 1000.0));
reconnect_ev = event_new(base, -1, 0, reconnect_cb, this);
diff --git a/src/txmempool.cpp b/src/txmempool.cpp
index a772e7adea..6d1df0b3d1 100644
--- a/src/txmempool.cpp
+++ b/src/txmempool.cpp
@@ -19,10 +19,10 @@
using namespace std;
CTxMemPoolEntry::CTxMemPoolEntry(const CTransaction& _tx, const CAmount& _nFee,
- int64_t _nTime, double _dPriority,
- unsigned int _nHeight, bool poolHasNoInputsOf):
- tx(_tx), nFee(_nFee), nTime(_nTime), dPriority(_dPriority), nHeight(_nHeight),
- hadNoDependencies(poolHasNoInputsOf)
+ int64_t _nTime, double _entryPriority, unsigned int _entryHeight,
+ bool poolHasNoInputsOf, CAmount _inChainInputValue):
+ tx(_tx), nFee(_nFee), nTime(_nTime), entryPriority(_entryPriority), entryHeight(_entryHeight),
+ hadNoDependencies(poolHasNoInputsOf), inChainInputValue(_inChainInputValue)
{
nTxSize = ::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION);
nModSize = tx.CalculateModifiedSize(nTxSize);
@@ -31,6 +31,8 @@ CTxMemPoolEntry::CTxMemPoolEntry(const CTransaction& _tx, const CAmount& _nFee,
nCountWithDescendants = 1;
nSizeWithDescendants = nTxSize;
nFeesWithDescendants = nFee;
+ CAmount nValueIn = tx.GetValueOut()+nFee;
+ assert(inChainInputValue <= nValueIn);
}
CTxMemPoolEntry::CTxMemPoolEntry(const CTxMemPoolEntry& other)
@@ -41,9 +43,10 @@ CTxMemPoolEntry::CTxMemPoolEntry(const CTxMemPoolEntry& other)
double
CTxMemPoolEntry::GetPriority(unsigned int currentHeight) const
{
- CAmount nValueIn = tx.GetValueOut()+nFee;
- double deltaPriority = ((double)(currentHeight-nHeight)*nValueIn)/nModSize;
- double dResult = dPriority + deltaPriority;
+ double deltaPriority = ((double)(currentHeight-entryHeight)*inChainInputValue)/nModSize;
+ double dResult = entryPriority + deltaPriority;
+ if (dResult < 0) // This should only happen if it was called with a height below entry height
+ dResult = 0;
return dResult;
}
@@ -701,11 +704,21 @@ CFeeRate CTxMemPool::estimateFee(int nBlocks) const
LOCK(cs);
return minerPolicyEstimator->estimateFee(nBlocks);
}
+CFeeRate CTxMemPool::estimateSmartFee(int nBlocks, int *answerFoundAtBlocks) const
+{
+ LOCK(cs);
+ return minerPolicyEstimator->estimateSmartFee(nBlocks, answerFoundAtBlocks, *this);
+}
double CTxMemPool::estimatePriority(int nBlocks) const
{
LOCK(cs);
return minerPolicyEstimator->estimatePriority(nBlocks);
}
+double CTxMemPool::estimateSmartPriority(int nBlocks, int *answerFoundAtBlocks) const
+{
+ LOCK(cs);
+ return minerPolicyEstimator->estimateSmartPriority(nBlocks, answerFoundAtBlocks, *this);
+}
bool
CTxMemPool::WriteFeeEstimates(CAutoFile& fileout) const
diff --git a/src/txmempool.h b/src/txmempool.h
index 7b5843a8d0..c470bbe28f 100644
--- a/src/txmempool.h
+++ b/src/txmempool.h
@@ -63,9 +63,10 @@ private:
size_t nModSize; //! ... and modified size for priority
size_t nUsageSize; //! ... and total memory usage
int64_t nTime; //! Local time when entering the mempool
- double dPriority; //! Priority when entering the mempool
- unsigned int nHeight; //! Chain height when entering the mempool
+ double entryPriority; //! Priority when entering the mempool
+ unsigned int entryHeight; //! Chain height when entering the mempool
bool hadNoDependencies; //! Not dependent on any other txs when it entered the mempool
+ CAmount inChainInputValue; //! Sum of all txin values that are already in blockchain
// Information about descendants of this transaction that are in the
// mempool; if we remove this transaction we must remove all of these
@@ -78,15 +79,20 @@ private:
public:
CTxMemPoolEntry(const CTransaction& _tx, const CAmount& _nFee,
- int64_t _nTime, double _dPriority, unsigned int _nHeight, bool poolHasNoInputsOf = false);
+ int64_t _nTime, double _entryPriority, unsigned int _entryHeight,
+ bool poolHasNoInputsOf, CAmount _inChainInputValue);
CTxMemPoolEntry(const CTxMemPoolEntry& other);
const CTransaction& GetTx() const { return this->tx; }
+ /**
+ * Fast calculation of lower bound of current priority as update
+ * from entry priority. Only inputs that were originally in-chain will age.
+ */
double GetPriority(unsigned int currentHeight) const;
const CAmount& GetFee() const { return nFee; }
size_t GetTxSize() const { return nTxSize; }
int64_t GetTime() const { return nTime; }
- unsigned int GetHeight() const { return nHeight; }
+ unsigned int GetHeight() const { return entryHeight; }
bool WasClearAtEntry() const { return hadNoDependencies; }
size_t DynamicMemoryUsage() const { return nUsageSize; }
@@ -420,6 +426,11 @@ public:
*/
bool CalculateMemPoolAncestors(const CTxMemPoolEntry &entry, setEntries &setAncestors, uint64_t limitAncestorCount, uint64_t limitAncestorSize, uint64_t limitDescendantCount, uint64_t limitDescendantSize, std::string &errString, bool fSearchForParents = true);
+ /** Populate setDescendants with all in-mempool descendants of hash.
+ * Assumes that setDescendants includes all in-mempool descendants of anything
+ * already in it. */
+ void CalculateDescendants(txiter it, setEntries &setDescendants);
+
/** The minimum fee to get into the mempool, which may itself not be enough
* for larger-sized transactions.
* The minReasonableRelayFee constructor arg is used to bound the time it
@@ -454,9 +465,21 @@ public:
bool lookup(uint256 hash, CTransaction& result) const;
+ /** Estimate fee rate needed to get into the next nBlocks
+ * If no answer can be given at nBlocks, return an estimate
+ * at the lowest number of blocks where one can be given
+ */
+ CFeeRate estimateSmartFee(int nBlocks, int *answerFoundAtBlocks = NULL) const;
+
/** Estimate fee rate needed to get into the next nBlocks */
CFeeRate estimateFee(int nBlocks) const;
+ /** Estimate priority needed to get into the next nBlocks
+ * If no answer can be given at nBlocks, return an estimate
+ * at the lowest number of blocks where one can be given
+ */
+ double estimateSmartPriority(int nBlocks, int *answerFoundAtBlocks = NULL) const;
+
/** Estimate priority needed to get into the next nBlocks */
double estimatePriority(int nBlocks) const;
@@ -493,10 +516,6 @@ private:
void UpdateForRemoveFromMempool(const setEntries &entriesToRemove);
/** Sever link between specified transaction and direct children. */
void UpdateChildrenForRemoval(txiter entry);
- /** Populate setDescendants with all in-mempool descendants of hash.
- * Assumes that setDescendants includes all in-mempool descendants of anything
- * already in it. */
- void CalculateDescendants(txiter it, setEntries &setDescendants);
/** Before calling removeUnchecked for a given transaction,
* UpdateForRemoveFromMempool must be called on the entire (dependent) set
diff --git a/src/ui_interface.h b/src/ui_interface.h
index e402479933..00d9303124 100644
--- a/src/ui_interface.h
+++ b/src/ui_interface.h
@@ -15,6 +15,7 @@
class CBasicKeyStore;
class CWallet;
class uint256;
+class CBlockIndex;
/** General change type (added, updated, removed). */
enum ChangeType
@@ -94,7 +95,7 @@ public:
boost::signals2::signal<void (const std::string &title, int nProgress)> ShowProgress;
/** New block has been accepted */
- boost::signals2::signal<void (const uint256& hash)> NotifyBlockTip;
+ boost::signals2::signal<void (bool, const CBlockIndex *)> NotifyBlockTip;
/** Banlist did change. */
boost::signals2::signal<void (void)> BannedListChanged;
diff --git a/src/uint256.h b/src/uint256.h
index 6d016ab164..6e37cd5d46 100644
--- a/src/uint256.h
+++ b/src/uint256.h
@@ -12,6 +12,7 @@
#include <stdint.h>
#include <string>
#include <vector>
+#include "crypto/common.h"
/** Template base class for fixed-sized opaque blobs. */
template<unsigned int BITS>
@@ -119,13 +120,10 @@ public:
* used when the contents are considered uniformly random. It is not appropriate
* when the value can easily be influenced from outside as e.g. a network adversary could
* provide values to trigger worst-case behavior.
- * @note The result of this function is not stable between little and big endian.
*/
uint64_t GetCheapHash() const
{
- uint64_t result;
- memcpy((void*)&result, (void*)data, 8);
- return result;
+ return ReadLE64(data);
}
/** A more secure, salted hash function.
diff --git a/src/util.cpp b/src/util.cpp
index e8514a2ef0..1913181712 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -99,6 +99,9 @@ namespace boost {
using namespace std;
+const char * const BITCOIN_CONF_FILENAME = "bitcoin.conf";
+const char * const BITCOIN_PID_FILENAME = "bitcoind.pid";
+
map<string, string> mapArgs;
map<string, vector<string> > mapMultiArgs;
bool fDebug = false;
@@ -107,9 +110,9 @@ bool fPrintToDebugLog = true;
bool fDaemon = false;
bool fServer = false;
string strMiscWarning;
-bool fLogTimestamps = false;
+bool fLogTimestamps = DEFAULT_LOGTIMESTAMPS;
bool fLogTimeMicros = DEFAULT_LOGTIMEMICROS;
-bool fLogIPs = false;
+bool fLogIPs = DEFAULT_LOGIPS;
volatile bool fReopenDebugLog = false;
CTranslationInterface translationInterface;
@@ -447,7 +450,6 @@ void PrintExceptionContinue(const std::exception* pex, const char* pszThread)
std::string message = FormatException(pex, pszThread);
LogPrintf("\n\n************************\n%s\n", message);
fprintf(stderr, "\n\n************************\n%s\n", message.c_str());
- strMiscWarning = message;
}
boost::filesystem::path GetDefaultDataDir()
@@ -521,7 +523,7 @@ void ClearDatadirCache()
boost::filesystem::path GetConfigFile()
{
- boost::filesystem::path pathConfigFile(GetArg("-conf", "bitcoin.conf"));
+ boost::filesystem::path pathConfigFile(GetArg("-conf", BITCOIN_CONF_FILENAME));
if (!pathConfigFile.is_complete())
pathConfigFile = GetDataDir(false) / pathConfigFile;
@@ -555,7 +557,7 @@ void ReadConfigFile(map<string, string>& mapSettingsRet,
#ifndef WIN32
boost::filesystem::path GetPidFile()
{
- boost::filesystem::path pathPidFile(GetArg("-pid", "bitcoind.pid"));
+ boost::filesystem::path pathPidFile(GetArg("-pid", BITCOIN_PID_FILENAME));
if (!pathPidFile.is_complete()) pathPidFile = GetDataDir() / pathPidFile;
return pathPidFile;
}
diff --git a/src/util.h b/src/util.h
index b2779fe782..fb154f6660 100644
--- a/src/util.h
+++ b/src/util.h
@@ -29,6 +29,8 @@
#include <boost/thread/exceptions.hpp>
static const bool DEFAULT_LOGTIMEMICROS = false;
+static const bool DEFAULT_LOGIPS = false;
+static const bool DEFAULT_LOGTIMESTAMPS = true;
/** Signals for translation. */
class CTranslationInterface
@@ -51,6 +53,9 @@ extern bool fLogIPs;
extern volatile bool fReopenDebugLog;
extern CTranslationInterface translationInterface;
+extern const char * const BITCOIN_CONF_FILENAME;
+extern const char * const BITCOIN_PID_FILENAME;
+
/**
* Translation function: Call Translate signal on UI interface, which returns a boost::optional result.
* If no translation slot is registered, nothing is returned, and simply return the input.
diff --git a/src/utiltime.cpp b/src/utiltime.cpp
index 3202c47f1d..7d9f6210eb 100644
--- a/src/utiltime.cpp
+++ b/src/utiltime.cpp
@@ -20,7 +20,9 @@ int64_t GetTime()
{
if (nMockTime) return nMockTime;
- return time(NULL);
+ time_t now = time(NULL);
+ assert(now > 0);
+ return now;
}
void SetMockTime(int64_t nMockTimeIn)
@@ -30,14 +32,18 @@ void SetMockTime(int64_t nMockTimeIn)
int64_t GetTimeMillis()
{
- return (boost::posix_time::microsec_clock::universal_time() -
- boost::posix_time::ptime(boost::gregorian::date(1970,1,1))).total_milliseconds();
+ int64_t now = (boost::posix_time::microsec_clock::universal_time() -
+ boost::posix_time::ptime(boost::gregorian::date(1970,1,1))).total_milliseconds();
+ assert(now > 0);
+ return now;
}
int64_t GetTimeMicros()
{
- return (boost::posix_time::microsec_clock::universal_time() -
- boost::posix_time::ptime(boost::gregorian::date(1970,1,1))).total_microseconds();
+ int64_t now = (boost::posix_time::microsec_clock::universal_time() -
+ boost::posix_time::ptime(boost::gregorian::date(1970,1,1))).total_microseconds();
+ assert(now > 0);
+ return now;
}
/** Return a time useful for the debug log */
diff --git a/src/version.h b/src/version.h
index 6cdddf9255..f7cf18d0b6 100644
--- a/src/version.h
+++ b/src/version.h
@@ -9,7 +9,7 @@
* network protocol versioning
*/
-static const int PROTOCOL_VERSION = 70011;
+static const int PROTOCOL_VERSION = 70012;
//! initial proto version, to be increased after version/verack negotiation
static const int INIT_PROTO_VERSION = 209;
@@ -37,4 +37,7 @@ static const int MEMPOOL_GD_VERSION = 60002;
//! "filter*" commands are disabled without NODE_BLOOM after and including this version
static const int NO_BLOOM_VERSION = 70011;
+//! "sendheaders" command and announcing blocks with headers starts with this version
+static const int SENDHEADERS_VERSION = 70012;
+
#endif // BITCOIN_VERSION_H
diff --git a/src/wallet/db.cpp b/src/wallet/db.cpp
index cf6122813c..4b9dbebddd 100644
--- a/src/wallet/db.cpp
+++ b/src/wallet/db.cpp
@@ -85,7 +85,7 @@ bool CDBEnv::Open(const boost::filesystem::path& pathIn)
LogPrintf("CDBEnv::Open: LogDir=%s ErrorFile=%s\n", pathLogDir.string(), pathErrorFile.string());
unsigned int nEnvFlags = 0;
- if (GetBoolArg("-privdb", true))
+ if (GetBoolArg("-privdb", DEFAULT_WALLET_PRIVDB))
nEnvFlags |= DB_PRIVATE;
dbenv->set_lg_dir(pathLogDir.string().c_str());
diff --git a/src/wallet/db.h b/src/wallet/db.h
index 46bc0ac0a9..7f58d03f08 100644
--- a/src/wallet/db.h
+++ b/src/wallet/db.h
@@ -21,6 +21,7 @@
#include <db_cxx.h>
static const unsigned int DEFAULT_WALLET_DBLOGSIZE = 100;
+static const bool DEFAULT_WALLET_PRIVDB = true;
extern unsigned int nWalletDBUpdated;
diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp
index d93050d98c..a4ab2248a5 100644
--- a/src/wallet/rpcwallet.cpp
+++ b/src/wallet/rpcwallet.cpp
@@ -65,6 +65,8 @@ void WalletTxToJSON(const CWalletTx& wtx, UniValue& entry)
entry.push_back(Pair("blockhash", wtx.hashBlock.GetHex()));
entry.push_back(Pair("blockindex", wtx.nIndex));
entry.push_back(Pair("blocktime", mapBlockIndex[wtx.hashBlock]->GetBlockTime()));
+ } else {
+ entry.push_back(Pair("trusted", wtx.IsTrusted()));
}
uint256 hash = wtx.GetHash();
entry.push_back(Pair("txid", hash.GetHex()));
@@ -835,7 +837,7 @@ UniValue movecmd(const UniValue& params, bool fHelp)
debit.nTime = nNow;
debit.strOtherAccount = strTo;
debit.strComment = strComment;
- walletdb.WriteAccountingEntry(debit);
+ pwalletMain->AddAccountingEntry(debit, walletdb);
// Credit
CAccountingEntry credit;
@@ -845,7 +847,7 @@ UniValue movecmd(const UniValue& params, bool fHelp)
credit.nTime = nNow;
credit.strOtherAccount = strFrom;
credit.strComment = strComment;
- walletdb.WriteAccountingEntry(credit);
+ pwalletMain->AddAccountingEntry(credit, walletdb);
if (!walletdb.TxnCommit())
throw JSONRPCError(RPC_DATABASE_ERROR, "database error");
@@ -1417,21 +1419,24 @@ UniValue listtransactions(const UniValue& params, bool fHelp)
" \"amount\": x.xxx, (numeric) The amount in " + CURRENCY_UNIT + ". This is negative for the 'send' category, and for the\n"
" 'move' category for moves outbound. It is positive for the 'receive' category,\n"
" and for the 'move' category for inbound funds.\n"
- " \"vout\" : n, (numeric) the vout value\n"
+ " \"vout\": n, (numeric) the vout value\n"
" \"fee\": x.xxx, (numeric) The amount of the fee in " + CURRENCY_UNIT + ". This is negative and only available for the \n"
" 'send' category of transactions.\n"
" \"confirmations\": n, (numeric) The number of confirmations for the transaction. Available for 'send' and \n"
- " 'receive' category of transactions.\n"
+ " 'receive' category of transactions. Negative confirmations indicate the\n"
+ " transation conflicts with the block chain\n"
+ " \"trusted\": xxx (bool) Whether we consider the outputs of this unconfirmed transaction safe to spend.\n"
" \"blockhash\": \"hashvalue\", (string) The block hash containing the transaction. Available for 'send' and 'receive'\n"
" category of transactions.\n"
" \"blockindex\": n, (numeric) The block index containing the transaction. Available for 'send' and 'receive'\n"
" category of transactions.\n"
+ " \"blocktime\": xxx, (numeric) The block time in seconds since epoch (1 Jan 1970 GMT).\n"
" \"txid\": \"transactionid\", (string) The transaction id. Available for 'send' and 'receive' category of transactions.\n"
" \"time\": xxx, (numeric) The transaction time in seconds since epoch (midnight Jan 1 1970 GMT).\n"
" \"timereceived\": xxx, (numeric) The time received in seconds since epoch (midnight Jan 1 1970 GMT). Available \n"
" for 'send' and 'receive' category of transactions.\n"
" \"comment\": \"...\", (string) If a comment is associated with the transaction.\n"
- " \"label\" : \"label\" (string) A comment for the address/transaction, if any\n"
+ " \"label\": \"label\" (string) A comment for the address/transaction, if any\n"
" \"otheraccount\": \"accountname\", (string) For the 'move' category of transactions, the account the funds came \n"
" from (for receiving funds, positive amounts), or went to (for sending funds,\n"
" negative amounts).\n"
@@ -1470,11 +1475,10 @@ UniValue listtransactions(const UniValue& params, bool fHelp)
UniValue ret(UniValue::VARR);
- std::list<CAccountingEntry> acentries;
- CWallet::TxItems txOrdered = pwalletMain->OrderedTxItems(acentries, strAccount);
+ const CWallet::TxItems & txOrdered = pwalletMain->wtxOrdered;
// iterate backwards until we have nCount items to return:
- for (CWallet::TxItems::reverse_iterator it = txOrdered.rbegin(); it != txOrdered.rend(); ++it)
+ for (CWallet::TxItems::const_reverse_iterator it = txOrdered.rbegin(); it != txOrdered.rend(); ++it)
{
CWalletTx *const pwtx = (*it).second.first;
if (pwtx != 0)
@@ -1579,8 +1583,7 @@ UniValue listaccounts(const UniValue& params, bool fHelp)
}
}
- list<CAccountingEntry> acentries;
- CWalletDB(pwalletMain->strWalletFile).ListAccountCreditDebit("*", acentries);
+ const list<CAccountingEntry> & acentries = pwalletMain->laccentries;
BOOST_FOREACH(const CAccountingEntry& entry, acentries)
mapAccountBalances[entry.strAccount] += entry.nCreditDebit;
@@ -2396,7 +2399,7 @@ UniValue fundrawtransaction(const UniValue& params, bool fHelp)
"\nResult:\n"
"{\n"
" \"hex\": \"value\", (string) The resulting raw transaction (hex-encoded string)\n"
- " \"fee\": n, (numeric) The fee added to the transaction\n"
+ " \"fee\": n, (numeric) Fee the resulting transaction pays\n"
" \"changepos\": n (numeric) The position of the added change output, or -1\n"
"}\n"
"\"hex\" \n"
@@ -2418,9 +2421,12 @@ UniValue fundrawtransaction(const UniValue& params, bool fHelp)
if (!DecodeHexTx(origTx, params[0].get_str()))
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX decode failed");
+ if (origTx.vout.size() == 0)
+ throw JSONRPCError(RPC_INVALID_PARAMETER, "TX must have at least one output");
+
bool includeWatching = false;
if (params.size() > 1)
- includeWatching = true;
+ includeWatching = params[1].get_bool();
CMutableTransaction tx(origTx);
CAmount nFee;
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp
index d51b8ddaef..30b9869be0 100644
--- a/src/wallet/wallet.cpp
+++ b/src/wallet/wallet.cpp
@@ -39,9 +39,8 @@ using namespace std;
CFeeRate payTxFee(DEFAULT_TRANSACTION_FEE);
CAmount maxTxFee = DEFAULT_TRANSACTION_MAXFEE;
unsigned int nTxConfirmTarget = DEFAULT_TX_CONFIRM_TARGET;
-bool bSpendZeroConfChange = true;
-bool fSendFreeTransactions = false;
-bool fPayAtLeastCustomFee = true;
+bool bSpendZeroConfChange = DEFAULT_SPEND_ZEROCONF_CHANGE;
+bool fSendFreeTransactions = DEFAULT_SEND_FREE_TRANSACTIONS;
/**
* Fees smaller than this (in satoshi) are considered zero fee (for transaction creation)
@@ -588,31 +587,6 @@ int64_t CWallet::IncOrderPosNext(CWalletDB *pwalletdb)
return nRet;
}
-CWallet::TxItems CWallet::OrderedTxItems(std::list<CAccountingEntry>& acentries, std::string strAccount)
-{
- AssertLockHeld(cs_wallet); // mapWallet
- CWalletDB walletdb(strWalletFile);
-
- // First: get all CWalletTx and CAccountingEntry into a sorted-by-order multimap.
- TxItems txOrdered;
-
- // Note: maintaining indices in the database of (account,time) --> txid and (account, time) --> acentry
- // would make this much faster for applications that do this a lot.
- for (map<uint256, CWalletTx>::iterator it = mapWallet.begin(); it != mapWallet.end(); ++it)
- {
- CWalletTx* wtx = &((*it).second);
- txOrdered.insert(make_pair(wtx->nOrderPos, TxPair(wtx, (CAccountingEntry*)0)));
- }
- acentries.clear();
- walletdb.ListAccountCreditDebit(strAccount, acentries);
- BOOST_FOREACH(CAccountingEntry& entry, acentries)
- {
- txOrdered.insert(make_pair(entry.nOrderPos, TxPair((CWalletTx*)0, &entry)));
- }
-
- return txOrdered;
-}
-
void CWallet::MarkDirty()
{
{
@@ -629,8 +603,18 @@ bool CWallet::AddToWallet(const CWalletTx& wtxIn, bool fFromLoadWallet, CWalletD
if (fFromLoadWallet)
{
mapWallet[hash] = wtxIn;
- mapWallet[hash].BindWallet(this);
+ CWalletTx& wtx = mapWallet[hash];
+ wtx.BindWallet(this);
+ wtxOrdered.insert(make_pair(wtx.nOrderPos, TxPair(&wtx, (CAccountingEntry*)0)));
AddToSpends(hash);
+ BOOST_FOREACH(const CTxIn& txin, wtx.vin) {
+ if (mapWallet.count(txin.prevout.hash)) {
+ CWalletTx& prevtx = mapWallet[txin.prevout.hash];
+ if (prevtx.nIndex == -1 && !prevtx.hashBlock.IsNull()) {
+ MarkConflicted(prevtx.hashBlock, wtx.GetHash());
+ }
+ }
+ }
}
else
{
@@ -644,6 +628,7 @@ bool CWallet::AddToWallet(const CWalletTx& wtxIn, bool fFromLoadWallet, CWalletD
{
wtx.nTimeReceived = GetAdjustedTime();
wtx.nOrderPos = IncOrderPosNext(pwalletdb);
+ wtxOrdered.insert(make_pair(wtx.nOrderPos, TxPair(&wtx, (CAccountingEntry*)0)));
wtx.nTimeSmart = wtx.nTimeReceived;
if (!wtxIn.hashBlock.IsNull())
@@ -655,9 +640,8 @@ bool CWallet::AddToWallet(const CWalletTx& wtxIn, bool fFromLoadWallet, CWalletD
{
// Tolerate times up to the last timestamp in the wallet not more than 5 minutes into the future
int64_t latestTolerated = latestNow + 300;
- std::list<CAccountingEntry> acentries;
- TxItems txOrdered = OrderedTxItems(acentries);
- for (TxItems::reverse_iterator it = txOrdered.rbegin(); it != txOrdered.rend(); ++it)
+ const TxItems & txOrdered = wtxOrdered;
+ for (TxItems::const_reverse_iterator it = txOrdered.rbegin(); it != txOrdered.rend(); ++it)
{
CWalletTx *const pwtx = (*it).second.first;
if (pwtx == &wtx)
@@ -750,6 +734,20 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl
{
{
AssertLockHeld(cs_wallet);
+
+ if (pblock) {
+ BOOST_FOREACH(const CTxIn& txin, tx.vin) {
+ std::pair<TxSpends::const_iterator, TxSpends::const_iterator> range = mapTxSpends.equal_range(txin.prevout);
+ while (range.first != range.second) {
+ if (range.first->second != tx.GetHash()) {
+ LogPrintf("Transaction %s (in block %s) conflicts with wallet transaction %s (both spend %s:%i)\n", tx.GetHash().ToString(), pblock->GetHash().ToString(), range.first->second.ToString(), range.first->first.hash.ToString(), range.first->first.n);
+ MarkConflicted(pblock->GetHash(), range.first->second);
+ }
+ range.first++;
+ }
+ }
+ }
+
bool fExisted = mapWallet.count(tx.GetHash()) != 0;
if (fExisted && !fUpdate) return false;
if (fExisted || IsMine(tx) || IsFromMe(tx))
@@ -770,9 +768,57 @@ bool CWallet::AddToWalletIfInvolvingMe(const CTransaction& tx, const CBlock* pbl
return false;
}
+void CWallet::MarkConflicted(const uint256& hashBlock, const uint256& hashTx)
+{
+ LOCK2(cs_main, cs_wallet);
+
+ CBlockIndex* pindex;
+ assert(mapBlockIndex.count(hashBlock));
+ pindex = mapBlockIndex[hashBlock];
+ int conflictconfirms = 0;
+ if (chainActive.Contains(pindex)) {
+ conflictconfirms = -(chainActive.Height() - pindex->nHeight + 1);
+ }
+ assert(conflictconfirms < 0);
+
+ // Do not flush the wallet here for performance reasons
+ CWalletDB walletdb(strWalletFile, "r+", false);
+
+ std::deque<uint256> todo;
+ std::set<uint256> done;
+
+ todo.push_back(hashTx);
+
+ while (!todo.empty()) {
+ uint256 now = todo.front();
+ todo.pop_front();
+ done.insert(now);
+ assert(mapWallet.count(now));
+ CWalletTx& wtx = mapWallet[now];
+ int currentconfirm = wtx.GetDepthInMainChain();
+ if (conflictconfirms < currentconfirm) {
+ // Block is 'more conflicted' than current confirm; update.
+ // Mark transaction as conflicted with this block.
+ wtx.nIndex = -1;
+ wtx.hashBlock = hashBlock;
+ wtx.MarkDirty();
+ wtx.WriteToDisk(&walletdb);
+ // Iterate over all its outputs, and mark transactions in the wallet that spend them conflicted too
+ TxSpends::const_iterator iter = mapTxSpends.lower_bound(COutPoint(now, 0));
+ while (iter != mapTxSpends.end() && iter->first.hash == now) {
+ if (!done.count(iter->second)) {
+ todo.push_back(iter->second);
+ }
+ iter++;
+ }
+ }
+ }
+}
+
void CWallet::SyncTransaction(const CTransaction& tx, const CBlock* pblock)
{
LOCK2(cs_main, cs_wallet);
+
if (!AddToWalletIfInvolvingMe(tx, pblock, true))
return; // Not one of ours
@@ -1112,7 +1158,7 @@ void CWallet::ReacceptWalletTransactions()
int nDepth = wtx.GetDepthInMainChain();
- if (!wtx.IsCoinBase() && nDepth < 0) {
+ if (!wtx.IsCoinBase() && nDepth == 0) {
mapSorted.insert(std::make_pair(wtx.nOrderPos, &wtx));
}
}
@@ -1326,6 +1372,14 @@ bool CWalletTx::IsTrusted() const
if (!bSpendZeroConfChange || !IsFromMe(ISMINE_ALL)) // using wtx's cached debit
return false;
+ // Don't trust unconfirmed transactions from us unless they are in the mempool.
+ {
+ LOCK(mempool.cs);
+ if (!mempool.exists(GetHash())) {
+ return false;
+ }
+ }
+
// Trusted if all inputs are from us and are in the mempool:
BOOST_FOREACH(const CTxIn& txin, vin)
{
@@ -1902,6 +1956,7 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wt
//a chance at a free transaction.
//But mempool inputs might still be in the mempool, so their age stays 0
int age = pcoin.first->GetDepthInMainChain();
+ assert(age >= 0);
if (age != 0)
age += 1;
dPriority += (double)nCredit * age;
@@ -2033,17 +2088,16 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wt
if (fSendFreeTransactions && nBytes <= MAX_FREE_TRANSACTION_CREATE_SIZE)
{
// Not enough fee: enough priority?
- double dPriorityNeeded = mempool.estimatePriority(nTxConfirmTarget);
- // Not enough mempool history to estimate: use hard-coded AllowFree.
- if (dPriorityNeeded <= 0 && AllowFree(dPriority))
- break;
-
- // Small enough, and priority high enough, to send for free
- if (dPriorityNeeded > 0 && dPriority >= dPriorityNeeded)
+ double dPriorityNeeded = mempool.estimateSmartPriority(nTxConfirmTarget);
+ // Require at least hard-coded AllowFree.
+ if (dPriority >= dPriorityNeeded && AllowFree(dPriority))
break;
}
CAmount nFeeNeeded = GetMinimumFee(nBytes, nTxConfirmTarget, mempool);
+ if (coinControl && nFeeNeeded > 0 && coinControl->nMinimumTotalFee > nFeeNeeded) {
+ nFeeNeeded = coinControl->nMinimumTotalFee;
+ }
// If we made it here and we aren't even able to meet the relay fee on the next pass, give up
// because we must be at the maximum allowed fee.
@@ -2118,6 +2172,18 @@ bool CWallet::CommitTransaction(CWalletTx& wtxNew, CReserveKey& reservekey)
return true;
}
+bool CWallet::AddAccountingEntry(const CAccountingEntry& acentry, CWalletDB & pwalletdb)
+{
+ if (!pwalletdb.WriteAccountingEntry_Backend(acentry))
+ return false;
+
+ laccentries.push_back(acentry);
+ CAccountingEntry & entry = laccentries.back();
+ wtxOrdered.insert(make_pair(entry.nOrderPos, TxPair((CWalletTx*)0, &entry)));
+
+ return true;
+}
+
CAmount CWallet::GetRequiredFee(unsigned int nTxBytes)
{
return std::max(minTxFee.GetFee(nTxBytes), ::minRelayTxFee.GetFee(nTxBytes));
@@ -2127,16 +2193,15 @@ CAmount CWallet::GetMinimumFee(unsigned int nTxBytes, unsigned int nConfirmTarge
{
// payTxFee is user-set "I want to pay this much"
CAmount nFeeNeeded = payTxFee.GetFee(nTxBytes);
- // user selected total at least (default=true)
- if (fPayAtLeastCustomFee && nFeeNeeded > 0 && nFeeNeeded < payTxFee.GetFeePerK())
- nFeeNeeded = payTxFee.GetFeePerK();
// User didn't set: use -txconfirmtarget to estimate...
- if (nFeeNeeded == 0)
- nFeeNeeded = pool.estimateFee(nConfirmTarget).GetFee(nTxBytes);
- // ... unless we don't have enough mempool data, in which case fall
- // back to the required fee
- if (nFeeNeeded == 0)
- nFeeNeeded = GetRequiredFee(nTxBytes);
+ if (nFeeNeeded == 0) {
+ int estimateFoundTarget = nConfirmTarget;
+ nFeeNeeded = pool.estimateSmartFee(nConfirmTarget, &estimateFoundTarget).GetFee(nTxBytes);
+ // ... unless we don't have enough mempool data for our desired target
+ // so we make sure we're paying at least minTxFee
+ if (nFeeNeeded == 0 || (unsigned int)estimateFoundTarget > nConfirmTarget)
+ nFeeNeeded = std::max(nFeeNeeded, GetRequiredFee(nTxBytes));
+ }
// prevent user from paying a non-sense fee (like 1 satoshi): 0 < fee < minRelayFee
if (nFeeNeeded < ::minRelayTxFee.GetFee(nTxBytes))
nFeeNeeded = ::minRelayTxFee.GetFee(nTxBytes);
@@ -2273,7 +2338,7 @@ bool CWallet::NewKeyPool()
if (IsLocked())
return false;
- int64_t nKeys = max(GetArg("-keypool", 100), (int64_t)0);
+ int64_t nKeys = max(GetArg("-keypool", DEFAULT_KEYPOOL_SIZE), (int64_t)0);
for (int i = 0; i < nKeys; i++)
{
int64_t nIndex = i+1;
@@ -2300,7 +2365,7 @@ bool CWallet::TopUpKeyPool(unsigned int kpSize)
if (kpSize > 0)
nTargetSize = kpSize;
else
- nTargetSize = max(GetArg("-keypool", 100), (int64_t) 0);
+ nTargetSize = max(GetArg("-keypool", DEFAULT_KEYPOOL_SIZE), (int64_t) 0);
while (setKeyPool.size() < (nTargetSize + 1))
{
@@ -2827,9 +2892,9 @@ int CMerkleTx::SetMerkleBranch(const CBlock& block)
return chainActive.Height() - pindex->nHeight + 1;
}
-int CMerkleTx::GetDepthInMainChainINTERNAL(const CBlockIndex* &pindexRet) const
+int CMerkleTx::GetDepthInMainChain(const CBlockIndex* &pindexRet) const
{
- if (hashBlock.IsNull() || nIndex == -1)
+ if (hashBlock.IsNull())
return 0;
AssertLockHeld(cs_main);
@@ -2842,17 +2907,7 @@ int CMerkleTx::GetDepthInMainChainINTERNAL(const CBlockIndex* &pindexRet) const
return 0;
pindexRet = pindex;
- return chainActive.Height() - pindex->nHeight + 1;
-}
-
-int CMerkleTx::GetDepthInMainChain(const CBlockIndex* &pindexRet) const
-{
- AssertLockHeld(cs_main);
- int nResult = GetDepthInMainChainINTERNAL(pindexRet);
- if (nResult == 0 && !mempool.exists(GetHash()))
- return -1; // Not in chain, not in mempool
-
- return nResult;
+ return ((nIndex == -1) ? (-1) : 1) * (chainActive.Height() - pindex->nHeight + 1);
}
int CMerkleTx::GetBlocksToMaturity() const
diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h
index 719f11f206..859788893c 100644
--- a/src/wallet/wallet.h
+++ b/src/wallet/wallet.h
@@ -35,8 +35,8 @@ extern CAmount maxTxFee;
extern unsigned int nTxConfirmTarget;
extern bool bSpendZeroConfChange;
extern bool fSendFreeTransactions;
-extern bool fPayAtLeastCustomFee;
+static const unsigned int DEFAULT_KEYPOOL_SIZE = 100;
//! -paytxfee default
static const CAmount DEFAULT_TRANSACTION_FEE = 0;
//! -paytxfee will warn if called with a higher fee than this amount (in satoshis) per KB
@@ -47,12 +47,17 @@ static const CAmount DEFAULT_TRANSACTION_MINFEE = 1000;
static const CAmount DEFAULT_TRANSACTION_MAXFEE = 0.1 * COIN;
//! minimum change amount
static const CAmount MIN_CHANGE = CENT;
+//! Default for -spendzeroconfchange
+static const bool DEFAULT_SPEND_ZEROCONF_CHANGE = true;
+//! Default for -sendfreetransactions
+static const bool DEFAULT_SEND_FREE_TRANSACTIONS = false;
//! -txconfirmtarget default
static const unsigned int DEFAULT_TX_CONFIRM_TARGET = 2;
//! -maxtxfee will warn if called with a higher fee than this amount (in satoshis)
static const CAmount nHighTransactionMaxFeeWarning = 100 * nHighTransactionFeeWarning;
//! Largest (in bytes) free transaction we're willing to create
static const unsigned int MAX_FREE_TRANSACTION_CREATE_SIZE = 1000;
+static const bool DEFAULT_WALLETBROADCAST = true;
class CAccountingEntry;
class CBlockIndex;
@@ -150,11 +155,14 @@ struct COutputEntry
/** A transaction with a merkle branch linking it to the block chain. */
class CMerkleTx : public CTransaction
{
-private:
- int GetDepthInMainChainINTERNAL(const CBlockIndex* &pindexRet) const;
-
public:
uint256 hashBlock;
+
+ /* An nIndex == -1 means that hashBlock (in nonzero) refers to the earliest
+ * block in the chain we know this or any in-wallet dependency conflicts
+ * with. Older clients interpret nIndex == -1 as unconfirmed for backward
+ * compatibility.
+ */
int nIndex;
CMerkleTx()
@@ -187,16 +195,15 @@ public:
int SetMerkleBranch(const CBlock& block);
-
/**
* Return depth of transaction in blockchain:
- * -1 : not in blockchain, and not in memory pool (conflicted transaction)
+ * <0 : conflicts with a transaction this deep in the blockchain
* 0 : in memory pool, waiting to be included in a block
* >=1 : this many blocks deep in the main chain
*/
int GetDepthInMainChain(const CBlockIndex* &pindexRet) const;
int GetDepthInMainChain() const { const CBlockIndex *pindexRet; return GetDepthInMainChain(pindexRet); }
- bool IsInMainChain() const { const CBlockIndex *pindexRet; return GetDepthInMainChainINTERNAL(pindexRet) > 0; }
+ bool IsInMainChain() const { const CBlockIndex *pindexRet; return GetDepthInMainChain(pindexRet) > 0; }
int GetBlocksToMaturity() const;
bool AcceptToMemoryPool(bool fLimitFree=true, bool fRejectAbsurdFee=true);
};
@@ -475,6 +482,10 @@ private:
void AddToSpends(const COutPoint& outpoint, const uint256& wtxid);
void AddToSpends(const uint256& wtxid);
+ /* Mark a transaction (and its in-wallet descendants) as conflicting with a particular block. */
+ void MarkConflicted(const uint256& hashBlock, const uint256& hashTx);
+
+
void SyncMetaData(std::pair<TxSpends::iterator, TxSpends::iterator>);
public:
@@ -531,6 +542,11 @@ public:
}
std::map<uint256, CWalletTx> mapWallet;
+ std::list<CAccountingEntry> laccentries;
+
+ typedef std::pair<CWalletTx*, CAccountingEntry*> TxPair;
+ typedef std::multimap<int64_t, TxPair > TxItems;
+ TxItems wtxOrdered;
int64_t nOrderPosNext;
std::map<uint256, int> mapRequestCount;
@@ -617,16 +633,6 @@ public:
*/
int64_t IncOrderPosNext(CWalletDB *pwalletdb = NULL);
- typedef std::pair<CWalletTx*, CAccountingEntry*> TxPair;
- typedef std::multimap<int64_t, TxPair > TxItems;
-
- /**
- * Get the wallet's activity log
- * @return multimap of ordered transactions and accounting entries
- * @warning Returned pointers are *only* valid within the scope of passed acentries
- */
- TxItems OrderedTxItems(std::list<CAccountingEntry>& acentries, std::string strAccount = "");
-
void MarkDirty();
bool AddToWallet(const CWalletTx& wtxIn, bool fFromLoadWallet, CWalletDB* pwalletdb);
void SyncTransaction(const CTransaction& tx, const CBlock* pblock);
@@ -656,6 +662,8 @@ public:
std::string& strFailReason, const CCoinControl *coinControl = NULL, bool sign = true);
bool CommitTransaction(CWalletTx& wtxNew, CReserveKey& reservekey);
+ bool AddAccountingEntry(const CAccountingEntry&, CWalletDB & pwalletdb);
+
static CFeeRate minTxFee;
/**
* Estimate the minimum fee considering user set parameters
diff --git a/src/wallet/walletdb.cpp b/src/wallet/walletdb.cpp
index e0f3e3aa04..e2e827d816 100644
--- a/src/wallet/walletdb.cpp
+++ b/src/wallet/walletdb.cpp
@@ -191,7 +191,7 @@ bool CWalletDB::WriteAccountingEntry(const uint64_t nAccEntryNum, const CAccount
return Write(std::make_pair(std::string("acentry"), std::make_pair(acentry.strAccount, nAccEntryNum)), acentry);
}
-bool CWalletDB::WriteAccountingEntry(const CAccountingEntry& acentry)
+bool CWalletDB::WriteAccountingEntry_Backend(const CAccountingEntry& acentry)
{
return WriteAccountingEntry(++nAccountingEntryNumber, acentry);
}
@@ -709,6 +709,12 @@ DBErrors CWalletDB::LoadWallet(CWallet* pwallet)
if (wss.fAnyUnordered)
result = ReorderTransactions(pwallet);
+ pwallet->laccentries.clear();
+ ListAccountCreditDebit("*", pwallet->laccentries);
+ BOOST_FOREACH(CAccountingEntry& entry, pwallet->laccentries) {
+ pwallet->wtxOrdered.insert(make_pair(entry.nOrderPos, CWallet::TxPair((CWalletTx*)0, &entry)));
+ }
+
return result;
}
@@ -804,7 +810,7 @@ void ThreadFlushWalletDB(const string& strFile)
if (fOneThread)
return;
fOneThread = true;
- if (!GetBoolArg("-flushwallet", true))
+ if (!GetBoolArg("-flushwallet", DEFAULT_FLUSHWALLET))
return;
unsigned int nLastSeen = nWalletDBUpdated;
diff --git a/src/wallet/walletdb.h b/src/wallet/walletdb.h
index 270f826aed..77f7958814 100644
--- a/src/wallet/walletdb.h
+++ b/src/wallet/walletdb.h
@@ -16,6 +16,8 @@
#include <utility>
#include <vector>
+static const bool DEFAULT_FLUSHWALLET = true;
+
class CAccount;
class CAccountingEntry;
struct CBlockLocator;
@@ -110,6 +112,9 @@ public:
bool WriteMinVersion(int nVersion);
+ /// This writes directly to the database, and will not update the CWallet's cached accounting entries!
+ /// Use wallet.AddAccountingEntry instead, to write *and* update its caches.
+ bool WriteAccountingEntry_Backend(const CAccountingEntry& acentry);
bool ReadAccount(const std::string& strAccount, CAccount& account);
bool WriteAccount(const std::string& strAccount, const CAccount& account);
@@ -118,7 +123,6 @@ public:
/// Erase destination data tuple from wallet database
bool EraseDestData(const std::string &address, const std::string &key);
- bool WriteAccountingEntry(const CAccountingEntry& acentry);
CAmount GetAccountCreditDebit(const std::string& strAccount);
void ListAccountCreditDebit(const std::string& strAccount, std::list<CAccountingEntry>& acentries);
diff --git a/src/zmq/zmqnotificationinterface.cpp b/src/zmq/zmqnotificationinterface.cpp
index 09fe3aeb4c..be2aec7d15 100644
--- a/src/zmq/zmqnotificationinterface.cpp
+++ b/src/zmq/zmqnotificationinterface.cpp
@@ -12,7 +12,7 @@
void zmqError(const char *str)
{
- LogPrint("zmq", "Error: %s, errno=%s\n", str, zmq_strerror(errno));
+ LogPrint("zmq", "zmq: Error: %s, errno=%s\n", str, zmq_strerror(errno));
}
CZMQNotificationInterface::CZMQNotificationInterface() : pcontext(NULL)
@@ -72,7 +72,7 @@ CZMQNotificationInterface* CZMQNotificationInterface::CreateWithArguments(const
// Called at startup to conditionally set up ZMQ socket(s)
bool CZMQNotificationInterface::Initialize()
{
- LogPrint("zmq", "Initialize notification interface\n");
+ LogPrint("zmq", "zmq: Initialize notification interface\n");
assert(!pcontext);
pcontext = zmq_init(1);
@@ -110,7 +110,7 @@ bool CZMQNotificationInterface::Initialize()
// Called during shutdown sequence
void CZMQNotificationInterface::Shutdown()
{
- LogPrint("zmq", "Shutdown notification interface\n");
+ LogPrint("zmq", "zmq: Shutdown notification interface\n");
if (pcontext)
{
for (std::list<CZMQAbstractNotifier*>::iterator i=notifiers.begin(); i!=notifiers.end(); ++i)
diff --git a/src/zmq/zmqpublishnotifier.cpp b/src/zmq/zmqpublishnotifier.cpp
index ac788843eb..ddc8fe93e9 100644
--- a/src/zmq/zmqpublishnotifier.cpp
+++ b/src/zmq/zmqpublishnotifier.cpp
@@ -78,7 +78,7 @@ bool CZMQAbstractPublishNotifier::Initialize(void *pcontext)
}
else
{
- LogPrint("zmq", " Reuse socket for address %s\n", address);
+ LogPrint("zmq", "zmq: Reusing socket for address %s\n", address);
psocket = i->second->psocket;
mapPublishNotifiers.insert(std::make_pair(address, this));
@@ -120,7 +120,7 @@ void CZMQAbstractPublishNotifier::Shutdown()
bool CZMQPublishHashBlockNotifier::NotifyBlock(const CBlockIndex *pindex)
{
uint256 hash = pindex->GetBlockHash();
- LogPrint("zmq", "Publish hash block %s\n", hash.GetHex());
+ LogPrint("zmq", "zmq: Publish hashblock %s\n", hash.GetHex());
char data[32];
for (unsigned int i = 0; i < 32; i++)
data[31 - i] = hash.begin()[i];
@@ -131,7 +131,7 @@ bool CZMQPublishHashBlockNotifier::NotifyBlock(const CBlockIndex *pindex)
bool CZMQPublishHashTransactionNotifier::NotifyTransaction(const CTransaction &transaction)
{
uint256 hash = transaction.GetHash();
- LogPrint("zmq", "Publish hash transaction %s\n", hash.GetHex());
+ LogPrint("zmq", "zmq: Publish hashtx %s\n", hash.GetHex());
char data[32];
for (unsigned int i = 0; i < 32; i++)
data[31 - i] = hash.begin()[i];
@@ -141,7 +141,7 @@ bool CZMQPublishHashTransactionNotifier::NotifyTransaction(const CTransaction &t
bool CZMQPublishRawBlockNotifier::NotifyBlock(const CBlockIndex *pindex)
{
- LogPrint("zmq", "Publish raw block %s\n", pindex->GetBlockHash().GetHex());
+ LogPrint("zmq", "zmq: Publish rawblock %s\n", pindex->GetBlockHash().GetHex());
const Consensus::Params& consensusParams = Params().GetConsensus();
CDataStream ss(SER_NETWORK, PROTOCOL_VERSION);
@@ -164,7 +164,7 @@ bool CZMQPublishRawBlockNotifier::NotifyBlock(const CBlockIndex *pindex)
bool CZMQPublishRawTransactionNotifier::NotifyTransaction(const CTransaction &transaction)
{
uint256 hash = transaction.GetHash();
- LogPrint("zmq", "Publish raw transaction %s\n", hash.GetHex());
+ LogPrint("zmq", "zmq: Publish rawtx %s\n", hash.GetHex());
CDataStream ss(SER_NETWORK, PROTOCOL_VERSION);
ss << transaction;
int rc = zmq_send_multipart(psocket, "rawtx", 5, &(*ss.begin()), ss.size(), 0);