aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/bench/verify_script.cpp2
-rw-r--r--src/key.cpp24
-rw-r--r--src/key.h2
-rw-r--r--src/leveldb/util/env_posix.cc4
-rw-r--r--src/net.h2
-rw-r--r--src/net_processing.cpp12
-rw-r--r--src/qt/bitcoinstrings.cpp8
-rw-r--r--src/qt/locale/bitcoin_el_GR.ts4
-rw-r--r--src/qt/locale/bitcoin_en.ts54
-rw-r--r--src/qt/locale/bitcoin_fr.ts2
-rw-r--r--src/qt/locale/bitcoin_he.ts8
-rw-r--r--src/qt/locale/bitcoin_it.ts100
-rw-r--r--src/qt/locale/bitcoin_ja.ts2
-rw-r--r--src/qt/locale/bitcoin_ru.ts20
-rw-r--r--src/qt/locale/bitcoin_ru_RU.ts186
-rw-r--r--src/qt/locale/bitcoin_sl_SI.ts94
-rw-r--r--src/rpc/blockchain.cpp59
-rw-r--r--src/rpc/blockchain.h9
-rw-r--r--src/rpc/rawtransaction.cpp6
-rw-r--r--src/script/sign.cpp22
-rw-r--r--src/script/sign.h4
-rw-r--r--src/test/key_tests.cpp36
-rw-r--r--src/test/rpc_tests.cpp80
-rw-r--r--src/test/script_tests.cpp2
-rw-r--r--src/wallet/rpcdump.cpp8
-rw-r--r--src/wallet/rpcwallet.cpp4
-rw-r--r--src/wallet/wallet.cpp43
-rw-r--r--src/wallet/wallet.h29
-rw-r--r--test/functional/data/rpc_getblockstats.json24
-rw-r--r--test/functional/data/rpc_psbt.json8
-rwxr-xr-xtest/functional/feature_help.py43
-rwxr-xr-xtest/functional/feature_reindex.py2
-rwxr-xr-xtest/functional/mempool_accept.py1
-rwxr-xr-xtest/functional/mempool_reorg.py3
-rwxr-xr-xtest/functional/mempool_resurrect.py3
-rwxr-xr-xtest/functional/mempool_spend_coinbase.py3
-rwxr-xr-xtest/functional/p2p_invalid_locator.py43
-rwxr-xr-xtest/functional/rpc_bind.py6
-rwxr-xr-xtest/functional/rpc_blockchain.py11
-rwxr-xr-xtest/functional/rpc_getblockstats.py16
-rwxr-xr-xtest/functional/rpc_users.py3
-rwxr-xr-xtest/functional/test_framework/messages.py1
-rwxr-xr-xtest/functional/test_framework/mininode.py9
-rwxr-xr-xtest/functional/test_framework/test_framework.py50
-rwxr-xr-xtest/functional/test_framework/test_node.py7
-rwxr-xr-xtest/functional/test_runner.py1
-rwxr-xr-xtest/functional/wallet_txn_clone.py8
-rwxr-xr-xtest/functional/wallet_txn_doublespend.py4
-rwxr-xr-xtest/lint/lint-format-strings.py38
-rw-r--r--test/util/data/txcreatesignv1.hex2
-rw-r--r--test/util/data/txcreatesignv1.json16
51 files changed, 930 insertions, 198 deletions
diff --git a/src/bench/verify_script.cpp b/src/bench/verify_script.cpp
index 3421d56ed2..312b66e38a 100644
--- a/src/bench/verify_script.cpp
+++ b/src/bench/verify_script.cpp
@@ -76,7 +76,7 @@ static void VerifyScriptBench(benchmark::State& state)
CMutableTransaction txSpend = BuildSpendingTransaction(scriptSig, txCredit);
CScriptWitness& witness = txSpend.vin[0].scriptWitness;
witness.stack.emplace_back();
- key.Sign(SignatureHash(witScriptPubkey, txSpend, 0, SIGHASH_ALL, txCredit.vout[0].nValue, SigVersion::WITNESS_V0), witness.stack.back(), 0);
+ key.Sign(SignatureHash(witScriptPubkey, txSpend, 0, SIGHASH_ALL, txCredit.vout[0].nValue, SigVersion::WITNESS_V0), witness.stack.back());
witness.stack.back().push_back(static_cast<unsigned char>(SIGHASH_ALL));
witness.stack.push_back(ToByteVector(pubkey));
diff --git a/src/key.cpp b/src/key.cpp
index 22fc7047ce..df452cd330 100644
--- a/src/key.cpp
+++ b/src/key.cpp
@@ -189,7 +189,20 @@ CPubKey CKey::GetPubKey() const {
return result;
}
-bool CKey::Sign(const uint256 &hash, std::vector<unsigned char>& vchSig, uint32_t test_case) const {
+// Check that the sig has a low R value and will be less than 71 bytes
+bool SigHasLowR(const secp256k1_ecdsa_signature* sig)
+{
+ unsigned char compact_sig[64];
+ secp256k1_ecdsa_signature_serialize_compact(secp256k1_context_sign, compact_sig, sig);
+
+ // In DER serialization, all values are interpreted as big-endian, signed integers. The highest bit in the integer indicates
+ // its signed-ness; 0 is positive, 1 is negative. When the value is interpreted as a negative integer, it must be converted
+ // to a positive value by prepending a 0x00 byte so that the highest bit is 0. We can avoid this prepending by ensuring that
+ // our highest bit is always 0, and thus we must check that the first byte is less than 0x80.
+ return compact_sig[0] < 0x80;
+}
+
+bool CKey::Sign(const uint256 &hash, std::vector<unsigned char>& vchSig, bool grind, uint32_t test_case) const {
if (!fValid)
return false;
vchSig.resize(CPubKey::SIGNATURE_SIZE);
@@ -197,7 +210,14 @@ bool CKey::Sign(const uint256 &hash, std::vector<unsigned char>& vchSig, uint32_
unsigned char extra_entropy[32] = {0};
WriteLE32(extra_entropy, test_case);
secp256k1_ecdsa_signature sig;
- int ret = secp256k1_ecdsa_sign(secp256k1_context_sign, &sig, hash.begin(), begin(), secp256k1_nonce_function_rfc6979, test_case ? extra_entropy : nullptr);
+ uint32_t counter = 0;
+ int ret = secp256k1_ecdsa_sign(secp256k1_context_sign, &sig, hash.begin(), begin(), secp256k1_nonce_function_rfc6979, (!grind && test_case) ? extra_entropy : nullptr);
+
+ // Grind for low R
+ while (ret && !SigHasLowR(&sig) && grind) {
+ WriteLE32(extra_entropy, ++counter);
+ ret = secp256k1_ecdsa_sign(secp256k1_context_sign, &sig, hash.begin(), begin(), secp256k1_nonce_function_rfc6979, extra_entropy);
+ }
assert(ret);
secp256k1_ecdsa_signature_serialize_der(secp256k1_context_sign, vchSig.data(), &nSigLen, &sig);
vchSig.resize(nSigLen);
diff --git a/src/key.h b/src/key.h
index d437f4d53e..a3baa421e6 100644
--- a/src/key.h
+++ b/src/key.h
@@ -114,7 +114,7 @@ public:
* Create a DER-serialized signature.
* The test_case parameter tweaks the deterministic nonce.
*/
- bool Sign(const uint256& hash, std::vector<unsigned char>& vchSig, uint32_t test_case = 0) const;
+ bool Sign(const uint256& hash, std::vector<unsigned char>& vchSig, bool grind = true, uint32_t test_case = 0) const;
/**
* Create a compact signature (65 bytes), which allows reconstructing the used public key.
diff --git a/src/leveldb/util/env_posix.cc b/src/leveldb/util/env_posix.cc
index 4676bc2240..f77918313e 100644
--- a/src/leveldb/util/env_posix.cc
+++ b/src/leveldb/util/env_posix.cc
@@ -585,8 +585,8 @@ static int MaxMmaps() {
if (mmap_limit >= 0) {
return mmap_limit;
}
- // Up to 1000 mmaps for 64-bit binaries; none for smaller pointer sizes.
- mmap_limit = sizeof(void*) >= 8 ? 1000 : 0;
+ // Up to 4096 mmaps for 64-bit binaries; none for smaller pointer sizes.
+ mmap_limit = sizeof(void*) >= 8 ? 4096 : 0;
return mmap_limit;
}
diff --git a/src/net.h b/src/net.h
index 5ea4bdeada..f9cfea59b7 100644
--- a/src/net.h
+++ b/src/net.h
@@ -45,6 +45,8 @@ static const int TIMEOUT_INTERVAL = 20 * 60;
static const int FEELER_INTERVAL = 120;
/** The maximum number of entries in an 'inv' protocol message */
static const unsigned int MAX_INV_SZ = 50000;
+/** The maximum number of entries in a locator */
+static const unsigned int MAX_LOCATOR_SZ = 101;
/** The maximum number of new addresses to accumulate before announcing. */
static const unsigned int MAX_ADDR_TO_SEND = 1000;
/** Maximum length of incoming protocol messages (no message over 4 MB is currently acceptable). */
diff --git a/src/net_processing.cpp b/src/net_processing.cpp
index f684698793..88999ba735 100644
--- a/src/net_processing.cpp
+++ b/src/net_processing.cpp
@@ -2018,6 +2018,12 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
uint256 hashStop;
vRecv >> locator >> hashStop;
+ if (locator.vHave.size() > MAX_LOCATOR_SZ) {
+ LogPrint(BCLog::NET, "getblocks locator size %lld > %d, disconnect peer=%d\n", locator.vHave.size(), MAX_LOCATOR_SZ, pfrom->GetId());
+ pfrom->fDisconnect = true;
+ return true;
+ }
+
// We might have announced the currently-being-connected tip using a
// compact block, which resulted in the peer sending a getblocks
// request, which we would otherwise respond to without the new block.
@@ -2131,6 +2137,12 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
uint256 hashStop;
vRecv >> locator >> hashStop;
+ if (locator.vHave.size() > MAX_LOCATOR_SZ) {
+ LogPrint(BCLog::NET, "getheaders locator size %lld > %d, disconnect peer=%d\n", locator.vHave.size(), MAX_LOCATOR_SZ, pfrom->GetId());
+ pfrom->fDisconnect = true;
+ return true;
+ }
+
LOCK(cs_main);
if (IsInitialBlockDownload() && !pfrom->fWhitelisted) {
LogPrint(BCLog::NET, "Ignoring getheaders from peer=%d because node is in initial block download\n", pfrom->GetId());
diff --git a/src/qt/bitcoinstrings.cpp b/src/qt/bitcoinstrings.cpp
index ab7e56a9da..de60b30dfe 100644
--- a/src/qt/bitcoinstrings.cpp
+++ b/src/qt/bitcoinstrings.cpp
@@ -40,6 +40,12 @@ QT_TRANSLATE_NOOP("bitcoin-core", ""
"Fee estimation failed. Fallbackfee is disabled. Wait a few blocks or enable -"
"fallbackfee."),
QT_TRANSLATE_NOOP("bitcoin-core", ""
+"Group outputs by address, selecting all or none, instead of selecting on a "
+"per-output basis. Privacy is improved as an address is only used once "
+"(unless someone sends to it after spending from it), but may result in "
+"slightly higher fees as suboptimal coin selection may result due to the "
+"added limitation (default: %u)"),
+QT_TRANSLATE_NOOP("bitcoin-core", ""
"Invalid amount for -maxtxfee=<amount>: '%s' (must be at least the minrelay "
"fee of %s to prevent stuck transactions)"),
QT_TRANSLATE_NOOP("bitcoin-core", ""
@@ -168,7 +174,7 @@ QT_TRANSLATE_NOOP("bitcoin-core", "Signing transaction failed"),
QT_TRANSLATE_NOOP("bitcoin-core", "Specified -walletdir \"%s\" does not exist"),
QT_TRANSLATE_NOOP("bitcoin-core", "Specified -walletdir \"%s\" is a relative path"),
QT_TRANSLATE_NOOP("bitcoin-core", "Specified -walletdir \"%s\" is not a directory"),
-QT_TRANSLATE_NOOP("bitcoin-core", "Specified blocks directory \"%s\" does not exist.\n"),
+QT_TRANSLATE_NOOP("bitcoin-core", "Specified blocks directory \"%s\" does not exist."),
QT_TRANSLATE_NOOP("bitcoin-core", "Starting network threads..."),
QT_TRANSLATE_NOOP("bitcoin-core", "The source code is available from %s."),
QT_TRANSLATE_NOOP("bitcoin-core", "The transaction amount is too small to pay the fee"),
diff --git a/src/qt/locale/bitcoin_el_GR.ts b/src/qt/locale/bitcoin_el_GR.ts
index 143277536c..4557fd85aa 100644
--- a/src/qt/locale/bitcoin_el_GR.ts
+++ b/src/qt/locale/bitcoin_el_GR.ts
@@ -442,6 +442,10 @@
<translation>Φόρτωση ευρετηρίου μπλοκ στον σκληρο δισκο...</translation>
</message>
<message>
+ <source>Processing blocks on disk...</source>
+ <translation>Φόρτωση ευρετηρίου μπλοκ στον σκληρο δισκο...</translation>
+ </message>
+ <message>
<source>%1 behind</source>
<translation>%1 πίσω</translation>
</message>
diff --git a/src/qt/locale/bitcoin_en.ts b/src/qt/locale/bitcoin_en.ts
index 1b51699b31..fbff2d36a0 100644
--- a/src/qt/locale/bitcoin_en.ts
+++ b/src/qt/locale/bitcoin_en.ts
@@ -959,7 +959,7 @@
<translation type="unfinished"></translation>
</message>
<message>
- <location line="+71"/>
+ <location line="+75"/>
<source>The entered address &quot;%1&quot; is not a valid Bitcoin address.</source>
<translation type="unfinished"></translation>
</message>
@@ -1524,7 +1524,7 @@
<translation>default</translation>
</message>
<message>
- <location line="+52"/>
+ <location line="+56"/>
<source>none</source>
<translation type="unfinished"></translation>
</message>
@@ -1842,12 +1842,12 @@
<translation type="unfinished">Amount</translation>
</message>
<message>
- <location filename="../guiutil.cpp" line="+124"/>
+ <location filename="../guiutil.cpp" line="+115"/>
<source>Enter a Bitcoin address (e.g. %1)</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location line="+722"/>
+ <location line="+686"/>
<source>%1 d</source>
<translation type="unfinished"></translation>
</message>
@@ -1957,7 +1957,7 @@
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../bitcoin.cpp" line="+193"/>
+ <location filename="../bitcoin.cpp" line="+192"/>
<source>%1 didn&apos;t yet exit safely...</source>
<translation type="unfinished"></translation>
</message>
@@ -1970,12 +1970,12 @@
<context>
<name>QObject::QObject</name>
<message>
- <location filename="../bitcoin.cpp" line="-118"/>
+ <location filename="../bitcoin.cpp" line="-117"/>
<source>Error parsing command line arguments: %1.</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location line="+39"/>
+ <location line="+38"/>
<source>Error: Specified data directory &quot;%1&quot; does not exist.</source>
<translation type="unfinished"></translation>
</message>
@@ -3155,7 +3155,7 @@ Note: Since the fee is calculated on a per-byte basis, a fee of &quot;100 satos
<context>
<name>ShutdownWindow</name>
<message>
- <location filename="../utilitydialog.cpp" line="+84"/>
+ <location filename="../utilitydialog.cpp" line="+83"/>
<source>%1 is shutting down...</source>
<translation type="unfinished"></translation>
</message>
@@ -4066,7 +4066,7 @@ Note: Since the fee is calculated on a per-byte basis, a fee of &quot;100 satos
<translation type="unfinished"></translation>
</message>
<message>
- <location line="+22"/>
+ <location line="+28"/>
<source>Prune configured below the minimum of %d MiB. Please use a higher number.</source>
<translation type="unfinished"></translation>
</message>
@@ -4096,7 +4096,7 @@ Note: Since the fee is calculated on a per-byte basis, a fee of &quot;100 satos
<translation type="unfinished"></translation>
</message>
<message>
- <location line="-178"/>
+ <location line="-184"/>
<source>Bitcoin Core</source>
<translation type="unfinished">Bitcoin Core</translation>
</message>
@@ -4121,7 +4121,12 @@ Note: Since the fee is calculated on a per-byte basis, a fee of &quot;100 satos
<translation type="unfinished"></translation>
</message>
<message>
- <location line="+11"/>
+ <location line="+8"/>
+ <source>Group outputs by address, selecting all or none, instead of selecting on a per-output basis. Privacy is improved as an address is only used once (unless someone sends to it after spending from it), but may result in slightly higher fees as suboptimal coin selection may result due to the added limitation (default: %u)</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+9"/>
<source>Please check that your computer&apos;s date and time are correct! If your clock is wrong, %s will not work properly.</source>
<translation type="unfinished"></translation>
</message>
@@ -4296,7 +4301,12 @@ Note: Since the fee is calculated on a per-byte basis, a fee of &quot;100 satos
<translation type="unfinished"></translation>
</message>
<message>
- <location line="+47"/>
+ <location line="+21"/>
+ <source>Specified blocks directory &quot;%s&quot; does not exist.</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location line="+26"/>
<source>Upgrading txindex database</source>
<translation type="unfinished"></translation>
</message>
@@ -4396,12 +4406,12 @@ Note: Since the fee is calculated on a per-byte basis, a fee of &quot;100 satos
<translation type="unfinished"></translation>
</message>
<message>
- <location line="-165"/>
+ <location line="-171"/>
<source>Error: Listening for incoming connections failed (listen returned error %s)</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location line="+5"/>
+ <location line="+11"/>
<source>Invalid amount for -maxtxfee=&lt;amount&gt;: &apos;%s&apos; (must be at least the minrelay fee of %s to prevent stuck transactions)</source>
<translation type="unfinished"></translation>
</message>
@@ -4486,13 +4496,7 @@ Note: Since the fee is calculated on a per-byte basis, a fee of &quot;100 satos
<translation type="unfinished"></translation>
</message>
<message>
- <location line="+1"/>
- <source>Specified blocks directory &quot;%s&quot; does not exist.
-</source>
- <translation type="unfinished"></translation>
- </message>
- <message>
- <location line="+3"/>
+ <location line="+4"/>
<source>The transaction amount is too small to pay the fee</source>
<translation type="unfinished"></translation>
</message>
@@ -4552,7 +4556,7 @@ Note: Since the fee is calculated on a per-byte basis, a fee of &quot;100 satos
<translation type="unfinished"></translation>
</message>
<message>
- <location line="-191"/>
+ <location line="-197"/>
<source>-maxtxfee is set very high! Fees this large could be paid on a single transaction.</source>
<translation type="unfinished"></translation>
</message>
@@ -4562,7 +4566,7 @@ Note: Since the fee is calculated on a per-byte basis, a fee of &quot;100 satos
<translation type="unfinished"></translation>
</message>
<message>
- <location line="+40"/>
+ <location line="+46"/>
<source>This is the transaction fee you may pay when fee estimates are not available.</source>
<translation type="unfinished"></translation>
</message>
@@ -4657,7 +4661,7 @@ Note: Since the fee is calculated on a per-byte basis, a fee of &quot;100 satos
<translation>Insufficient funds</translation>
</message>
<message>
- <location line="-128"/>
+ <location line="-134"/>
<source>Can&apos;t generate a change-address key. Private keys are disabled for this wallet.</source>
<translation type="unfinished"></translation>
</message>
@@ -4672,7 +4676,7 @@ Note: Since the fee is calculated on a per-byte basis, a fee of &quot;100 satos
<translation type="unfinished"></translation>
</message>
<message>
- <location line="+54"/>
+ <location line="+60"/>
<source>Warning: Private keys detected in wallet {%s} with disabled private keys</source>
<translation type="unfinished"></translation>
</message>
diff --git a/src/qt/locale/bitcoin_fr.ts b/src/qt/locale/bitcoin_fr.ts
index da389a96ef..52e7bda368 100644
--- a/src/qt/locale/bitcoin_fr.ts
+++ b/src/qt/locale/bitcoin_fr.ts
@@ -3623,7 +3623,7 @@ Note : Les frais étant calculés par octet, des frais de « 100 satoshis par
</message>
<message>
<source>Cannot upgrade a non HD split wallet without upgrading to support pre split keypool. Please use -upgradewallet=169900 or -upgradewallet with no version specified.</source>
- <translation>Impossible de mettre à niveau un porte-monnaie divisé non-HD pour prendre en charge la réserve de clés antérieure à la division. Veuillez utiliser -upgradewallet=169900 ou -upgradewallet sans indiquer de version.</translation>
+ <translation>Impossible de mettre à niveau un porte-monnaie divisé non-HD sans mettre à niveau pour prendre en charge la réserve de clés antérieure à la division. Veuillez utiliser -upgradewallet=169900 ou -upgradewallet sans indiquer de version.</translation>
</message>
<message>
<source>Fee estimation failed. Fallbackfee is disabled. Wait a few blocks or enable -fallbackfee.</source>
diff --git a/src/qt/locale/bitcoin_he.ts b/src/qt/locale/bitcoin_he.ts
index cb46881776..cf884f0fc7 100644
--- a/src/qt/locale/bitcoin_he.ts
+++ b/src/qt/locale/bitcoin_he.ts
@@ -2155,6 +2155,10 @@ Note: Since the fee is calculated on a per-byte basis, a fee of "100 satoshis p
<translation>אפשר ״החלפה-על ידי עמלה״</translation>
</message>
<message>
+ <source>With Replace-By-Fee (BIP-125) you can increase a transaction's fee after it is sent. Without this, a higher fee may be recommended to compensate for increased transaction delay risk.</source>
+ <translation>באמצעות עמלה-ניתנת-לשינוי (BIP-125) תוכלו להגדיל עמלת עסקה גם לאחר שליחתה. ללא אפשרות זו, עמלה גבוהה יותר יכולה להיות מומלצת כדי להקטין את הסיכון בעיכוב אישור העסקה.</translation>
+ </message>
+ <message>
<source>Clear &amp;All</source>
<translation>&amp;ניקוי הכול</translation>
</message>
@@ -2211,6 +2215,10 @@ Note: Since the fee is calculated on a per-byte basis, a fee of "100 satoshis p
<translation>תוכלו להגדיל את העמלה מאוחר יותר (איתות Replace-By-Fee, BIP-125).</translation>
</message>
<message>
+ <source>Please, review your transaction.</source>
+ <translation>אנא עברו שוב על העסקה שלכם.</translation>
+ </message>
+ <message>
<source>Transaction fee</source>
<translation>עמלת העברה</translation>
</message>
diff --git a/src/qt/locale/bitcoin_it.ts b/src/qt/locale/bitcoin_it.ts
index 3f63a2ca49..5b24fcdf46 100644
--- a/src/qt/locale/bitcoin_it.ts
+++ b/src/qt/locale/bitcoin_it.ts
@@ -326,6 +326,14 @@
<translation>Apri &amp;URI...</translation>
</message>
<message>
+ <source>Wallet:</source>
+ <translation>Portafoglio:</translation>
+ </message>
+ <message>
+ <source>default wallet</source>
+ <translation>Portafoglio predefinito:</translation>
+ </message>
+ <message>
<source>Click to disable network activity.</source>
<translation>Clicca per disattivare la rete.</translation>
</message>
@@ -346,6 +354,10 @@
<translation>Re-indicizzazione blocchi su disco...</translation>
</message>
<message>
+ <source>Proxy is &lt;b&gt;enabled&lt;/b&gt;: %1</source>
+ <translation>Il Proxy è &lt;b&gt;enabled&lt;/b&gt;:%1</translation>
+ </message>
+ <message>
<source>Send coins to a Bitcoin address</source>
<translation>Invia fondi ad un indirizzo Bitcoin</translation>
</message>
@@ -514,6 +526,12 @@
</translation>
</message>
<message>
+ <source>Wallet: %1
+</source>
+ <translation>Portafoglio: %1
+</translation>
+ </message>
+ <message>
<source>Type: %1
</source>
<translation>Tipo: %1
@@ -1029,6 +1047,22 @@ Per specificare più URL separarli con una barra verticale "|".</translation>
<translation>Rete</translation>
</message>
<message>
+ <source>Disables some advanced features but all blocks will still be fully validated. Reverting this setting requires re-downloading the entire blockchain. Actual disk usage may be somewhat higher.</source>
+ <translation>Disattiva alcune funzionalità avanzate, ma tutti i blocchi saranno ancora completamente validati. Per ripristinare questa impostazione è necessario rieseguire il download dell'intera blockchain. L'utilizzo effettivo del disco potrebbe essere leggermente superiore.</translation>
+ </message>
+ <message>
+ <source>Prune &amp;block storage to</source>
+ <translation>Eliminare e bloccare l'archiviazione su</translation>
+ </message>
+ <message>
+ <source>GB</source>
+ <translation>GB</translation>
+ </message>
+ <message>
+ <source>Reverting this setting requires re-downloading the entire blockchain.</source>
+ <translation>Per ripristinare questa impostazione è necessario rieseguire il download dell'intera blockchain.</translation>
+ </message>
+ <message>
<source>(0 = auto, &lt;0 = leave that many cores free)</source>
<translation>(0 = automatico, &lt;0 = lascia questo numero di core liberi)</translation>
</message>
@@ -1295,6 +1329,10 @@ Per specificare più URL separarli con una barra verticale "|".</translation>
<translation>Gestione URI</translation>
</message>
<message>
+ <source>'bitcoin://' is not a valid URI. Use 'bitcoin:' instead.</source>
+ <translation>'bitcoin: //' non è un URI valido. Usa invece "bitcoin:".</translation>
+ </message>
+ <message>
<source>Payment request fetch URL is invalid: %1</source>
<translation>URL di recupero della Richiesta di pagamento non valido: %1</translation>
</message>
@@ -1586,6 +1624,14 @@ Per specificare più URL separarli con una barra verticale "|".</translation>
<translation>Utilizzo memoria</translation>
</message>
<message>
+ <source>Wallet: </source>
+ <translation>Portafoglio:</translation>
+ </message>
+ <message>
+ <source>(none)</source>
+ <translation>(nessuno)</translation>
+ </message>
+ <message>
<source>&amp;Reset</source>
<translation>&amp;Ripristina</translation>
</message>
@@ -1754,6 +1800,10 @@ Per specificare più URL separarli con una barra verticale "|".</translation>
<translation>&amp;Elimina Ban</translation>
</message>
<message>
+ <source>default wallet</source>
+ <translation>Portafoglio predefinito:</translation>
+ </message>
+ <message>
<source>Welcome to the %1 RPC console.</source>
<translation>Benvenuto nella console RPC di %1.</translation>
</message>
@@ -1778,6 +1828,10 @@ Per specificare più URL separarli con una barra verticale "|".</translation>
<translation>Attività di rete disabilitata</translation>
</message>
<message>
+ <source>Executing command without any wallet</source>
+ <translation>Esecuzione del comando senza alcun portafoglio</translation>
+ </message>
+ <message>
<source>(node id: %1)</source>
<translation>(id nodo: %1)</translation>
</message>
@@ -2062,6 +2116,14 @@ Per specificare più URL separarli con una barra verticale "|".</translation>
<translation>minimizza le impostazioni di commissione</translation>
</message>
<message>
+ <source>Specify a custom fee per kB (1,000 bytes) of the transaction's virtual size.
+
+Note: Since the fee is calculated on a per-byte basis, a fee of "100 satoshis per kB" for a transaction size of 500 bytes (half of 1 kB) would ultimately yield a fee of only 50 satoshis.</source>
+ <translation>Specifica una tariffa personalizzata per kB (1.000 byte) della dimensione virtuale della transazione
+
+Nota: poiché la commissione è calcolata su base per byte, una commissione di "100 satoshi per kB" per una dimensione di transazione di 500 byte (metà di 1 kB) alla fine produrrà una commissione di soli 50 satoshi.</translation>
+ </message>
+ <message>
<source>per kilobyte</source>
<translation>per kilobyte</translation>
</message>
@@ -2182,6 +2244,10 @@ Per specificare più URL separarli con una barra verticale "|".</translation>
<translation>Si puo' aumentare la commissione successivamente (segnalando Replace-By-Fee, BIP-125).</translation>
</message>
<message>
+ <source>Please, review your transaction.</source>
+ <translation>Per favore, rivedi la tua transazione.</translation>
+ </message>
+ <message>
<source>Transaction fee</source>
<translation>Commissione transazione</translation>
</message>
@@ -2190,6 +2256,10 @@ Per specificare più URL separarli con una barra verticale "|".</translation>
<translation>Senza segnalare Replace-By-Fee, BIP-125.</translation>
</message>
<message>
+ <source>Total Amount</source>
+ <translation>Importo totale</translation>
+ </message>
+ <message>
<source>Confirm send coins</source>
<translation>Conferma invio coins</translation>
</message>
@@ -2639,6 +2709,10 @@ Per specificare più URL separarli con una barra verticale "|".</translation>
<translation>Dimensione totale della transazione</translation>
</message>
<message>
+ <source>Transaction virtual size</source>
+ <translation>Dimensione virtuale della transazione</translation>
+ </message>
+ <message>
<source>Output index</source>
<translation>Indice di output</translation>
</message>
@@ -3039,7 +3113,11 @@ Per specificare più URL separarli con una barra verticale "|".</translation>
<source>The wallet data was successfully saved to %1.</source>
<translation>Il portamonete è stato correttamente salvato in %1.</translation>
</message>
- </context>
+ <message>
+ <source>Cancel</source>
+ <translation>Annulla</translation>
+ </message>
+</context>
<context>
<name>bitcoin-core</name>
<message>
@@ -3227,6 +3305,10 @@ Per specificare più URL separarli con una barra verticale "|".</translation>
<translation>Importo non valido per -fallbackfee=&lt;amount&gt;: '%s'</translation>
</message>
<message>
+ <source>Upgrading txindex database</source>
+ <translation>Aggiornamento del database txindex</translation>
+ </message>
+ <message>
<source>Loading P2P addresses...</source>
<translation>Caricamento indirizzi P2P...</translation>
</message>
@@ -3267,6 +3349,10 @@ Per specificare più URL separarli con una barra verticale "|".</translation>
<translation>Impossibile collegarsi a %s su questo computer. Probabilmente %s è già in esecuzione.</translation>
</message>
<message>
+ <source>Unable to generate keys</source>
+ <translation>Impossibile generare le chiavi</translation>
+ </message>
+ <message>
<source>Unsupported argument -benchmark ignored, use -debug=bench.</source>
<translation>Ignorata opzione -benchmark non supportata, utilizzare -debug=bench.</translation>
</message>
@@ -3503,6 +3589,18 @@ Per specificare più URL separarli con una barra verticale "|".</translation>
<translation>Fondi insufficienti</translation>
</message>
<message>
+ <source>Can't generate a change-address key. Private keys are disabled for this wallet.</source>
+ <translation>Impossibile generare una chiave di indirizzo di modifica. Le chiavi private sono disabilitate per questo portafoglio.</translation>
+ </message>
+ <message>
+ <source>Cannot upgrade a non HD split wallet without upgrading to support pre split keypool. Please use -upgradewallet=169900 or -upgradewallet with no version specified.</source>
+ <translation>Impossibile aggiornare un portafoglio diviso non HD senza aggiornamento per supportare il keypool pre-split. Si prega di utilizzare -upgradewallet = 169900 o -upgradewallet senza specificare la versione.</translation>
+ </message>
+ <message>
+ <source>Fee estimation failed. Fallbackfee is disabled. Wait a few blocks or enable -fallbackfee.</source>
+ <translation>Stima della commissione non riuscita. Fallbackfee è disabilitato. Attendi qualche blocco o abilita -fallbackfee.</translation>
+ </message>
+ <message>
<source>Loading block index...</source>
<translation>Caricamento dell'indice dei blocchi...</translation>
</message>
diff --git a/src/qt/locale/bitcoin_ja.ts b/src/qt/locale/bitcoin_ja.ts
index 9a068fae1f..7650694e15 100644
--- a/src/qt/locale/bitcoin_ja.ts
+++ b/src/qt/locale/bitcoin_ja.ts
@@ -47,7 +47,7 @@
</message>
<message>
<source>Choose the address to send coins to</source>
- <translation>先のアドレスを選択</translation>
+ <translation>送信先のアドレスを選択</translation>
</message>
<message>
<source>Choose the address to receive coins with</source>
diff --git a/src/qt/locale/bitcoin_ru.ts b/src/qt/locale/bitcoin_ru.ts
index 8ec2d335c7..0cbee61fc5 100644
--- a/src/qt/locale/bitcoin_ru.ts
+++ b/src/qt/locale/bitcoin_ru.ts
@@ -140,6 +140,10 @@
<translation>Показать пароль</translation>
</message>
<message>
+ <source>Enter the new passphrase to the wallet.&lt;br/&gt;Please use a passphrase of &lt;b&gt;ten or more random characters&lt;/b&gt;, or &lt;b&gt;eight or more words&lt;/b&gt;.</source>
+ <translation>Введите новый пароль бумажника.&lt;br/&gt;Используйте пароль, состоящий из &lt;b&gt;десяти или более случайных символов&lt;/b&gt;, или &lt;b&gt;восьми или более слов&lt;/b&gt;.</translation>
+ </message>
+ <message>
<source>Encrypt wallet</source>
<translation>Зашифровать электронный кошелёк</translation>
</message>
@@ -152,6 +156,10 @@
<translation>Разблокировать бумажник</translation>
</message>
<message>
+ <source>This operation needs your wallet passphrase to decrypt the wallet.</source>
+ <translation>Данная операция требует введения пароля для расшифровки вашего бумажника.</translation>
+ </message>
+ <message>
<source>Decrypt wallet</source>
<translation>Расшифровать бумажник</translation>
</message>
@@ -168,6 +176,10 @@
<translation>Подтвердить шифрование кошелька</translation>
</message>
<message>
+ <source>Warning: If you encrypt your wallet and lose your passphrase, you will &lt;b&gt;LOSE ALL OF YOUR BITCOINS&lt;/b&gt;!</source>
+ <translation>Предупреждение: если вы зашифруете бумажник и потеряете пароль, вы &lt;b&gt;ПОТЕРЯЕТЕ ВСЕ ВАШИ БИТКОИНЫ&lt;/b&gt;!</translation>
+ </message>
+ <message>
<source>Are you sure you wish to encrypt your wallet?</source>
<translation>Вы уверены, что хотите зашифровать ваш кошелёк?</translation>
</message>
@@ -176,6 +188,14 @@
<translation>Кошелёк зашифрован</translation>
</message>
<message>
+ <source>Wallet encryption failed</source>
+ <translation>Не удалось зашифровать бумажник</translation>
+ </message>
+ <message>
+ <source>Wallet unlock failed</source>
+ <translation>Разблокировка бумажника не удалась</translation>
+ </message>
+ <message>
<source>Wallet decryption failed</source>
<translation>Расшифровка кошелька не удалась</translation>
</message>
diff --git a/src/qt/locale/bitcoin_ru_RU.ts b/src/qt/locale/bitcoin_ru_RU.ts
index 80fa585e46..ea30f39969 100644
--- a/src/qt/locale/bitcoin_ru_RU.ts
+++ b/src/qt/locale/bitcoin_ru_RU.ts
@@ -478,6 +478,10 @@
<translation>Подключение к пирам...</translation>
</message>
<message>
+ <source>Catching up...</source>
+ <translation>Синхронизация...</translation>
+ </message>
+ <message>
<source>Date: %1
</source>
<translation>Дата: %1
@@ -617,10 +621,30 @@
<translation>Копировать ID транзакции</translation>
</message>
<message>
+ <source>Lock unspent</source>
+ <translation>Заблокировать непотраченное</translation>
+ </message>
+ <message>
+ <source>Unlock unspent</source>
+ <translation>Разблокировать непотраченное</translation>
+ </message>
+ <message>
<source>Copy quantity</source>
<translation>Копировать количество</translation>
</message>
<message>
+ <source>Copy fee</source>
+ <translation>Скопировать комиссию</translation>
+ </message>
+ <message>
+ <source>Copy after fee</source>
+ <translation>Скопировать после комиссии</translation>
+ </message>
+ <message>
+ <source>Copy bytes</source>
+ <translation>Скопировать байты</translation>
+ </message>
+ <message>
<source>Copy dust</source>
<translation>Скопировать пыль</translation>
</message>
@@ -756,6 +780,14 @@
<translation>Форма</translation>
</message>
<message>
+ <source>Recent transactions may not yet be visible, and therefore your wallet's balance might be incorrect. This information will be correct once your wallet has finished synchronizing with the bitcoin network, as detailed below.</source>
+ <translation>Последние транзакции пока могут быть не видны, поэтому вы можете видеть некорректный баланс ваших кошельков. Отображаемая информация будет верна после завершения синхронизации. Прогресс синхронизации вы можете видеть ниже.</translation>
+ </message>
+ <message>
+ <source>Attempting to spend bitcoins that are affected by not-yet-displayed transactions will not be accepted by the network.</source>
+ <translation>Попытка потратить средства, использованные в транзакциях, которые ещё не синхронизированы, будет отклонена сетью.</translation>
+ </message>
+ <message>
<source>Number of blocks left</source>
<translation>Количество оставшихся блоков</translation>
</message>
@@ -772,6 +804,10 @@
<translation>Прогресс</translation>
</message>
<message>
+ <source>Progress increase per hour</source>
+ <translation>Прогресс за час</translation>
+ </message>
+ <message>
<source>calculating...</source>
<translation>выполняется вычисление...</translation>
</message>
@@ -783,7 +819,11 @@
<source>Hide</source>
<translation>Спрятать</translation>
</message>
- </context>
+ <message>
+ <source>Unknown. Syncing Headers (%1)...</source>
+ <translation>Не известно. Синхронизация заголовков (%1)...</translation>
+ </message>
+</context>
<context>
<name>OpenURIDialog</name>
<message>
@@ -794,7 +834,15 @@
<source>URI:</source>
<translation>URI:</translation>
</message>
- </context>
+ <message>
+ <source>Select payment request file</source>
+ <translation>Выберите файл запроса платежа</translation>
+ </message>
+ <message>
+ <source>Select payment request file to open</source>
+ <translation>Выберите файл запроса платежа для открытия</translation>
+ </message>
+</context>
<context>
<name>OptionsDialog</name>
<message>
@@ -1231,6 +1279,14 @@
<translation>Версия</translation>
</message>
<message>
+ <source>Synced Headers</source>
+ <translation>Синхронизировано заголовков</translation>
+ </message>
+ <message>
+ <source>Synced Blocks</source>
+ <translation>Синхронизировано блоков</translation>
+ </message>
+ <message>
<source>User Agent</source>
<translation>Пользовательский агент</translation>
</message>
@@ -1247,6 +1303,26 @@
<translation>Сервисы</translation>
</message>
<message>
+ <source>Connection Time</source>
+ <translation>Время соединения</translation>
+ </message>
+ <message>
+ <source>Last Send</source>
+ <translation>Последние отправленные</translation>
+ </message>
+ <message>
+ <source>Last Receive</source>
+ <translation>Последние полученные</translation>
+ </message>
+ <message>
+ <source>Ping Time</source>
+ <translation>Время отклика Ping</translation>
+ </message>
+ <message>
+ <source>Min Ping</source>
+ <translation>Минимальное время отклика Ping</translation>
+ </message>
+ <message>
<source>Last block time</source>
<translation>Время последнего блока</translation>
</message>
@@ -1259,6 +1335,18 @@
<translation>&amp;Консоль</translation>
</message>
<message>
+ <source>&amp;Network Traffic</source>
+ <translation>&amp;Сетевой трафик</translation>
+ </message>
+ <message>
+ <source>In:</source>
+ <translation>Вход:</translation>
+ </message>
+ <message>
+ <source>Out:</source>
+ <translation>Выход:</translation>
+ </message>
+ <message>
<source>1 &amp;hour</source>
<translation>1 &amp;час</translation>
</message>
@@ -1302,6 +1390,14 @@
<context>
<name>ReceiveCoinsDialog</name>
<message>
+ <source>&amp;Label:</source>
+ <translation>&amp;Метка:</translation>
+ </message>
+ <message>
+ <source>&amp;Message:</source>
+ <translation>&amp;Сообщение:</translation>
+ </message>
+ <message>
<source>Clear all fields of the form.</source>
<translation>Очистить все поля формы.</translation>
</message>
@@ -1310,6 +1406,14 @@
<translation>Отчистить</translation>
</message>
<message>
+ <source>Requested payments history</source>
+ <translation>История платежных запросов</translation>
+ </message>
+ <message>
+ <source>&amp;Request payment</source>
+ <translation>&amp;Запросить платеж</translation>
+ </message>
+ <message>
<source>Show the selected request (does the same as double clicking an entry)</source>
<translation>Отобразить выбранный запрос (выполняет то же, что и двойной щелчок на записи)</translation>
</message>
@@ -1349,6 +1453,14 @@
<translation>QR-код</translation>
</message>
<message>
+ <source>Copy &amp;URI</source>
+ <translation>Копировать &amp;URI</translation>
+ </message>
+ <message>
+ <source>Copy &amp;Address</source>
+ <translation>Копировать &amp;Адрес</translation>
+ </message>
+ <message>
<source>&amp;Save Image...</source>
<translation>&amp;Сохранить изображение...</translation>
</message>
@@ -1357,6 +1469,10 @@
<translation>Информация о платеже</translation>
</message>
<message>
+ <source>URI</source>
+ <translation>URI</translation>
+ </message>
+ <message>
<source>Address</source>
<translation>Адрес</translation>
</message>
@@ -1403,7 +1519,15 @@
<source>(no message)</source>
<translation>(нет сообщений)</translation>
</message>
- </context>
+ <message>
+ <source>(no amount requested)</source>
+ <translation>(не указана запрашиваемая сумма)</translation>
+ </message>
+ <message>
+ <source>Requested</source>
+ <translation>Запрошено</translation>
+ </message>
+</context>
<context>
<name>SendCoinsDialog</name>
<message>
@@ -1411,10 +1535,22 @@
<translation>Отправить монеты</translation>
</message>
<message>
+ <source>Coin Control Features</source>
+ <translation>Опции управления монетами</translation>
+ </message>
+ <message>
+ <source>Inputs...</source>
+ <translation>Входы...</translation>
+ </message>
+ <message>
<source>automatically selected</source>
<translation>выбрано автоматически</translation>
</message>
<message>
+ <source>Insufficient funds!</source>
+ <translation>Недостаточно средств!</translation>
+ </message>
+ <message>
<source>Quantity:</source>
<translation>Количество:</translation>
</message>
@@ -1439,6 +1575,10 @@
<translation>Сдача:</translation>
</message>
<message>
+ <source>Custom change address</source>
+ <translation>Указать адрес для сдачи</translation>
+ </message>
+ <message>
<source>Transaction Fee:</source>
<translation>Комиссия за транзакцию:</translation>
</message>
@@ -1447,6 +1587,18 @@
<translation>Выбрать...</translation>
</message>
<message>
+ <source>Warning: Fee estimation is currently not possible.</source>
+ <translation>Предупреждение: оценка комиссии в данный момент невозможна.</translation>
+ </message>
+ <message>
+ <source>collapse fee-settings</source>
+ <translation>свернуть настройки комиссионных</translation>
+ </message>
+ <message>
+ <source>per kilobyte</source>
+ <translation>за килобайт</translation>
+ </message>
+ <message>
<source>Hide</source>
<translation>Спрятать</translation>
</message>
@@ -1463,6 +1615,10 @@
<translation>Отправить нескольким получателям сразу</translation>
</message>
<message>
+ <source>Add &amp;Recipient</source>
+ <translation>Добавить &amp;получателя</translation>
+ </message>
+ <message>
<source>Clear all fields of the form.</source>
<translation>Очистить все поля формы.</translation>
</message>
@@ -1471,6 +1627,14 @@
<translation>Пыль:</translation>
</message>
<message>
+ <source>Confirmation time target:</source>
+ <translation>Целевое время подтверждения</translation>
+ </message>
+ <message>
+ <source>Enable Replace-By-Fee</source>
+ <translation>Включить Replace-By-Fee</translation>
+ </message>
+ <message>
<source>Balance:</source>
<translation>Баланс:</translation>
</message>
@@ -1483,6 +1647,18 @@
<translation>Копировать сумму</translation>
</message>
<message>
+ <source>Copy fee</source>
+ <translation>Скопировать комиссию</translation>
+ </message>
+ <message>
+ <source>Copy after fee</source>
+ <translation>Скопировать после комиссии</translation>
+ </message>
+ <message>
+ <source>Copy bytes</source>
+ <translation>Скопировать байты</translation>
+ </message>
+ <message>
<source>Copy dust</source>
<translation>Скопировать пыль</translation>
</message>
@@ -1538,6 +1714,10 @@
<context>
<name>SendCoinsEntry</name>
<message>
+ <source>&amp;Label:</source>
+ <translation>&amp;Метка:</translation>
+ </message>
+ <message>
<source>Choose previously used address</source>
<translation>Выбрать предыдущий использованный адрес</translation>
</message>
diff --git a/src/qt/locale/bitcoin_sl_SI.ts b/src/qt/locale/bitcoin_sl_SI.ts
index df8add04a9..91080a774a 100644
--- a/src/qt/locale/bitcoin_sl_SI.ts
+++ b/src/qt/locale/bitcoin_sl_SI.ts
@@ -175,7 +175,55 @@
<source>Warning: If you encrypt your wallet and lose your passphrase, you will &lt;b&gt;LOSE ALL OF YOUR BITCOINS&lt;/b&gt;!</source>
<translation>Opozorilo: V primeru izgube gesla šifrirane denarnice, boste &lt;b&gt;IZGUBILI VSE SVOJE BITCOINE&lt;/b&gt;!</translation>
</message>
- </context>
+ <message>
+ <source>Are you sure you wish to encrypt your wallet?</source>
+ <translation>Ali ste prepričani, da želite šifrirati svojo denarnico?</translation>
+ </message>
+ <message>
+ <source>Wallet encrypted</source>
+ <translation>Denarnica šifrirana</translation>
+ </message>
+ <message>
+ <source>%1 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>%1 se bo zaprl, da bi dokončal postopek šifriranja. Zapomnite si, da šifriranje vaše denarnice vaših ne more popolnoma zaščititi vaših bitcoinov pred krajami zlonamernih programov, ki bi lahko bili nameščeni na vašem računalniku.</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>POMEMBNO: Vse starejše varnostne kopije denarnice je potrebno zamenjati z novoizdelano, šifrirano, varnostno kopijo. Zaradi varnosti bodo stare varnostne kopije postale neuporabne takoj, ko začnete uporabljati novo, šifrirano denarnico.</translation>
+ </message>
+ <message>
+ <source>Wallet encryption failed</source>
+ <translation>Šifriranje denarnice ni uspelo</translation>
+ </message>
+ <message>
+ <source>Wallet encryption failed due to an internal error. Your wallet was not encrypted.</source>
+ <translation>Šifriranje denarnice ni uspelo zaradi notranje napake. Vaša denarnica ni bila šifrirana.</translation>
+ </message>
+ <message>
+ <source>The supplied passphrases do not match.</source>
+ <translation>Navedeni gesli se ne ujemata.</translation>
+ </message>
+ <message>
+ <source>Wallet unlock failed</source>
+ <translation>Denarnice ni bilo mogoče odkleniti.</translation>
+ </message>
+ <message>
+ <source>The passphrase entered for the wallet decryption was incorrect.</source>
+ <translation>Geslo za dešifriranje denarnice, ki ste ga vnesli, ni pravilno.</translation>
+ </message>
+ <message>
+ <source>Wallet decryption failed</source>
+ <translation>Dešifriranje denarnice ni uspelo</translation>
+ </message>
+ <message>
+ <source>Wallet passphrase was successfully changed.</source>
+ <translation>Geslo za dostop do denarnice je bilo uspešno spremenjeno.</translation>
+ </message>
+ <message>
+ <source>Warning: The Caps Lock key is on!</source>
+ <translation>Opozorilo: Vključena je tipka Caps Lock!</translation>
+ </message>
+</context>
<context>
<name>BanTableModel</name>
<message>
@@ -226,6 +274,14 @@
<translation>Ustavite program</translation>
</message>
<message>
+ <source>&amp;About %1</source>
+ <translation>&amp;O nas%1</translation>
+ </message>
+ <message>
+ <source>Show information about %1</source>
+ <translation>Prikaži informacije o %1</translation>
+ </message>
+ <message>
<source>About &amp;Qt</source>
<translation>O &amp;Qt</translation>
</message>
@@ -238,6 +294,10 @@
<translation>&amp;Možnosti ...</translation>
</message>
<message>
+ <source>Modify configuration options for %1</source>
+ <translation>Spremeni možnosti konfiguracije za %1</translation>
+ </message>
+ <message>
<source>&amp;Encrypt Wallet...</source>
<translation>&amp;Šifriraj denarnico ...</translation>
</message>
@@ -262,10 +322,38 @@
<translation>Odpri &amp;URI ...</translation>
</message>
<message>
+ <source>Wallet:</source>
+ <translation>Denarnica:</translation>
+ </message>
+ <message>
+ <source>default wallet</source>
+ <translation>privzeta denarnica</translation>
+ </message>
+ <message>
+ <source>Click to disable network activity.</source>
+ <translation>Kliknite, da onemogočite omrežno aktivnosti.</translation>
+ </message>
+ <message>
+ <source>Network activity disabled.</source>
+ <translation>Omrežna aktivnost onemogočena.</translation>
+ </message>
+ <message>
+ <source>Click to enable network activity again.</source>
+ <translation>Kliknite, da ponovno vključite omrežno aktivnost.</translation>
+ </message>
+ <message>
+ <source>Syncing Headers (%1%)...</source>
+ <translation>Sinhronizacija glav (%1%)...</translation>
+ </message>
+ <message>
<source>Reindexing blocks on disk...</source>
<translation>Poustvarjam kazalo blokov na disku ...</translation>
</message>
<message>
+ <source>Proxy is &lt;b&gt;enabled&lt;/b&gt;: %1</source>
+ <translation>Namestniški strežnik je omogočen&lt;/b&gt;: %1</translation>
+ </message>
+ <message>
<source>Send coins to a Bitcoin address</source>
<translation>Izvedite plačilo na naslov Bitcoin</translation>
</message>
@@ -1161,6 +1249,10 @@
<translation>Počisti konzolo</translation>
</message>
<message>
+ <source>default wallet</source>
+ <translation>privzeta denarnica</translation>
+ </message>
+ <message>
<source>via %1</source>
<translation>preko %1</translation>
</message>
diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp
index 8bf6030833..51bc218d39 100644
--- a/src/rpc/blockchain.cpp
+++ b/src/rpc/blockchain.cpp
@@ -1640,6 +1640,35 @@ static T CalculateTruncatedMedian(std::vector<T>& scores)
}
}
+void CalculatePercentilesByWeight(CAmount result[NUM_GETBLOCKSTATS_PERCENTILES], std::vector<std::pair<CAmount, int64_t>>& scores, int64_t total_weight)
+{
+ if (scores.empty()) {
+ return;
+ }
+
+ std::sort(scores.begin(), scores.end());
+
+ // 10th, 25th, 50th, 75th, and 90th percentile weight units.
+ const double weights[NUM_GETBLOCKSTATS_PERCENTILES] = {
+ total_weight / 10.0, total_weight / 4.0, total_weight / 2.0, (total_weight * 3.0) / 4.0, (total_weight * 9.0) / 10.0
+ };
+
+ int64_t next_percentile_index = 0;
+ int64_t cumulative_weight = 0;
+ for (const auto& element : scores) {
+ cumulative_weight += element.second;
+ while (next_percentile_index < NUM_GETBLOCKSTATS_PERCENTILES && cumulative_weight >= weights[next_percentile_index]) {
+ result[next_percentile_index] = element.first;
+ ++next_percentile_index;
+ }
+ }
+
+ // Fill any remaining percentiles with the last value.
+ for (int64_t i = next_percentile_index; i < NUM_GETBLOCKSTATS_PERCENTILES; i++) {
+ result[i] = scores.back().first;
+ }
+}
+
template<typename T>
static inline bool SetHasKeys(const std::set<T>& set) {return false;}
template<typename T, typename Tk, typename... Args>
@@ -1673,13 +1702,19 @@ static UniValue getblockstats(const JSONRPCRequest& request)
" \"avgfeerate\": xxxxx, (numeric) Average feerate (in satoshis per virtual byte)\n"
" \"avgtxsize\": xxxxx, (numeric) Average transaction size\n"
" \"blockhash\": xxxxx, (string) The block hash (to check for potential reorgs)\n"
+ " \"feerate_percentiles\": [ (array of numeric) Feerates at the 10th, 25th, 50th, 75th, and 90th percentile weight unit (in satoshis per virtual byte)\n"
+ " \"10th_percentile_feerate\", (numeric) The 10th percentile feerate\n"
+ " \"25th_percentile_feerate\", (numeric) The 25th percentile feerate\n"
+ " \"50th_percentile_feerate\", (numeric) The 50th percentile feerate\n"
+ " \"75th_percentile_feerate\", (numeric) The 75th percentile feerate\n"
+ " \"90th_percentile_feerate\", (numeric) The 90th percentile feerate\n"
+ " ],\n"
" \"height\": xxxxx, (numeric) The height of the block\n"
" \"ins\": xxxxx, (numeric) The number of inputs (excluding coinbase)\n"
" \"maxfee\": xxxxx, (numeric) Maximum fee in the block\n"
" \"maxfeerate\": xxxxx, (numeric) Maximum feerate (in satoshis per virtual byte)\n"
" \"maxtxsize\": xxxxx, (numeric) Maximum transaction size\n"
" \"medianfee\": xxxxx, (numeric) Truncated median fee in the block\n"
- " \"medianfeerate\": xxxxx, (numeric) Truncated median feerate (in satoshis per virtual byte)\n"
" \"mediantime\": xxxxx, (numeric) The block median time past\n"
" \"mediantxsize\": xxxxx, (numeric) Truncated median transaction size\n"
" \"minfee\": xxxxx, (numeric) Minimum fee in the block\n"
@@ -1747,13 +1782,13 @@ static UniValue getblockstats(const JSONRPCRequest& request)
const bool do_all = stats.size() == 0; // Calculate everything if nothing selected (default)
const bool do_mediantxsize = do_all || stats.count("mediantxsize") != 0;
const bool do_medianfee = do_all || stats.count("medianfee") != 0;
- const bool do_medianfeerate = do_all || stats.count("medianfeerate") != 0;
- const bool loop_inputs = do_all || do_medianfee || do_medianfeerate ||
+ const bool do_feerate_percentiles = do_all || stats.count("feerate_percentiles") != 0;
+ const bool loop_inputs = do_all || do_medianfee || do_feerate_percentiles ||
SetHasKeys(stats, "utxo_size_inc", "totalfee", "avgfee", "avgfeerate", "minfee", "maxfee", "minfeerate", "maxfeerate");
const bool loop_outputs = do_all || loop_inputs || stats.count("total_out");
const bool do_calculate_size = do_mediantxsize ||
SetHasKeys(stats, "total_size", "avgtxsize", "mintxsize", "maxtxsize", "swtotal_size");
- const bool do_calculate_weight = do_all || SetHasKeys(stats, "total_weight", "avgfeerate", "swtotal_weight", "avgfeerate", "medianfeerate", "minfeerate", "maxfeerate");
+ const bool do_calculate_weight = do_all || SetHasKeys(stats, "total_weight", "avgfeerate", "swtotal_weight", "avgfeerate", "feerate_percentiles", "minfeerate", "maxfeerate");
const bool do_calculate_sw = do_all || SetHasKeys(stats, "swtxs", "swtotal_size", "swtotal_weight");
CAmount maxfee = 0;
@@ -1773,7 +1808,7 @@ static UniValue getblockstats(const JSONRPCRequest& request)
int64_t total_weight = 0;
int64_t utxo_size_inc = 0;
std::vector<CAmount> fee_array;
- std::vector<CAmount> feerate_array;
+ std::vector<std::pair<CAmount, int64_t>> feerate_array;
std::vector<int64_t> txsize_array;
for (const auto& tx : block.vtx) {
@@ -1848,26 +1883,34 @@ static UniValue getblockstats(const JSONRPCRequest& request)
// New feerate uses satoshis per virtual byte instead of per serialized byte
CAmount feerate = weight ? (txfee * WITNESS_SCALE_FACTOR) / weight : 0;
- if (do_medianfeerate) {
- feerate_array.push_back(feerate);
+ if (do_feerate_percentiles) {
+ feerate_array.emplace_back(std::make_pair(feerate, weight));
}
maxfeerate = std::max(maxfeerate, feerate);
minfeerate = std::min(minfeerate, feerate);
}
}
+ CAmount feerate_percentiles[NUM_GETBLOCKSTATS_PERCENTILES] = { 0 };
+ CalculatePercentilesByWeight(feerate_percentiles, feerate_array, total_weight);
+
+ UniValue feerates_res(UniValue::VARR);
+ for (int64_t i = 0; i < NUM_GETBLOCKSTATS_PERCENTILES; i++) {
+ feerates_res.push_back(feerate_percentiles[i]);
+ }
+
UniValue ret_all(UniValue::VOBJ);
ret_all.pushKV("avgfee", (block.vtx.size() > 1) ? totalfee / (block.vtx.size() - 1) : 0);
ret_all.pushKV("avgfeerate", total_weight ? (totalfee * WITNESS_SCALE_FACTOR) / total_weight : 0); // Unit: sat/vbyte
ret_all.pushKV("avgtxsize", (block.vtx.size() > 1) ? total_size / (block.vtx.size() - 1) : 0);
ret_all.pushKV("blockhash", pindex->GetBlockHash().GetHex());
+ ret_all.pushKV("feerate_percentiles", feerates_res);
ret_all.pushKV("height", (int64_t)pindex->nHeight);
ret_all.pushKV("ins", inputs);
ret_all.pushKV("maxfee", maxfee);
ret_all.pushKV("maxfeerate", maxfeerate);
ret_all.pushKV("maxtxsize", maxtxsize);
ret_all.pushKV("medianfee", CalculateTruncatedMedian(fee_array));
- ret_all.pushKV("medianfeerate", CalculateTruncatedMedian(feerate_array));
ret_all.pushKV("mediantime", pindex->GetMedianTimePast());
ret_all.pushKV("mediantxsize", CalculateTruncatedMedian(txsize_array));
ret_all.pushKV("minfee", (minfee == MAX_MONEY) ? 0 : minfee);
diff --git a/src/rpc/blockchain.h b/src/rpc/blockchain.h
index c664139ed3..544bc62c36 100644
--- a/src/rpc/blockchain.h
+++ b/src/rpc/blockchain.h
@@ -5,10 +5,16 @@
#ifndef BITCOIN_RPC_BLOCKCHAIN_H
#define BITCOIN_RPC_BLOCKCHAIN_H
+#include <vector>
+#include <stdint.h>
+#include <amount.h>
+
class CBlock;
class CBlockIndex;
class UniValue;
+static constexpr int NUM_GETBLOCKSTATS_PERCENTILES = 5;
+
/**
* Get the difficulty of the net wrt to the given block index, or the chain tip if
* not provided.
@@ -33,4 +39,7 @@ UniValue mempoolToJSON(bool fVerbose = false);
/** Block header to JSON */
UniValue blockheaderToJSON(const CBlockIndex* blockindex);
+/** Used by getblockstats to get feerates at different percentiles by weight */
+void CalculatePercentilesByWeight(CAmount result[NUM_GETBLOCKSTATS_PERCENTILES], std::vector<std::pair<CAmount, int64_t>>& scores, int64_t total_weight);
+
#endif
diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp
index 28ade1f458..608a1b5da2 100644
--- a/src/rpc/rawtransaction.cpp
+++ b/src/rpc/rawtransaction.cpp
@@ -1662,12 +1662,12 @@ UniValue finalizepsbt(const JSONRPCRequest& request)
mtx.vin[i].scriptWitness = psbtx.inputs[i].final_script_witness;
}
ssTx << mtx;
- result.push_back(Pair("hex", HexStr(ssTx.begin(), ssTx.end())));
+ result.pushKV("hex", HexStr(ssTx.begin(), ssTx.end()));
} else {
ssTx << psbtx;
- result.push_back(Pair("psbt", EncodeBase64((unsigned char*)ssTx.data(), ssTx.size())));
+ result.pushKV("psbt", EncodeBase64((unsigned char*)ssTx.data(), ssTx.size()));
}
- result.push_back(Pair("complete", complete));
+ result.pushKV("complete", complete);
return result;
}
diff --git a/src/script/sign.cpp b/src/script/sign.cpp
index 65b5bf7aeb..1e4102c20f 100644
--- a/src/script/sign.cpp
+++ b/src/script/sign.cpp
@@ -417,22 +417,25 @@ public:
const DummySignatureChecker DUMMY_CHECKER;
class DummySignatureCreator final : public BaseSignatureCreator {
+private:
+ char m_r_len = 32;
+ char m_s_len = 32;
public:
- DummySignatureCreator() {}
+ DummySignatureCreator(char r_len, char s_len) : m_r_len(r_len), m_s_len(s_len) {}
const BaseSignatureChecker& Checker() const override { return DUMMY_CHECKER; }
bool CreateSig(const SigningProvider& provider, std::vector<unsigned char>& vchSig, const CKeyID& keyid, const CScript& scriptCode, SigVersion sigversion) const override
{
// Create a dummy signature that is a valid DER-encoding
- vchSig.assign(72, '\000');
+ vchSig.assign(m_r_len + m_s_len + 7, '\000');
vchSig[0] = 0x30;
- vchSig[1] = 69;
+ vchSig[1] = m_r_len + m_s_len + 4;
vchSig[2] = 0x02;
- vchSig[3] = 33;
+ vchSig[3] = m_r_len;
vchSig[4] = 0x01;
- vchSig[4 + 33] = 0x02;
- vchSig[5 + 33] = 32;
- vchSig[6 + 33] = 0x01;
- vchSig[6 + 33 + 32] = SIGHASH_ALL;
+ vchSig[4 + m_r_len] = 0x02;
+ vchSig[5 + m_r_len] = m_s_len;
+ vchSig[6 + m_r_len] = 0x01;
+ vchSig[6 + m_r_len + m_s_len] = SIGHASH_ALL;
return true;
}
};
@@ -450,7 +453,8 @@ bool LookupHelper(const M& map, const K& key, V& value)
}
-const BaseSignatureCreator& DUMMY_SIGNATURE_CREATOR = DummySignatureCreator();
+const BaseSignatureCreator& DUMMY_SIGNATURE_CREATOR = DummySignatureCreator(32, 32);
+const BaseSignatureCreator& DUMMY_MAXIMUM_SIGNATURE_CREATOR = DummySignatureCreator(33, 32);
const SigningProvider& DUMMY_SIGNING_PROVIDER = SigningProvider();
bool IsSolvable(const SigningProvider& provider, const CScript& script)
diff --git a/src/script/sign.h b/src/script/sign.h
index 461aedc6da..24cddda51b 100644
--- a/src/script/sign.h
+++ b/src/script/sign.h
@@ -80,8 +80,10 @@ public:
bool CreateSig(const SigningProvider& provider, std::vector<unsigned char>& vchSig, const CKeyID& keyid, const CScript& scriptCode, SigVersion sigversion) const override;
};
-/** A signature creator that just produces 72-byte empty signatures. */
+/** A signature creator that just produces 71-byte empty signatures. */
extern const BaseSignatureCreator& DUMMY_SIGNATURE_CREATOR;
+/** A signature creator that just produces 72-byte empty signatures. */
+extern const BaseSignatureCreator& DUMMY_MAXIMUM_SIGNATURE_CREATOR;
typedef std::pair<CPubKey, std::vector<unsigned char>> SigPair;
diff --git a/src/test/key_tests.cpp b/src/test/key_tests.cpp
index d9c3525b19..61db70decb 100644
--- a/src/test/key_tests.cpp
+++ b/src/test/key_tests.cpp
@@ -152,4 +152,40 @@ BOOST_AUTO_TEST_CASE(key_test1)
BOOST_CHECK(detsigc == ParseHex("2052d8a32079c11e79db95af63bb9600c5b04f21a9ca33dc129c2bfa8ac9dc1cd561d8ae5e0f6c1a16bde3719c64c2fd70e404b6428ab9a69566962e8771b5944d"));
}
+BOOST_AUTO_TEST_CASE(key_signature_tests)
+{
+ // When entropy is specified, we should see at least one high R signature within 20 signatures
+ CKey key = DecodeSecret(strSecret1);
+ std::string msg = "A message to be signed";
+ uint256 msg_hash = Hash(msg.begin(), msg.end());
+ std::vector<unsigned char> sig;
+ bool found = false;
+
+ for (int i = 1; i <=20; ++i) {
+ sig.clear();
+ key.Sign(msg_hash, sig, false, i);
+ found = sig[3] == 0x21 && sig[4] == 0x00;
+ if (found) {
+ break;
+ }
+ }
+ BOOST_CHECK(found);
+
+ // When entropy is not specified, we should always see low R signatures that are less than 70 bytes in 256 tries
+ // We should see at least one signature that is less than 70 bytes.
+ found = true;
+ bool found_small = false;
+ for (int i = 0; i < 256; ++i) {
+ sig.clear();
+ std::string msg = "A message to be signed" + std::to_string(i);
+ msg_hash = Hash(msg.begin(), msg.end());
+ key.Sign(msg_hash, sig);
+ found = sig[3] == 0x20;
+ BOOST_CHECK(sig.size() <= 70);
+ found_small |= sig.size() < 70;
+ }
+ BOOST_CHECK(found);
+ BOOST_CHECK(found_small);
+}
+
BOOST_AUTO_TEST_SUITE_END()
diff --git a/src/test/rpc_tests.cpp b/src/test/rpc_tests.cpp
index d0f6fba78d..a49796d6f4 100644
--- a/src/test/rpc_tests.cpp
+++ b/src/test/rpc_tests.cpp
@@ -16,6 +16,8 @@
#include <univalue.h>
+#include <rpc/blockchain.h>
+
UniValue CallRPC(std::string args)
{
std::vector<std::string> vArgs;
@@ -336,4 +338,82 @@ BOOST_AUTO_TEST_CASE(rpc_convert_values_generatetoaddress)
BOOST_CHECK_EQUAL(result[2].get_int(), 9);
}
+BOOST_AUTO_TEST_CASE(rpc_getblockstats_calculate_percentiles_by_weight)
+{
+ int64_t total_weight = 200;
+ std::vector<std::pair<CAmount, int64_t>> feerates;
+ CAmount result[NUM_GETBLOCKSTATS_PERCENTILES] = { 0 };
+
+ for (int64_t i = 0; i < 100; i++) {
+ feerates.emplace_back(std::make_pair(1 ,1));
+ }
+
+ for (int64_t i = 0; i < 100; i++) {
+ feerates.emplace_back(std::make_pair(2 ,1));
+ }
+
+ CalculatePercentilesByWeight(result, feerates, total_weight);
+ BOOST_CHECK_EQUAL(result[0], 1);
+ BOOST_CHECK_EQUAL(result[1], 1);
+ BOOST_CHECK_EQUAL(result[2], 1);
+ BOOST_CHECK_EQUAL(result[3], 2);
+ BOOST_CHECK_EQUAL(result[4], 2);
+
+ // Test with more pairs, and two pairs overlapping 2 percentiles.
+ total_weight = 100;
+ CAmount result2[NUM_GETBLOCKSTATS_PERCENTILES] = { 0 };
+ feerates.clear();
+
+ feerates.emplace_back(std::make_pair(1, 9));
+ feerates.emplace_back(std::make_pair(2 , 16)); //10th + 25th percentile
+ feerates.emplace_back(std::make_pair(4 ,50)); //50th + 75th percentile
+ feerates.emplace_back(std::make_pair(5 ,10));
+ feerates.emplace_back(std::make_pair(9 ,15)); // 90th percentile
+
+ CalculatePercentilesByWeight(result2, feerates, total_weight);
+
+ BOOST_CHECK_EQUAL(result2[0], 2);
+ BOOST_CHECK_EQUAL(result2[1], 2);
+ BOOST_CHECK_EQUAL(result2[2], 4);
+ BOOST_CHECK_EQUAL(result2[3], 4);
+ BOOST_CHECK_EQUAL(result2[4], 9);
+
+ // Same test as above, but one of the percentile-overlapping pairs is split in 2.
+ total_weight = 100;
+ CAmount result3[NUM_GETBLOCKSTATS_PERCENTILES] = { 0 };
+ feerates.clear();
+
+ feerates.emplace_back(std::make_pair(1, 9));
+ feerates.emplace_back(std::make_pair(2 , 11)); // 10th percentile
+ feerates.emplace_back(std::make_pair(2 , 5)); // 25th percentile
+ feerates.emplace_back(std::make_pair(4 ,50)); //50th + 75th percentile
+ feerates.emplace_back(std::make_pair(5 ,10));
+ feerates.emplace_back(std::make_pair(9 ,15)); // 90th percentile
+
+ CalculatePercentilesByWeight(result3, feerates, total_weight);
+
+ BOOST_CHECK_EQUAL(result3[0], 2);
+ BOOST_CHECK_EQUAL(result3[1], 2);
+ BOOST_CHECK_EQUAL(result3[2], 4);
+ BOOST_CHECK_EQUAL(result3[3], 4);
+ BOOST_CHECK_EQUAL(result3[4], 9);
+
+ // Test with one transaction spanning all percentiles.
+ total_weight = 104;
+ CAmount result4[NUM_GETBLOCKSTATS_PERCENTILES] = { 0 };
+ feerates.clear();
+
+ feerates.emplace_back(std::make_pair(1, 100));
+ feerates.emplace_back(std::make_pair(2, 1));
+ feerates.emplace_back(std::make_pair(3, 1));
+ feerates.emplace_back(std::make_pair(3, 1));
+ feerates.emplace_back(std::make_pair(999999, 1));
+
+ CalculatePercentilesByWeight(result4, feerates, total_weight);
+
+ for (int64_t i = 0; i < NUM_GETBLOCKSTATS_PERCENTILES; i++) {
+ BOOST_CHECK_EQUAL(result4[i], 1);
+ }
+}
+
BOOST_AUTO_TEST_SUITE_END()
diff --git a/src/test/script_tests.cpp b/src/test/script_tests.cpp
index e56080b278..bc671394c0 100644
--- a/src/test/script_tests.cpp
+++ b/src/test/script_tests.cpp
@@ -369,7 +369,7 @@ public:
std::vector<unsigned char> vchSig, r, s;
uint32_t iter = 0;
do {
- key.Sign(hash, vchSig, iter++);
+ key.Sign(hash, vchSig, false, iter++);
if ((lenS == 33) != (vchSig[5 + vchSig[3]] == 33)) {
NegateSignatureS(vchSig);
}
diff --git a/src/wallet/rpcdump.cpp b/src/wallet/rpcdump.cpp
index 033588f558..5800e75827 100644
--- a/src/wallet/rpcdump.cpp
+++ b/src/wallet/rpcdump.cpp
@@ -115,7 +115,7 @@ UniValue importprivkey(const JSONRPCRequest& request)
"1. \"privkey\" (string, required) The private key (see dumpprivkey)\n"
"2. \"label\" (string, optional, default=\"\") An optional label\n"
"3. rescan (boolean, optional, default=true) Rescan the wallet for transactions\n"
- "\nNote: This call can take minutes to complete if rescan is true, during that time, other rpc calls\n"
+ "\nNote: This call can take over an hour to complete if rescan is true, during that time, other rpc calls\n"
"may report that the imported key exists but related transactions are still missing, leading to temporarily incorrect/bogus balances and unspent outputs until rescan completes.\n"
"\nExamples:\n"
"\nDump a private key\n"
@@ -268,7 +268,7 @@ UniValue importaddress(const JSONRPCRequest& request)
"2. \"label\" (string, optional, default=\"\") An optional label\n"
"3. rescan (boolean, optional, default=true) Rescan the wallet for transactions\n"
"4. p2sh (boolean, optional, default=false) Add the P2SH version of the script as well\n"
- "\nNote: This call can take minutes to complete if rescan is true, during that time, other rpc calls\n"
+ "\nNote: This call can take over an hour to complete if rescan is true, during that time, other rpc calls\n"
"may report that the imported address exists but related transactions are still missing, leading to temporarily incorrect/bogus balances and unspent outputs until rescan completes.\n"
"If you have the full public key, you should call importpubkey instead of this.\n"
"\nNote: If you import a non-standard raw script in hex form, outputs sending to it will be treated\n"
@@ -448,7 +448,7 @@ UniValue importpubkey(const JSONRPCRequest& request)
"1. \"pubkey\" (string, required) The hex-encoded public key\n"
"2. \"label\" (string, optional, default=\"\") An optional label\n"
"3. rescan (boolean, optional, default=true) Rescan the wallet for transactions\n"
- "\nNote: This call can take minutes to complete if rescan is true, during that time, other rpc calls\n"
+ "\nNote: This call can take over an hour to complete if rescan is true, during that time, other rpc calls\n"
"may report that the imported pubkey exists but related transactions are still missing, leading to temporarily incorrect/bogus balances and unspent outputs until rescan completes.\n"
"\nExamples:\n"
"\nImport a public key with rescan\n"
@@ -1158,7 +1158,7 @@ UniValue importmulti(const JSONRPCRequest& mainRequest)
" {\n"
" \"rescan\": <false>, (boolean, optional, default: true) Stating if should rescan the blockchain after all imports\n"
" }\n"
- "\nNote: This call can take minutes to complete if rescan is true, during that time, other rpc calls\n"
+ "\nNote: This call can take over an hour to complete if rescan is true, during that time, other rpc calls\n"
"may report that the imported keys, addresses or scripts exists but related transactions are still missing.\n"
"\nExamples:\n" +
HelpExampleCli("importmulti", "'[{ \"scriptPubKey\": { \"address\": \"<my address>\" }, \"timestamp\":1455191478 }, "
diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp
index 73dfebf114..4e539a85de 100644
--- a/src/wallet/rpcwallet.cpp
+++ b/src/wallet/rpcwallet.cpp
@@ -4630,8 +4630,8 @@ UniValue walletprocesspsbt(const JSONRPCRequest& request)
UniValue result(UniValue::VOBJ);
CDataStream ssTx(SER_NETWORK, PROTOCOL_VERSION);
ssTx << psbtx;
- result.push_back(Pair("psbt", EncodeBase64((unsigned char*)ssTx.data(), ssTx.size())));
- result.push_back(Pair("complete", complete));
+ result.pushKV("psbt", EncodeBase64((unsigned char*)ssTx.data(), ssTx.size()));
+ result.pushKV("complete", complete);
return result;
}
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp
index 597d108aef..5a7fdf9a85 100644
--- a/src/wallet/wallet.cpp
+++ b/src/wallet/wallet.cpp
@@ -35,6 +35,8 @@
#include <boost/algorithm/string/replace.hpp>
+static const size_t OUTPUT_GROUP_MAX_ENTRIES = 10;
+
static CCriticalSection cs_wallets;
static std::vector<std::shared_ptr<CWallet>> vpwallets GUARDED_BY(cs_wallets);
@@ -1540,30 +1542,29 @@ int64_t CWalletTx::GetTxTime() const
return n ? n : nTimeReceived;
}
-// Helper for producing a max-sized low-S signature (eg 72 bytes)
-bool CWallet::DummySignInput(CTxIn &tx_in, const CTxOut &txout) const
+// Helper for producing a max-sized low-S low-R signature (eg 71 bytes)
+// or a max-sized low-S signature (e.g. 72 bytes) if use_max_sig is true
+bool CWallet::DummySignInput(CTxIn &tx_in, const CTxOut &txout, bool use_max_sig) const
{
// Fill in dummy signatures for fee calculation.
const CScript& scriptPubKey = txout.scriptPubKey;
SignatureData sigdata;
- if (!ProduceSignature(*this, DUMMY_SIGNATURE_CREATOR, scriptPubKey, sigdata))
- {
+ if (!ProduceSignature(*this, use_max_sig ? DUMMY_MAXIMUM_SIGNATURE_CREATOR : DUMMY_SIGNATURE_CREATOR, scriptPubKey, sigdata)) {
return false;
- } else {
- UpdateInput(tx_in, sigdata);
}
+ UpdateInput(tx_in, sigdata);
return true;
}
-// Helper for producing a bunch of max-sized low-S signatures (eg 72 bytes)
-bool CWallet::DummySignTx(CMutableTransaction &txNew, const std::vector<CTxOut> &txouts) const
+// Helper for producing a bunch of max-sized low-S low-R signatures (eg 71 bytes)
+bool CWallet::DummySignTx(CMutableTransaction &txNew, const std::vector<CTxOut> &txouts, bool use_max_sig) const
{
// Fill in dummy signatures for fee calculation.
int nIn = 0;
for (const auto& txout : txouts)
{
- if (!DummySignInput(txNew.vin[nIn], txout)) {
+ if (!DummySignInput(txNew.vin[nIn], txout, use_max_sig)) {
return false;
}
@@ -1572,7 +1573,7 @@ bool CWallet::DummySignTx(CMutableTransaction &txNew, const std::vector<CTxOut>
return true;
}
-int64_t CalculateMaximumSignedTxSize(const CTransaction &tx, const CWallet *wallet)
+int64_t CalculateMaximumSignedTxSize(const CTransaction &tx, const CWallet *wallet, bool use_max_sig)
{
std::vector<CTxOut> txouts;
// Look up the inputs. We should have already checked that this transaction
@@ -1586,14 +1587,14 @@ int64_t CalculateMaximumSignedTxSize(const CTransaction &tx, const CWallet *wall
assert(input.prevout.n < mi->second.tx->vout.size());
txouts.emplace_back(mi->second.tx->vout[input.prevout.n]);
}
- return CalculateMaximumSignedTxSize(tx, wallet, txouts);
+ return CalculateMaximumSignedTxSize(tx, wallet, txouts, use_max_sig);
}
// txouts needs to be in the order of tx.vin
-int64_t CalculateMaximumSignedTxSize(const CTransaction &tx, const CWallet *wallet, const std::vector<CTxOut>& txouts)
+int64_t CalculateMaximumSignedTxSize(const CTransaction &tx, const CWallet *wallet, const std::vector<CTxOut>& txouts, bool use_max_sig)
{
CMutableTransaction txNew(tx);
- if (!wallet->DummySignTx(txNew, txouts)) {
+ if (!wallet->DummySignTx(txNew, txouts, use_max_sig)) {
// This should never happen, because IsAllFromMe(ISMINE_SPENDABLE)
// implies that we can sign for every input.
return -1;
@@ -1601,11 +1602,11 @@ int64_t CalculateMaximumSignedTxSize(const CTransaction &tx, const CWallet *wall
return GetVirtualTransactionSize(txNew);
}
-int CalculateMaximumSignedInputSize(const CTxOut& txout, const CWallet* wallet)
+int CalculateMaximumSignedInputSize(const CTxOut& txout, const CWallet* wallet, bool use_max_sig)
{
CMutableTransaction txn;
txn.vin.push_back(CTxIn(COutPoint()));
- if (!wallet->DummySignInput(txn.vin[0], txout)) {
+ if (!wallet->DummySignInput(txn.vin[0], txout, use_max_sig)) {
// This should never happen, because IsAllFromMe(ISMINE_SPENDABLE)
// implies that we can sign for every input.
return -1;
@@ -2332,7 +2333,7 @@ void CWallet::AvailableCoins(std::vector<COutput> &vCoins, bool fOnlySafe, const
bool solvable = IsSolvable(*this, pcoin->tx->vout[i].scriptPubKey);
bool spendable = ((mine & ISMINE_SPENDABLE) != ISMINE_NO) || (((mine & ISMINE_WATCH_ONLY) != ISMINE_NO) && (coinControl && coinControl->fAllowWatchOnly && solvable));
- vCoins.push_back(COutput(pcoin, i, nDepth, spendable, solvable, safeTx));
+ vCoins.push_back(COutput(pcoin, i, nDepth, spendable, solvable, safeTx, (coinControl && coinControl->fAllowWatchOnly)));
// Checks the sum amount of all UTXO's.
if (nMinimumSumAmount != MAX_MONEY) {
@@ -2525,6 +2526,12 @@ bool CWallet::SelectCoins(const std::vector<COutput>& vAvailableCoins, const CAm
// form groups from remaining coins; note that preset coins will not
// automatically have their associated (same address) coins included
+ if (coin_control.m_avoid_partial_spends && vCoins.size() > OUTPUT_GROUP_MAX_ENTRIES) {
+ // Cases where we have 11+ outputs all pointing to the same destination may result in
+ // privacy leaks as they will potentially be deterministically sorted. We solve that by
+ // explicitly shuffling the outputs before processing
+ std::shuffle(vCoins.begin(), vCoins.end(), FastRandomContext());
+ }
std::vector<OutputGroup> groups = GroupOutputs(vCoins, !coin_control.m_avoid_partial_spends);
size_t max_ancestors = (size_t)std::max<int64_t>(1, gArgs.GetArg("-limitancestorcount", DEFAULT_ANCESTOR_LIMIT));
@@ -2881,7 +2888,7 @@ bool CWallet::CreateTransaction(const std::vector<CRecipient>& vecSend, CTransac
txNew.vin.push_back(CTxIn(coin.outpoint,CScript()));
}
- nBytes = CalculateMaximumSignedTxSize(txNew, this);
+ nBytes = CalculateMaximumSignedTxSize(txNew, this, coin_control.fAllowWatchOnly);
if (nBytes < 0) {
strFailReason = _("Signing transaction failed");
return false;
@@ -4444,7 +4451,7 @@ std::vector<OutputGroup> CWallet::GroupOutputs(const std::vector<COutput>& outpu
// Limit output groups to no more than 10 entries, to protect
// against inadvertently creating a too-large transaction
// when using -avoidpartialspends
- if (gmap[dst].m_outputs.size() >= 10) {
+ if (gmap[dst].m_outputs.size() >= OUTPUT_GROUP_MAX_ENTRIES) {
groups.push_back(gmap[dst]);
gmap.erase(dst);
}
diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h
index ab3e38e807..57b22c0e49 100644
--- a/src/wallet/wallet.h
+++ b/src/wallet/wallet.h
@@ -276,7 +276,7 @@ public:
};
//Get the marginal bytes of spending the specified output
-int CalculateMaximumSignedInputSize(const CTxOut& txout, const CWallet* pwallet);
+int CalculateMaximumSignedInputSize(const CTxOut& txout, const CWallet* pwallet, bool use_max_sig = false);
/**
* A transaction with a bunch of additional info that only the owner cares about.
@@ -461,9 +461,9 @@ public:
CAmount GetChange() const;
// Get the marginal bytes if spending the specified output from this transaction
- int GetSpendSize(unsigned int out) const
+ int GetSpendSize(unsigned int out, bool use_max_sig = false) const
{
- return CalculateMaximumSignedInputSize(tx->vout[out], pwallet);
+ return CalculateMaximumSignedInputSize(tx->vout[out], pwallet, use_max_sig);
}
void GetAmounts(std::list<COutputEntry>& listReceived,
@@ -507,6 +507,9 @@ public:
/** Whether we know how to spend this output, ignoring the lack of keys */
bool fSolvable;
+ /** Whether to use the maximum sized, 72 byte signature when calculating the size of the input spend. This should only be set when watch-only outputs are allowed */
+ bool use_max_sig;
+
/**
* Whether this output is considered safe to spend. Unconfirmed transactions
* from outside keys and unconfirmed replacement transactions are considered
@@ -514,13 +517,13 @@ public:
*/
bool fSafe;
- COutput(const CWalletTx *txIn, int iIn, int nDepthIn, bool fSpendableIn, bool fSolvableIn, bool fSafeIn)
+ COutput(const CWalletTx *txIn, int iIn, int nDepthIn, bool fSpendableIn, bool fSolvableIn, bool fSafeIn, bool use_max_sig_in = false)
{
- tx = txIn; i = iIn; nDepth = nDepthIn; fSpendable = fSpendableIn; fSolvable = fSolvableIn; fSafe = fSafeIn; nInputBytes = -1;
+ tx = txIn; i = iIn; nDepth = nDepthIn; fSpendable = fSpendableIn; fSolvable = fSolvableIn; fSafe = fSafeIn; nInputBytes = -1; use_max_sig = use_max_sig_in;
// If known and signable by the given wallet, compute nInputBytes
// Failure will keep this value -1
if (fSpendable && tx) {
- nInputBytes = tx->GetSpendSize(i);
+ nInputBytes = tx->GetSpendSize(i, use_max_sig);
}
}
@@ -976,14 +979,14 @@ public:
void ListAccountCreditDebit(const std::string& strAccount, std::list<CAccountingEntry>& entries);
bool AddAccountingEntry(const CAccountingEntry&);
bool AddAccountingEntry(const CAccountingEntry&, WalletBatch *batch);
- bool DummySignTx(CMutableTransaction &txNew, const std::set<CTxOut> &txouts) const
+ bool DummySignTx(CMutableTransaction &txNew, const std::set<CTxOut> &txouts, bool use_max_sig = false) const
{
std::vector<CTxOut> v_txouts(txouts.size());
std::copy(txouts.begin(), txouts.end(), v_txouts.begin());
- return DummySignTx(txNew, v_txouts);
+ return DummySignTx(txNew, v_txouts, use_max_sig);
}
- bool DummySignTx(CMutableTransaction &txNew, const std::vector<CTxOut> &txouts) const;
- bool DummySignInput(CTxIn &tx_in, const CTxOut &txout) const;
+ bool DummySignTx(CMutableTransaction &txNew, const std::vector<CTxOut> &txouts, bool use_max_sig = false) const;
+ bool DummySignInput(CTxIn &tx_in, const CTxOut &txout, bool use_max_sig = false) const;
CFeeRate m_pay_tx_fee{DEFAULT_PAY_TX_FEE};
unsigned int m_confirm_target{DEFAULT_TX_CONFIRM_TARGET};
@@ -1308,9 +1311,9 @@ public:
};
// Calculate the size of the transaction assuming all signatures are max size
-// Use DummySignatureCreator, which inserts 72 byte signatures everywhere.
+// Use DummySignatureCreator, which inserts 71 byte signatures everywhere.
// NOTE: this requires that all inputs must be in mapWallet (eg the tx should
// be IsAllFromMe).
-int64_t CalculateMaximumSignedTxSize(const CTransaction &tx, const CWallet *wallet);
-int64_t CalculateMaximumSignedTxSize(const CTransaction &tx, const CWallet *wallet, const std::vector<CTxOut>& txouts);
+int64_t CalculateMaximumSignedTxSize(const CTransaction &tx, const CWallet *wallet, bool use_max_sig = false);
+int64_t CalculateMaximumSignedTxSize(const CTransaction &tx, const CWallet *wallet, const std::vector<CTxOut>& txouts, bool use_max_sig = false);
#endif // BITCOIN_WALLET_WALLET_H
diff --git a/test/functional/data/rpc_getblockstats.json b/test/functional/data/rpc_getblockstats.json
index 750abc5c42..b8cabe1e5e 100644
--- a/test/functional/data/rpc_getblockstats.json
+++ b/test/functional/data/rpc_getblockstats.json
@@ -112,13 +112,19 @@
"avgfeerate": 0,
"avgtxsize": 0,
"blockhash": "1d7fe80f19d28b8e712af0399ac84006db753441f3033111b3a8d610afab364f",
+ "feerate_percentiles": [
+ 0,
+ 0,
+ 0,
+ 0,
+ 0
+ ],
"height": 101,
"ins": 0,
"maxfee": 0,
"maxfeerate": 0,
"maxtxsize": 0,
"medianfee": 0,
- "medianfeerate": 0,
"mediantime": 1525107242,
"mediantxsize": 0,
"minfee": 0,
@@ -144,12 +150,18 @@
"avgtxsize": 187,
"blockhash": "4e21a43675d7a41cb6b944e068c5bcd0a677baf658d9ebe021ae2d2f99397ccc",
"height": 102,
+ "feerate_percentiles": [
+ 20,
+ 20,
+ 20,
+ 20,
+ 20
+ ],
"ins": 1,
"maxfee": 3760,
"maxfeerate": 20,
"maxtxsize": 187,
"medianfee": 3760,
- "medianfeerate": 20,
"mediantime": 1525107242,
"mediantxsize": 187,
"minfee": 3760,
@@ -174,13 +186,19 @@
"avgfeerate": 109,
"avgtxsize": 228,
"blockhash": "22d9b8b9c2a37c81515f3fc84f7241f6c07dbcea85ef16b00bcc33ae400a030f",
+ "feerate_percentiles": [
+ 20,
+ 20,
+ 20,
+ 300,
+ 300
+ ],
"height": 103,
"ins": 3,
"maxfee": 49800,
"maxfeerate": 300,
"maxtxsize": 248,
"medianfee": 3760,
- "medianfeerate": 20,
"mediantime": 1525107243,
"mediantxsize": 248,
"minfee": 3320,
diff --git a/test/functional/data/rpc_psbt.json b/test/functional/data/rpc_psbt.json
index 4e2f08f274..d800fa97a5 100644
--- a/test/functional/data/rpc_psbt.json
+++ b/test/functional/data/rpc_psbt.json
@@ -57,14 +57,6 @@
],
"psbt" : "cHNidP8BAJoCAAAAAljoeiG1ba8MI76OcHBFbDNvfLqlyHV5JPVFiHuyq911AAAAAAD/////g40EJ9DsZQpoqka7CwmK6kQiwHGyyng1Kgd5WdB86h0BAAAAAP////8CcKrwCAAAAAAWABTYXCtx0AYLCcmIauuBXlCZHdoSTQDh9QUAAAAAFgAUAK6pouXw+HaliN9VRuh0LR2HAI8AAAAAAAEAuwIAAAABqtc5MQGL0l+ErkALaISL4J23BurCrBgpi6vucatlb4sAAAAASEcwRAIgWPb8fGoz4bMVSNSByCbAFb0wE1qtQs1neQ2rZtKtJDsCIEoc7SYExnNbY5PltBaR3XiwDwxZQvufdRhW+qk4FX26Af7///8CgPD6AgAAAAAXqRQPuUY0IWlrgsgzryQceMF9295JNIfQ8gonAQAAABepFCnKdPigj4GZlCgYXJe12FLkBj9hh2UAAAABBEdSIQKVg785rgpgl0etGZrd1jT6YQhVnWxc05tMIYPxq5bgfyEC2rYf9JoU22p9ArDNH7t4/EsYMStbTlTa5Nui+/71NtdSriIGApWDvzmuCmCXR60Zmt3WNPphCFWdbFzTm0whg/GrluB/ENkMak8AAACAAAAAgAAAAIAiBgLath/0mhTban0CsM0fu3j8SxgxK1tOVNrk26L7/vU21xDZDGpPAAAAgAAAAIABAACAAQMEAQAAAAABASAAwusLAAAAABepFLf1+vQOPUClpFmx2zU18rcvqSHohwEEIgAgjCNTFzdDtZXftKB7crqOQuN5fadOh/59nXSX47ICiQMBBUdSIQMIncEMesbbVPkTKa9hczPbOIzq0MIx9yM3nRuZAwsC3CECOt2QTz1tz1nduQaw3uI1Kbf/ue1Q5ehhUZJoYCIfDnNSriIGAjrdkE89bc9Z3bkGsN7iNSm3/7ntUOXoYVGSaGAiHw5zENkMak8AAACAAAAAgAMAAIAiBgMIncEMesbbVPkTKa9hczPbOIzq0MIx9yM3nRuZAwsC3BDZDGpPAAAAgAAAAIACAACAAQMEAQAAAAAiAgOppMN/WZbTqiXbrGtXCvBlA5RJKUJGCzVHU+2e7KWHcRDZDGpPAAAAgAAAAIAEAACAACICAn9jmXV9Lv9VoTatAsaEsYOLZVbl8bazQoKpS2tQBRCWENkMak8AAACAAAAAgAUAAIAA",
"result" : "cHNidP8BAJoCAAAAAljoeiG1ba8MI76OcHBFbDNvfLqlyHV5JPVFiHuyq911AAAAAAD/////g40EJ9DsZQpoqka7CwmK6kQiwHGyyng1Kgd5WdB86h0BAAAAAP////8CcKrwCAAAAAAWABTYXCtx0AYLCcmIauuBXlCZHdoSTQDh9QUAAAAAFgAUAK6pouXw+HaliN9VRuh0LR2HAI8AAAAAAAEAuwIAAAABqtc5MQGL0l+ErkALaISL4J23BurCrBgpi6vucatlb4sAAAAASEcwRAIgWPb8fGoz4bMVSNSByCbAFb0wE1qtQs1neQ2rZtKtJDsCIEoc7SYExnNbY5PltBaR3XiwDwxZQvufdRhW+qk4FX26Af7///8CgPD6AgAAAAAXqRQPuUY0IWlrgsgzryQceMF9295JNIfQ8gonAQAAABepFCnKdPigj4GZlCgYXJe12FLkBj9hh2UAAAAiAgKVg785rgpgl0etGZrd1jT6YQhVnWxc05tMIYPxq5bgf0cwRAIgdAGK1BgAl7hzMjwAFXILNoTMgSOJEEjn282bVa1nnJkCIHPTabdA4+tT3O+jOCPIBwUUylWn3ZVE8VfBZ5EyYRGMAQEDBAEAAAABBEdSIQKVg785rgpgl0etGZrd1jT6YQhVnWxc05tMIYPxq5bgfyEC2rYf9JoU22p9ArDNH7t4/EsYMStbTlTa5Nui+/71NtdSriIGApWDvzmuCmCXR60Zmt3WNPphCFWdbFzTm0whg/GrluB/ENkMak8AAACAAAAAgAAAAIAiBgLath/0mhTban0CsM0fu3j8SxgxK1tOVNrk26L7/vU21xDZDGpPAAAAgAAAAIABAACAAAEBIADC6wsAAAAAF6kUt/X69A49QKWkWbHbNTXyty+pIeiHIgIDCJ3BDHrG21T5EymvYXMz2ziM6tDCMfcjN50bmQMLAtxHMEQCIGLrelVhB6fHP0WsSrWh3d9vcHX7EnWWmn84Pv/3hLyyAiAMBdu3Rw2/LwhVfdNWxzJcHtMJE+mWzThAlF2xIijaXwEBAwQBAAAAAQQiACCMI1MXN0O1ld+0oHtyuo5C43l9p06H/n2ddJfjsgKJAwEFR1IhAwidwQx6xttU+RMpr2FzM9s4jOrQwjH3IzedG5kDCwLcIQI63ZBPPW3PWd25BrDe4jUpt/+57VDl6GFRkmhgIh8Oc1KuIgYCOt2QTz1tz1nduQaw3uI1Kbf/ue1Q5ehhUZJoYCIfDnMQ2QxqTwAAAIAAAACAAwAAgCIGAwidwQx6xttU+RMpr2FzM9s4jOrQwjH3IzedG5kDCwLcENkMak8AAACAAAAAgAIAAIAAIgIDqaTDf1mW06ol26xrVwrwZQOUSSlCRgs1R1Ptnuylh3EQ2QxqTwAAAIAAAACABAAAgAAiAgJ/Y5l1fS7/VaE2rQLGhLGDi2VW5fG2s0KCqUtrUAUQlhDZDGpPAAAAgAAAAIAFAACAAA=="
- },
- {
- "privkeys" : [
- "cT7J9YpCwY3AVRFSjN6ukeEeWY6mhpbJPxRaDaP5QTdygQRxP9Au",
- "cNBc3SWUip9PPm1GjRoLEJT6T41iNzCYtD7qro84FMnM5zEqeJsE"
- ],
- "psbt" : "cHNidP8BAJoCAAAAAljoeiG1ba8MI76OcHBFbDNvfLqlyHV5JPVFiHuyq911AAAAAAD/////g40EJ9DsZQpoqka7CwmK6kQiwHGyyng1Kgd5WdB86h0BAAAAAP////8CcKrwCAAAAAAWABTYXCtx0AYLCcmIauuBXlCZHdoSTQDh9QUAAAAAFgAUAK6pouXw+HaliN9VRuh0LR2HAI8AAAAAAAEAuwIAAAABqtc5MQGL0l+ErkALaISL4J23BurCrBgpi6vucatlb4sAAAAASEcwRAIgWPb8fGoz4bMVSNSByCbAFb0wE1qtQs1neQ2rZtKtJDsCIEoc7SYExnNbY5PltBaR3XiwDwxZQvufdRhW+qk4FX26Af7///8CgPD6AgAAAAAXqRQPuUY0IWlrgsgzryQceMF9295JNIfQ8gonAQAAABepFCnKdPigj4GZlCgYXJe12FLkBj9hh2UAAAABBEdSIQKVg785rgpgl0etGZrd1jT6YQhVnWxc05tMIYPxq5bgfyEC2rYf9JoU22p9ArDNH7t4/EsYMStbTlTa5Nui+/71NtdSriIGApWDvzmuCmCXR60Zmt3WNPphCFWdbFzTm0whg/GrluB/ENkMak8AAACAAAAAgAAAAIAiBgLath/0mhTban0CsM0fu3j8SxgxK1tOVNrk26L7/vU21xDZDGpPAAAAgAAAAIABAACAAQMEAQAAAAABASAAwusLAAAAABepFLf1+vQOPUClpFmx2zU18rcvqSHohwEEIgAgjCNTFzdDtZXftKB7crqOQuN5fadOh/59nXSX47ICiQMBBUdSIQMIncEMesbbVPkTKa9hczPbOIzq0MIx9yM3nRuZAwsC3CECOt2QTz1tz1nduQaw3uI1Kbf/ue1Q5ehhUZJoYCIfDnNSriIGAjrdkE89bc9Z3bkGsN7iNSm3/7ntUOXoYVGSaGAiHw5zENkMak8AAACAAAAAgAMAAIAiBgMIncEMesbbVPkTKa9hczPbOIzq0MIx9yM3nRuZAwsC3BDZDGpPAAAAgAAAAIACAACAAQMEAQAAAAAiAgOppMN/WZbTqiXbrGtXCvBlA5RJKUJGCzVHU+2e7KWHcRDZDGpPAAAAgAAAAIAEAACAACICAn9jmXV9Lv9VoTatAsaEsYOLZVbl8bazQoKpS2tQBRCWENkMak8AAACAAAAAgAUAAIAA",
- "result" : "cHNidP8BAJoCAAAAAljoeiG1ba8MI76OcHBFbDNvfLqlyHV5JPVFiHuyq911AAAAAAD/////g40EJ9DsZQpoqka7CwmK6kQiwHGyyng1Kgd5WdB86h0BAAAAAP////8CcKrwCAAAAAAWABTYXCtx0AYLCcmIauuBXlCZHdoSTQDh9QUAAAAAFgAUAK6pouXw+HaliN9VRuh0LR2HAI8AAAAAAAEAuwIAAAABqtc5MQGL0l+ErkALaISL4J23BurCrBgpi6vucatlb4sAAAAASEcwRAIgWPb8fGoz4bMVSNSByCbAFb0wE1qtQs1neQ2rZtKtJDsCIEoc7SYExnNbY5PltBaR3XiwDwxZQvufdRhW+qk4FX26Af7///8CgPD6AgAAAAAXqRQPuUY0IWlrgsgzryQceMF9295JNIfQ8gonAQAAABepFCnKdPigj4GZlCgYXJe12FLkBj9hh2UAAAAiAgLath/0mhTban0CsM0fu3j8SxgxK1tOVNrk26L7/vU210gwRQIhAPYQOLMI3B2oZaNIUnRvAVdyk0IIxtJEVDk82ZvfIhd3AiAFbmdaZ1ptCgK4WxTl4pB02KJam1dgvqKBb2YZEKAG6gEBAwQBAAAAAQRHUiEClYO/Oa4KYJdHrRma3dY0+mEIVZ1sXNObTCGD8auW4H8hAtq2H/SaFNtqfQKwzR+7ePxLGDErW05U2uTbovv+9TbXUq4iBgKVg785rgpgl0etGZrd1jT6YQhVnWxc05tMIYPxq5bgfxDZDGpPAAAAgAAAAIAAAACAIgYC2rYf9JoU22p9ArDNH7t4/EsYMStbTlTa5Nui+/71NtcQ2QxqTwAAAIAAAACAAQAAgAABASAAwusLAAAAABepFLf1+vQOPUClpFmx2zU18rcvqSHohyICAjrdkE89bc9Z3bkGsN7iNSm3/7ntUOXoYVGSaGAiHw5zRzBEAiBl9FulmYtZon/+GnvtAWrx8fkNVLOqj3RQql9WolEDvQIgf3JHA60e25ZoCyhLVtT/y4j3+3Weq74IqjDym4UTg9IBAQMEAQAAAAEEIgAgjCNTFzdDtZXftKB7crqOQuN5fadOh/59nXSX47ICiQMBBUdSIQMIncEMesbbVPkTKa9hczPbOIzq0MIx9yM3nRuZAwsC3CECOt2QTz1tz1nduQaw3uI1Kbf/ue1Q5ehhUZJoYCIfDnNSriIGAjrdkE89bc9Z3bkGsN7iNSm3/7ntUOXoYVGSaGAiHw5zENkMak8AAACAAAAAgAMAAIAiBgMIncEMesbbVPkTKa9hczPbOIzq0MIx9yM3nRuZAwsC3BDZDGpPAAAAgAAAAIACAACAACICA6mkw39ZltOqJdusa1cK8GUDlEkpQkYLNUdT7Z7spYdxENkMak8AAACAAAAAgAQAAIAAIgICf2OZdX0u/1WhNq0CxoSxg4tlVuXxtrNCgqlLa1AFEJYQ2QxqTwAAAIAAAACABQAAgAA="
}
],
"combiner" : [
diff --git a/test/functional/feature_help.py b/test/functional/feature_help.py
index d38275a9ca..ed1d25c0d6 100755
--- a/test/functional/feature_help.py
+++ b/test/functional/feature_help.py
@@ -3,7 +3,6 @@
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Verify that starting bitcoin with -h works as expected."""
-import subprocess
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import assert_equal
@@ -17,41 +16,47 @@ class HelpTest(BitcoinTestFramework):
self.add_nodes(self.num_nodes)
# Don't start the node
+ def get_node_output(self, *, ret_code_expected):
+ ret_code = self.nodes[0].process.wait(timeout=5)
+ assert_equal(ret_code, ret_code_expected)
+ self.nodes[0].stdout.seek(0)
+ self.nodes[0].stderr.seek(0)
+ out = self.nodes[0].stdout.read()
+ err = self.nodes[0].stderr.read()
+ self.nodes[0].stdout.close()
+ self.nodes[0].stderr.close()
+
+ # Clean up TestNode state
+ self.nodes[0].running = False
+ self.nodes[0].process = None
+ self.nodes[0].rpc_connected = False
+ self.nodes[0].rpc = None
+
+ return out, err
+
def run_test(self):
self.log.info("Start bitcoin with -h for help text")
- self.nodes[0].start(extra_args=['-h'], stderr=subprocess.PIPE, stdout=subprocess.PIPE)
+ self.nodes[0].start(extra_args=['-h'])
# Node should exit immediately and output help to stdout.
- ret_code = self.nodes[0].process.wait(timeout=1)
- assert_equal(ret_code, 0)
- output = self.nodes[0].process.stdout.read()
+ output, _ = self.get_node_output(ret_code_expected=0)
assert b'Options' in output
self.log.info("Help text received: {} (...)".format(output[0:60]))
- self.nodes[0].running = False
self.log.info("Start bitcoin with -version for version information")
- self.nodes[0].start(extra_args=['-version'], stderr=subprocess.PIPE, stdout=subprocess.PIPE)
+ self.nodes[0].start(extra_args=['-version'])
# Node should exit immediately and output version to stdout.
- ret_code = self.nodes[0].process.wait(timeout=1)
- assert_equal(ret_code, 0)
- output = self.nodes[0].process.stdout.read()
+ output, _ = self.get_node_output(ret_code_expected=0)
assert b'version' in output
self.log.info("Version text received: {} (...)".format(output[0:60]))
# Test that arguments not in the help results in an error
self.log.info("Start bitcoind with -fakearg to make sure it does not start")
- self.nodes[0].start(extra_args=['-fakearg'], stderr=subprocess.PIPE, stdout=subprocess.PIPE)
+ self.nodes[0].start(extra_args=['-fakearg'])
# Node should exit immediately and output an error to stderr
- ret_code = self.nodes[0].process.wait(timeout=1)
- assert_equal(ret_code, 1)
- output = self.nodes[0].process.stderr.read()
+ _, output = self.get_node_output(ret_code_expected=1)
assert b'Error parsing command line arguments' in output
self.log.info("Error message received: {} (...)".format(output[0:60]))
- # Clean up TestNode state
- self.nodes[0].running = False
- self.nodes[0].process = None
- self.nodes[0].rpc_connected = False
- self.nodes[0].rpc = None
if __name__ == '__main__':
HelpTest().main()
diff --git a/test/functional/feature_reindex.py b/test/functional/feature_reindex.py
index 712de401ec..f30e1191e3 100755
--- a/test/functional/feature_reindex.py
+++ b/test/functional/feature_reindex.py
@@ -22,7 +22,7 @@ class ReindexTest(BitcoinTestFramework):
self.nodes[0].generate(3)
blockcount = self.nodes[0].getblockcount()
self.stop_nodes()
- extra_args = [["-reindex-chainstate" if justchainstate else "-reindex", "-checkblockindex=1"]]
+ extra_args = [["-reindex-chainstate" if justchainstate else "-reindex"]]
self.start_nodes(extra_args)
wait_until(lambda: self.nodes[0].getblockcount() == blockcount)
self.log.info("Success")
diff --git a/test/functional/mempool_accept.py b/test/functional/mempool_accept.py
index 7cdb24c6a5..44426a0ff7 100755
--- a/test/functional/mempool_accept.py
+++ b/test/functional/mempool_accept.py
@@ -35,7 +35,6 @@ class MempoolAcceptanceTest(BitcoinTestFramework):
def set_test_params(self):
self.num_nodes = 1
self.extra_args = [[
- '-checkmempool',
'-txindex',
'-reindex', # Need reindex for txindex
'-acceptnonstdtxn=0', # Try to mimic main-net
diff --git a/test/functional/mempool_reorg.py b/test/functional/mempool_reorg.py
index 5abd006282..76ed215668 100755
--- a/test/functional/mempool_reorg.py
+++ b/test/functional/mempool_reorg.py
@@ -12,11 +12,10 @@ from test_framework.test_framework import BitcoinTestFramework
from test_framework.blocktools import create_raw_transaction
from test_framework.util import *
-# Create one-input, one-output, no-fee transaction:
+
class MempoolCoinbaseTest(BitcoinTestFramework):
def set_test_params(self):
self.num_nodes = 2
- self.extra_args = [["-checkmempool"]] * 2
alert_filename = None # Set by setup_network
diff --git a/test/functional/mempool_resurrect.py b/test/functional/mempool_resurrect.py
index c773c56f1b..37e19ea530 100755
--- a/test/functional/mempool_resurrect.py
+++ b/test/functional/mempool_resurrect.py
@@ -8,11 +8,10 @@ from test_framework.test_framework import BitcoinTestFramework
from test_framework.blocktools import create_raw_transaction
from test_framework.util import *
-# Create one-input, one-output, no-fee transaction:
+
class MempoolCoinbaseTest(BitcoinTestFramework):
def set_test_params(self):
self.num_nodes = 1
- self.extra_args = [["-checkmempool"]]
def run_test(self):
node0_address = self.nodes[0].getnewaddress()
diff --git a/test/functional/mempool_spend_coinbase.py b/test/functional/mempool_spend_coinbase.py
index 4811c98e90..8800452629 100755
--- a/test/functional/mempool_spend_coinbase.py
+++ b/test/functional/mempool_spend_coinbase.py
@@ -16,11 +16,10 @@ from test_framework.test_framework import BitcoinTestFramework
from test_framework.blocktools import create_raw_transaction
from test_framework.util import *
-# Create one-input, one-output, no-fee transaction:
+
class MempoolSpendCoinbaseTest(BitcoinTestFramework):
def set_test_params(self):
self.num_nodes = 1
- self.extra_args = [["-checkmempool"]]
def run_test(self):
chain_height = self.nodes[0].getblockcount()
diff --git a/test/functional/p2p_invalid_locator.py b/test/functional/p2p_invalid_locator.py
new file mode 100755
index 0000000000..3b1654f920
--- /dev/null
+++ b/test/functional/p2p_invalid_locator.py
@@ -0,0 +1,43 @@
+#!/usr/bin/env python3
+# Copyright (c) 2015-2017 The Bitcoin Core developers
+# Distributed under the MIT software license, see the accompanying
+# file COPYING or http://www.opensource.org/licenses/mit-license.php.
+"""Test node responses to invalid locators.
+"""
+
+from test_framework.messages import msg_getheaders, msg_getblocks, MAX_LOCATOR_SZ
+from test_framework.mininode import P2PInterface
+from test_framework.test_framework import BitcoinTestFramework
+
+
+class InvalidLocatorTest(BitcoinTestFramework):
+ def set_test_params(self):
+ self.num_nodes = 1
+ self.setup_clean_chain = False
+
+ def run_test(self):
+ node = self.nodes[0] # convenience reference to the node
+ node.generate(1) # Get node out of IBD
+
+ self.log.info('Test max locator size')
+ block_count = node.getblockcount()
+ for msg in [msg_getheaders(), msg_getblocks()]:
+ self.log.info('Wait for disconnect when sending {} hashes in locator'.format(MAX_LOCATOR_SZ + 1))
+ node.add_p2p_connection(P2PInterface())
+ msg.locator.vHave = [int(node.getblockhash(i - 1), 16) for i in range(block_count, block_count - (MAX_LOCATOR_SZ + 1), -1)]
+ node.p2p.send_message(msg)
+ node.p2p.wait_for_disconnect()
+ node.disconnect_p2ps()
+
+ self.log.info('Wait for response when sending {} hashes in locator'.format(MAX_LOCATOR_SZ))
+ node.add_p2p_connection(P2PInterface())
+ msg.locator.vHave = [int(node.getblockhash(i - 1), 16) for i in range(block_count, block_count - (MAX_LOCATOR_SZ), -1)]
+ node.p2p.send_message(msg)
+ if type(msg) == msg_getheaders:
+ node.p2p.wait_for_header(int(node.getbestblockhash(), 16))
+ else:
+ node.p2p.wait_for_block(int(node.getbestblockhash(), 16))
+
+
+if __name__ == '__main__':
+ InvalidLocatorTest().main()
diff --git a/test/functional/rpc_bind.py b/test/functional/rpc_bind.py
index ef82b7e507..ef060f993a 100755
--- a/test/functional/rpc_bind.py
+++ b/test/functional/rpc_bind.py
@@ -20,9 +20,9 @@ class RPCBindTest(BitcoinTestFramework):
self.add_nodes(self.num_nodes, None)
def add_options(self, parser):
- parser.add_option("--ipv4", action='store_true', dest="run_ipv4", help="Run ipv4 tests only", default=False)
- parser.add_option("--ipv6", action='store_true', dest="run_ipv6", help="Run ipv6 tests only", default=False)
- parser.add_option("--nonloopback", action='store_true', dest="run_nonloopback", help="Run non-loopback tests only", default=False)
+ parser.add_argument("--ipv4", action='store_true', dest="run_ipv4", help="Run ipv4 tests only", default=False)
+ parser.add_argument("--ipv6", action='store_true', dest="run_ipv6", help="Run ipv6 tests only", default=False)
+ parser.add_argument("--nonloopback", action='store_true', dest="run_nonloopback", help="Run non-loopback tests only", default=False)
def run_bind_test(self, allow_ips, connect_to, addresses, expected):
'''
diff --git a/test/functional/rpc_blockchain.py b/test/functional/rpc_blockchain.py
index 49f44b0c6d..d681cdc8ab 100755
--- a/test/functional/rpc_blockchain.py
+++ b/test/functional/rpc_blockchain.py
@@ -194,13 +194,10 @@ class BlockchainTest(BitcoinTestFramework):
node.reconsiderblock(b1hash)
res3 = node.gettxoutsetinfo()
- assert_equal(res['total_amount'], res3['total_amount'])
- assert_equal(res['transactions'], res3['transactions'])
- assert_equal(res['height'], res3['height'])
- assert_equal(res['txouts'], res3['txouts'])
- assert_equal(res['bogosize'], res3['bogosize'])
- assert_equal(res['bestblock'], res3['bestblock'])
- assert_equal(res['hash_serialized_2'], res3['hash_serialized_2'])
+ # The field 'disk_size' is non-deterministic and can thus not be
+ # compared between res and res3. Everything else should be the same.
+ del res['disk_size'], res3['disk_size']
+ assert_equal(res, res3)
def _test_getblockheader(self):
node = self.nodes[0]
diff --git a/test/functional/rpc_getblockstats.py b/test/functional/rpc_getblockstats.py
index 37ef9f2b68..b24bed6adf 100755
--- a/test/functional/rpc_getblockstats.py
+++ b/test/functional/rpc_getblockstats.py
@@ -27,7 +27,7 @@ class GetblockstatsTest(BitcoinTestFramework):
'maxfee',
'maxfeerate',
'medianfee',
- 'medianfeerate',
+ 'feerate_percentiles',
'minfee',
'minfeerate',
'totalfee',
@@ -35,13 +35,13 @@ class GetblockstatsTest(BitcoinTestFramework):
]
def add_options(self, parser):
- parser.add_option('--gen-test-data', dest='gen_test_data',
- default=False, action='store_true',
- help='Generate test data')
- parser.add_option('--test-data', dest='test_data',
- default='data/rpc_getblockstats.json',
- action='store', metavar='FILE',
- help='Test data file')
+ parser.add_argument('--gen-test-data', dest='gen_test_data',
+ default=False, action='store_true',
+ help='Generate test data')
+ parser.add_argument('--test-data', dest='test_data',
+ default='data/rpc_getblockstats.json',
+ action='store', metavar='FILE',
+ help='Test data file')
def set_test_params(self):
self.num_nodes = 2
diff --git a/test/functional/rpc_users.py b/test/functional/rpc_users.py
index d631cd022b..102dd22594 100755
--- a/test/functional/rpc_users.py
+++ b/test/functional/rpc_users.py
@@ -18,6 +18,7 @@ import subprocess
from random import SystemRandom
import string
import configparser
+import sys
class HTTPBasicsTest(BitcoinTestFramework):
@@ -36,7 +37,7 @@ class HTTPBasicsTest(BitcoinTestFramework):
config = configparser.ConfigParser()
config.read_file(open(self.options.configfile))
gen_rpcauth = config['environment']['RPCAUTH']
- p = subprocess.Popen([gen_rpcauth, self.user], stdout=subprocess.PIPE, universal_newlines=True)
+ p = subprocess.Popen([sys.executable, gen_rpcauth, self.user], stdout=subprocess.PIPE, universal_newlines=True)
lines = p.stdout.read().splitlines()
rpcauth3 = lines[1]
self.password = lines[3]
diff --git a/test/functional/test_framework/messages.py b/test/functional/test_framework/messages.py
index 259b9fb019..7276f6b450 100755
--- a/test/functional/test_framework/messages.py
+++ b/test/functional/test_framework/messages.py
@@ -32,6 +32,7 @@ MY_SUBVERSION = b"/python-mininode-tester:0.0.3/"
MY_RELAY = 1 # from version 70001 onwards, fRelay should be appended to version messages (BIP37)
MAX_INV_SZ = 50000
+MAX_LOCATOR_SZ = 101
MAX_BLOCK_BASE_SIZE = 1000000
COIN = 100000000 # 1 btc in satoshis
diff --git a/test/functional/test_framework/mininode.py b/test/functional/test_framework/mininode.py
index b7dce3dcb9..ba37e17930 100755
--- a/test/functional/test_framework/mininode.py
+++ b/test/functional/test_framework/mininode.py
@@ -332,6 +332,15 @@ class P2PInterface(P2PConnection):
test_function = lambda: self.last_message.get("block") and self.last_message["block"].block.rehash() == blockhash
wait_until(test_function, timeout=timeout, lock=mininode_lock)
+ def wait_for_header(self, blockhash, timeout=60):
+ def test_function():
+ last_headers = self.last_message.get('headers')
+ if not last_headers:
+ return False
+ return last_headers.headers[0].rehash() == blockhash
+
+ wait_until(test_function, timeout=timeout, lock=mininode_lock)
+
def wait_for_getdata(self, timeout=60):
"""Waits for a getdata message.
diff --git a/test/functional/test_framework/test_framework.py b/test/functional/test_framework/test_framework.py
index e69919605d..b876d9bd76 100755
--- a/test/functional/test_framework/test_framework.py
+++ b/test/functional/test_framework/test_framework.py
@@ -7,7 +7,7 @@
import configparser
from enum import Enum
import logging
-import optparse
+import argparse
import os
import pdb
import shutil
@@ -96,31 +96,31 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
def main(self):
"""Main function. This should not be overridden by the subclass test scripts."""
- parser = optparse.OptionParser(usage="%prog [options]")
- parser.add_option("--nocleanup", dest="nocleanup", default=False, action="store_true",
- help="Leave bitcoinds and test.* datadir on exit or error")
- parser.add_option("--noshutdown", dest="noshutdown", default=False, action="store_true",
- help="Don't stop bitcoinds after the test execution")
- parser.add_option("--cachedir", dest="cachedir", default=os.path.abspath(os.path.dirname(os.path.realpath(__file__)) + "/../../cache"),
- help="Directory for caching pregenerated datadirs (default: %default)")
- parser.add_option("--tmpdir", dest="tmpdir", help="Root directory for datadirs")
- parser.add_option("-l", "--loglevel", dest="loglevel", default="INFO",
- help="log events at this level and higher to the console. Can be set to DEBUG, INFO, WARNING, ERROR or CRITICAL. Passing --loglevel DEBUG will output all logs to console. Note that logs at all levels are always written to the test_framework.log file in the temporary test directory.")
- parser.add_option("--tracerpc", dest="trace_rpc", default=False, action="store_true",
- help="Print out all RPC calls as they are made")
- parser.add_option("--portseed", dest="port_seed", default=os.getpid(), type='int',
- help="The seed to use for assigning port numbers (default: current process id)")
- parser.add_option("--coveragedir", dest="coveragedir",
- help="Write tested RPC commands into this directory")
- parser.add_option("--configfile", dest="configfile",
- default=os.path.abspath(os.path.dirname(os.path.realpath(__file__)) + "/../../config.ini"),
- help="Location of the test framework config file (default: %default)")
- parser.add_option("--pdbonfailure", dest="pdbonfailure", default=False, action="store_true",
- help="Attach a python debugger if test fails")
- parser.add_option("--usecli", dest="usecli", default=False, action="store_true",
- help="use bitcoin-cli instead of RPC for all commands")
+ parser = argparse.ArgumentParser(usage="%(prog)s [options]")
+ parser.add_argument("--nocleanup", dest="nocleanup", default=False, action="store_true",
+ help="Leave bitcoinds and test.* datadir on exit or error")
+ parser.add_argument("--noshutdown", dest="noshutdown", default=False, action="store_true",
+ help="Don't stop bitcoinds after the test execution")
+ parser.add_argument("--cachedir", dest="cachedir", default=os.path.abspath(os.path.dirname(os.path.realpath(__file__)) + "/../../cache"),
+ help="Directory for caching pregenerated datadirs (default: %(default)s)")
+ parser.add_argument("--tmpdir", dest="tmpdir", help="Root directory for datadirs")
+ parser.add_argument("-l", "--loglevel", dest="loglevel", default="INFO",
+ help="log events at this level and higher to the console. Can be set to DEBUG, INFO, WARNING, ERROR or CRITICAL. Passing --loglevel DEBUG will output all logs to console. Note that logs at all levels are always written to the test_framework.log file in the temporary test directory.")
+ parser.add_argument("--tracerpc", dest="trace_rpc", default=False, action="store_true",
+ help="Print out all RPC calls as they are made")
+ parser.add_argument("--portseed", dest="port_seed", default=os.getpid(), type=int,
+ help="The seed to use for assigning port numbers (default: current process id)")
+ parser.add_argument("--coveragedir", dest="coveragedir",
+ help="Write tested RPC commands into this directory")
+ parser.add_argument("--configfile", dest="configfile",
+ default=os.path.abspath(os.path.dirname(os.path.realpath(__file__)) + "/../../config.ini"),
+ help="Location of the test framework config file (default: %(default)s)")
+ parser.add_argument("--pdbonfailure", dest="pdbonfailure", default=False, action="store_true",
+ help="Attach a python debugger if test fails")
+ parser.add_argument("--usecli", dest="usecli", default=False, action="store_true",
+ help="use bitcoin-cli instead of RPC for all commands")
self.add_options(parser)
- (self.options, self.args) = parser.parse_args()
+ self.options = parser.parse_args()
PortSeed.n = self.options.port_seed
diff --git a/test/functional/test_framework/test_node.py b/test/functional/test_framework/test_node.py
index 56ea110f16..0d00cc2082 100755
--- a/test/functional/test_framework/test_node.py
+++ b/test/functional/test_framework/test_node.py
@@ -122,7 +122,7 @@ class TestNode():
assert self.rpc_connected and self.rpc is not None, self._node_msg("Error: no RPC connection")
return getattr(self.rpc, name)
- def start(self, extra_args=None, stdout=None, stderr=None, *args, **kwargs):
+ def start(self, extra_args=None, *, stdout=None, stderr=None, **kwargs):
"""Start the node."""
if extra_args is None:
extra_args = self.extra_args
@@ -143,7 +143,7 @@ class TestNode():
# add environment variable LIBC_FATAL_STDERR_=1 so that libc errors are written to stderr and not the terminal
subp_env = dict(os.environ, LIBC_FATAL_STDERR_="1")
- self.process = subprocess.Popen(self.args + extra_args, env=subp_env, stdout=stdout, stderr=stderr, *args, **kwargs)
+ self.process = subprocess.Popen(self.args + extra_args, env=subp_env, stdout=stdout, stderr=stderr, **kwargs)
self.running = True
self.log.debug("bitcoind started, waiting for RPC to come up")
@@ -200,6 +200,9 @@ class TestNode():
if stderr != expected_stderr:
raise AssertionError("Unexpected stderr {} != {}".format(stderr, expected_stderr))
+ self.stdout.close()
+ self.stderr.close()
+
del self.p2ps[:]
def is_node_stopped(self):
diff --git a/test/functional/test_runner.py b/test/functional/test_runner.py
index dd4a7b2161..feea2a327a 100755
--- a/test/functional/test_runner.py
+++ b/test/functional/test_runner.py
@@ -115,6 +115,7 @@ BASE_SCRIPTS = [
'wallet_keypool.py',
'p2p_mempool.py',
'mining_prioritisetransaction.py',
+ 'p2p_invalid_locator.py',
'p2p_invalid_block.py',
'p2p_invalid_tx.py',
'rpc_createmultisig.py',
diff --git a/test/functional/wallet_txn_clone.py b/test/functional/wallet_txn_clone.py
index 2fce6eae8a..4ca4ee14e9 100755
--- a/test/functional/wallet_txn_clone.py
+++ b/test/functional/wallet_txn_clone.py
@@ -17,10 +17,10 @@ class TxnMallTest(BitcoinTestFramework):
self.num_nodes = 4
def add_options(self, parser):
- parser.add_option("--mineblock", dest="mine_block", default=False, action="store_true",
- help="Test double-spend of 1-confirmed transaction")
- parser.add_option("--segwit", dest="segwit", default=False, action="store_true",
- help="Test behaviour with SegWit txn (which should fail")
+ parser.add_argument("--mineblock", dest="mine_block", default=False, action="store_true",
+ help="Test double-spend of 1-confirmed transaction")
+ parser.add_argument("--segwit", dest="segwit", default=False, action="store_true",
+ help="Test behaviour with SegWit txn (which should fail")
def setup_network(self):
# Start with split network:
diff --git a/test/functional/wallet_txn_doublespend.py b/test/functional/wallet_txn_doublespend.py
index 8903fc0e0e..6811f6ab73 100755
--- a/test/functional/wallet_txn_doublespend.py
+++ b/test/functional/wallet_txn_doublespend.py
@@ -19,8 +19,8 @@ class TxnMallTest(BitcoinTestFramework):
self.num_nodes = 4
def add_options(self, parser):
- parser.add_option("--mineblock", dest="mine_block", default=False, action="store_true",
- help="Test double-spend of 1-confirmed transaction")
+ parser.add_argument("--mineblock", dest="mine_block", default=False, action="store_true",
+ help="Test double-spend of 1-confirmed transaction")
def setup_network(self):
# Start with split network:
diff --git a/test/lint/lint-format-strings.py b/test/lint/lint-format-strings.py
index c07dfe317b..60389176c9 100755
--- a/test/lint/lint-format-strings.py
+++ b/test/lint/lint-format-strings.py
@@ -123,6 +123,32 @@ def parse_function_call_and_arguments(function_name, function_call):
['foo(', '123', ')']
>>> parse_function_call_and_arguments("foo", 'foo("foo")')
['foo(', '"foo"', ')']
+ >>> parse_function_call_and_arguments("strprintf", 'strprintf("%s (%d)", std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>,wchar_t>().to_bytes(buf), err);')
+ ['strprintf(', '"%s (%d)",', ' std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>,wchar_t>().to_bytes(buf),', ' err', ')']
+ >>> parse_function_call_and_arguments("strprintf", 'strprintf("%s (%d)", foo<wchar_t>().to_bytes(buf), err);')
+ ['strprintf(', '"%s (%d)",', ' foo<wchar_t>().to_bytes(buf),', ' err', ')']
+ >>> parse_function_call_and_arguments("strprintf", 'strprintf("%s (%d)", foo().to_bytes(buf), err);')
+ ['strprintf(', '"%s (%d)",', ' foo().to_bytes(buf),', ' err', ')']
+ >>> parse_function_call_and_arguments("strprintf", 'strprintf("%s (%d)", foo << 1, err);')
+ ['strprintf(', '"%s (%d)",', ' foo << 1,', ' err', ')']
+ >>> parse_function_call_and_arguments("strprintf", 'strprintf("%s (%d)", foo<bar>() >> 1, err);')
+ ['strprintf(', '"%s (%d)",', ' foo<bar>() >> 1,', ' err', ')']
+ >>> parse_function_call_and_arguments("strprintf", 'strprintf("%s (%d)", foo < 1 ? bar : foobar, err);')
+ ['strprintf(', '"%s (%d)",', ' foo < 1 ? bar : foobar,', ' err', ')']
+ >>> parse_function_call_and_arguments("strprintf", 'strprintf("%s (%d)", foo < 1, err);')
+ ['strprintf(', '"%s (%d)",', ' foo < 1,', ' err', ')']
+ >>> parse_function_call_and_arguments("strprintf", 'strprintf("%s (%d)", foo > 1 ? bar : foobar, err);')
+ ['strprintf(', '"%s (%d)",', ' foo > 1 ? bar : foobar,', ' err', ')']
+ >>> parse_function_call_and_arguments("strprintf", 'strprintf("%s (%d)", foo > 1, err);')
+ ['strprintf(', '"%s (%d)",', ' foo > 1,', ' err', ')']
+ >>> parse_function_call_and_arguments("strprintf", 'strprintf("%s (%d)", foo <= 1, err);')
+ ['strprintf(', '"%s (%d)",', ' foo <= 1,', ' err', ')']
+ >>> parse_function_call_and_arguments("strprintf", 'strprintf("%s (%d)", foo <= bar<1, 2>(1, 2), err);')
+ ['strprintf(', '"%s (%d)",', ' foo <= bar<1, 2>(1, 2),', ' err', ')']
+ >>> parse_function_call_and_arguments("strprintf", 'strprintf("%s (%d)", foo>foo<1,2>(1,2)?bar:foobar,err)');
+ ['strprintf(', '"%s (%d)",', ' foo>foo<1,2>(1,2)?bar:foobar,', 'err', ')']
+ >>> parse_function_call_and_arguments("strprintf", 'strprintf("%s (%d)", foo>foo<1,2>(1,2),err)');
+ ['strprintf(', '"%s (%d)",', ' foo>foo<1,2>(1,2),', 'err', ')']
"""
assert(type(function_name) is str and type(function_call) is str and function_name)
remaining = normalize(escape(function_call))
@@ -131,9 +157,10 @@ def parse_function_call_and_arguments(function_name, function_call):
parts = [expected_function_call]
remaining = remaining[len(expected_function_call):]
open_parentheses = 1
+ open_template_arguments = 0
in_string = False
parts.append("")
- for char in remaining:
+ for i, char in enumerate(remaining):
parts.append(parts.pop() + char)
if char == "\"":
in_string = not in_string
@@ -151,6 +178,15 @@ def parse_function_call_and_arguments(function_name, function_call):
parts.append(parts.pop()[:-1])
parts.append(char)
break
+ prev_char = remaining[i - 1] if i - 1 >= 0 else None
+ next_char = remaining[i + 1] if i + 1 <= len(remaining) - 1 else None
+ if char == "<" and next_char not in [" ", "<", "="] and prev_char not in [" ", "<"]:
+ open_template_arguments += 1
+ continue
+ if char == ">" and next_char not in [" ", ">", "="] and prev_char not in [" ", ">"] and open_template_arguments > 0:
+ open_template_arguments -= 1
+ if open_template_arguments > 0:
+ continue
if char == ",":
parts.append("")
return parts
diff --git a/test/util/data/txcreatesignv1.hex b/test/util/data/txcreatesignv1.hex
index a46fcc88cb..40039319bd 100644
--- a/test/util/data/txcreatesignv1.hex
+++ b/test/util/data/txcreatesignv1.hex
@@ -1 +1 @@
-01000000018594c5bdcaec8f06b78b596f31cd292a294fd031e24eec716f43dac91ea7494d000000008b48304502210096a75056c9e2cc62b7214777b3d2a592cfda7092520126d4ebfcd6d590c99bd8022051bb746359cf98c0603f3004477eac68701132380db8facba19c89dc5ab5c5e201410479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8ffffffff01a0860100000000001976a9145834479edbbe0539b31ffd3a8f8ebadc2165ed0188ac00000000
+01000000018594c5bdcaec8f06b78b596f31cd292a294fd031e24eec716f43dac91ea7494d000000008a4730440220131432090a6af42da3e8335ff110831b41a44f4e9d18d88f5d50278380696c7202200fc2e48938f323ad13625890c0ea926c8a189c08b8efc38376b20c8a2188e96e01410479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8ffffffff01a0860100000000001976a9145834479edbbe0539b31ffd3a8f8ebadc2165ed0188ac00000000
diff --git a/test/util/data/txcreatesignv1.json b/test/util/data/txcreatesignv1.json
index 64e5137f4b..7a06aa9ffe 100644
--- a/test/util/data/txcreatesignv1.json
+++ b/test/util/data/txcreatesignv1.json
@@ -1,18 +1,18 @@
{
- "txid": "977e7cd286cb72cd470d539ba6cb48400f8f387d97451d45cdb8819437a303af",
- "hash": "977e7cd286cb72cd470d539ba6cb48400f8f387d97451d45cdb8819437a303af",
+ "txid": "ffc7e509ec3fd60a182eb712621d41a47dc7d4ff310a70826c2fb0e9afb3fa02",
+ "hash": "ffc7e509ec3fd60a182eb712621d41a47dc7d4ff310a70826c2fb0e9afb3fa02",
"version": 1,
- "size": 224,
- "vsize": 224,
- "weight": 896,
+ "size": 223,
+ "vsize": 223,
+ "weight": 892,
"locktime": 0,
"vin": [
{
"txid": "4d49a71ec9da436f71ec4ee231d04f292a29cd316f598bb7068feccabdc59485",
"vout": 0,
"scriptSig": {
- "asm": "304502210096a75056c9e2cc62b7214777b3d2a592cfda7092520126d4ebfcd6d590c99bd8022051bb746359cf98c0603f3004477eac68701132380db8facba19c89dc5ab5c5e2[ALL] 0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",
- "hex": "48304502210096a75056c9e2cc62b7214777b3d2a592cfda7092520126d4ebfcd6d590c99bd8022051bb746359cf98c0603f3004477eac68701132380db8facba19c89dc5ab5c5e201410479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8"
+ "asm": "30440220131432090a6af42da3e8335ff110831b41a44f4e9d18d88f5d50278380696c7202200fc2e48938f323ad13625890c0ea926c8a189c08b8efc38376b20c8a2188e96e[ALL] 0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",
+ "hex": "4730440220131432090a6af42da3e8335ff110831b41a44f4e9d18d88f5d50278380696c7202200fc2e48938f323ad13625890c0ea926c8a189c08b8efc38376b20c8a2188e96e01410479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8"
},
"sequence": 4294967295
}
@@ -32,5 +32,5 @@
}
}
],
- "hex": "01000000018594c5bdcaec8f06b78b596f31cd292a294fd031e24eec716f43dac91ea7494d000000008b48304502210096a75056c9e2cc62b7214777b3d2a592cfda7092520126d4ebfcd6d590c99bd8022051bb746359cf98c0603f3004477eac68701132380db8facba19c89dc5ab5c5e201410479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8ffffffff01a0860100000000001976a9145834479edbbe0539b31ffd3a8f8ebadc2165ed0188ac00000000"
+ "hex": "01000000018594c5bdcaec8f06b78b596f31cd292a294fd031e24eec716f43dac91ea7494d000000008a4730440220131432090a6af42da3e8335ff110831b41a44f4e9d18d88f5d50278380696c7202200fc2e48938f323ad13625890c0ea926c8a189c08b8efc38376b20c8a2188e96e01410479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8ffffffff01a0860100000000001976a9145834479edbbe0539b31ffd3a8f8ebadc2165ed0188ac00000000"
}