Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rationalize currency unit to "BTC" #6504

merged 1 commit into from Aug 3, 2015


Copy link

rnicoll commented Aug 1, 2015

Previously various user-facing strings have used inconsistent currency units "BTC", "btc" and "bitcoins". This adds a single constant and uses it for each reference to the currency unit.

Also adds a description of the unit for --maxtxfee, and adds the missing "amount" field description to the (deprecated) move RPC command.

Copy link

theochino commented Aug 1, 2015


I would suggest using XBT instead of the BTx is the ISO prefix for Bhutan.

Theo Chino, NYC
(Participant of the foundation now defunct group for the ISO certification
for Bitcoin)

On Saturday, August 1, 2015, Ross Nicoll wrote:

Previously various user-facing strings have used inconsistent currency
units "BTC", "btc" and "bitcoins". This adds a single constant and uses it
for each reference to the currency unit.

Also adds a description of the unit for --maxtxfee, and adds the missing

"amount" field description to the (deprecated) move RPC command.

You can view, comment on, or merge this pull request online at:

Commit Summary

  • Rationalize currency unit to "BTC"

File Changes

Patch Links:

Reply to this email directly or view it on GitHub

Copy link
Contributor Author

rnicoll commented Aug 1, 2015

I'll leave others to discuss whether it should change, but this patch certainly makes it simpler by using a single constant (although QT wallet values would need to be updated independently)

@@ -342,16 +342,17 @@ std::string HelpMessage(HelpMessageMode mode)
strUsage += HelpMessageOpt("-disablewallet", _("Do not load the wallet and disable wallet RPC calls"));
strUsage += HelpMessageOpt("-keypool=<n>", strprintf(_("Set key pool size to <n> (default: %u)"), 100));
if (showDebug)
strUsage += HelpMessageOpt("-mintxfee=<amt>", strprintf("Fees (in BTC/Kb) smaller than this are considered zero fee for transaction creation (default: %s)",

This comment has been minimized.

Copy link

luke-jr Aug 1, 2015


At least fix Kb to kb here at the same time..

Copy link

luke-jr commented Aug 1, 2015

@theochino XBT is not a well-defined denomination. Different parts of the community use it for different size bases.

Copy link

luke-jr commented Aug 1, 2015

Also, as to the concept of this PR itself: I don't think we need to define a variable for every reused term. Just changing "btc" and "bitcoins" to "BTC" in literals should be sufficient.

@rnicoll rnicoll force-pushed the rnicoll:normalize-units branch Aug 2, 2015
Copy link
Contributor Author

rnicoll commented Aug 2, 2015

Fixed kilobyte units, and removed the constant string.

Copy link
Contributor Author

rnicoll commented Aug 2, 2015

Just realised these strings are all copied into qt/bitcoinstrings.cpp - are those extracted automatically and I shouldn't touch them, or do they need updating too?

@laanwj laanwj added the Refactoring label Aug 3, 2015
Copy link

laanwj commented Aug 3, 2015

Concept ACK on moving the currency unit to a constant.
Please do leave it as BTC. Changing it to XBT becomes trivial for those that insist on it, if it's managed from one plcae.

Just realised these strings are all copied into qt/bitcoinstrings.cpp - are those extracted automatically and I shouldn't touch them, or do they need updating too?

Don't touch the file manually. Translation strings are extracted automatically by make translate's tooling. This updates bitcoinstrings as well as the English ts_file.

Copy link

Diapolo commented Aug 3, 2015

This only seems to cover core code, any reason not to do this for the GUI part?

Copy link
Contributor Author

rnicoll commented Aug 3, 2015

@Diapolo Couldn't see any problems in the QT code, apart from the bitcoinstrings.cpp (which are generated), and that code uses its own copy of currency units generally. Do let me know if I've missed anything.

Copy link

laanwj commented Aug 3, 2015

Hm, you removed the parametrization?

Copy link
Contributor Author

rnicoll commented Aug 3, 2015

Putting it back at the moment

Copy link
Contributor Author

rnicoll commented Aug 3, 2015

Done - let me know if that's okay and I'll squash them

luke-jr reviewed Aug 3, 2015
View changes
src/qt/bitcoinunits.cpp Outdated
case mBTC: return QString("mBTC");
case uBTC: return QString::fromUtf8("μBTC");
case BTC: return QString(CURRENCY_UNIT.c_str());
case mBTC: return QString(("m" + CURRENCY_UNIT).c_str());

This comment has been minimized.

Copy link

luke-jr Aug 3, 2015


Did you test this? const char * + const char * is going to be a pointer to some undefined memory...

This comment has been minimized.

Copy link

rnicoll Aug 3, 2015

Author Contributor

It's std::string + std::string I believe, and certainly seemed to work. Removing as per @laanwj 's request anyway.

This comment has been minimized.

Copy link

laanwj Aug 3, 2015


No longer relevant here, but for next time: you can use QString::fromStdString to convert a std::string to QString. No need for c_str.

luke-jr reviewed Aug 3, 2015
View changes
src/wallet/rpcwallet.cpp Outdated
@@ -2278,7 +2279,7 @@ UniValue listunspent(const UniValue& params, bool fHelp)
" \"address\" : \"address\", (string) the bitcoin address\n"
" \"account\" : \"account\", (string) DEPRECATED. The associated account, or \"\" for the default account\n"
" \"scriptPubKey\" : \"key\", (string) the script key\n"
" \"amount\" :, (numeric) the transaction amount in btc\n"
" \"amount\" :, (numeric) the transaction amount in BTC\n"

This comment has been minimized.

Copy link

luke-jr Aug 3, 2015


Why not CURRENCY_UNIT here?

laanwj reviewed Aug 3, 2015
View changes
src/qt/bitcoinunits.cpp Outdated
case BTC: return QString("BTC");
case mBTC: return QString("mBTC");
case uBTC: return QString::fromUtf8("μBTC");
case BTC: return QString(CURRENCY_UNIT.c_str());

This comment has been minimized.

Copy link

laanwj Aug 3, 2015


Let's leave this function as it is. So anyone changing the currency unit will have to change bitcoinunits as well, that's OK IMO, that's what it was introduced for.
(This concatenation is weird, and will mismatch the constant names)

laanwj reviewed Aug 3, 2015
View changes
src/wallet/rpcwallet.cpp Outdated
@@ -1686,7 +1687,7 @@ UniValue gettransaction(const UniValue& params, bool fHelp)
"2. \"includeWatchonly\" (bool, optional, default=false) Whether to include watchonly addresses in balance calculation and details[]\n"
" \"amount\" :, (numeric) The transaction amount in btc\n"
" \"amount\" :, (numeric) The transaction amount in BTC\n"

This comment has been minimized.

Copy link

laanwj Aug 3, 2015


Seems a few more currency_unit are missing here

This comment has been minimized.

Copy link

rnicoll Aug 3, 2015

Author Contributor

This is what I get for trying to be too clever with search and replace... getting them now.

@rnicoll rnicoll force-pushed the rnicoll:normalize-units branch Aug 3, 2015
Copy link
Contributor Author

rnicoll commented Aug 3, 2015

Fixed, and found a couple of uses of "bitcoin" as a unit too, which I've also fixed.

Thanks for the tip re: QString

laanwj reviewed Aug 3, 2015
View changes
src/rpcmining.cpp Outdated
@@ -264,7 +264,7 @@ UniValue getmininginfo(const UniValue& params, bool fHelp)

// NOTE: Unlike wallet RPC (which use BTC values), mining RPCs follow GBT (BIP 22) in using satoshi amounts
// NOTE: Unlike wallet RPC (which use " + CURRENCY_UNIT + " values), mining RPCs follow GBT (BIP 22) in using satoshi amounts

This comment has been minimized.

Copy link

laanwj Aug 3, 2015


Comment :)

Ross Nicoll
Previously various user-facing strings have used inconsistent currency units "BTC",
"btc" and "bitcoins". This adds a single constant and uses it for each reference to
the currency unit.

Also adds a description of the unit for --maxtxfee, and adds the missing "amount"
field description to the (deprecated) move RPC command.
Copy link

laanwj commented Aug 3, 2015

Tested ACK (but please remove the runaway unit parametrization from the comment)

@rnicoll rnicoll force-pushed the rnicoll:normalize-units branch to 9ca7857 Aug 3, 2015
Copy link
Contributor Author

rnicoll commented Aug 3, 2015

Fixed and squashed

@laanwj laanwj merged commit 9ca7857 into bitcoin:master Aug 3, 2015
1 check was pending
1 check was pending
continuous-integration/travis-ci/pr The Travis CI build is in progress
laanwj added a commit that referenced this pull request Aug 3, 2015
9ca7857 Rationalize currency unit to "BTC" (Ross Nicoll)
Copy link

theochino commented Sep 25, 2015

@luke-jr (On your August 1st comment.) - In 3 letters ISO codes, BTC will never be accepted (even it is used today) by the power to be.

I do prefer the BTC version until I read everything there was on ISO4217 and participated in the foundation working group -

Once I read it, X (Supranational) BT (Bitcoin) makes more scene than BTC which belong to Bhutan.
I say let make it XBT and make it easy for everyone we want to use the Bitcoin.

Just saying. XBT is free in the ISO code nomenclature. Why not claim it.
People are confused enough as it is ....

Copy link

luke-jr commented Sep 25, 2015

"XBT" is fine as a symbol. My point is that it is not well-defined whether it represents 100,000,000 (BTC), 100,000 (mBTC), 100 (µBTC), or whatever else.

Copy link

theochino commented Sep 25, 2015

I see your point ... leave it as BTC now and wait ... maybe later 1 XBT = 1 µBTC.
The problem, until we solve all the socials ills of the planet, is that will never be a one size fits all solution. Those with wealth will say 1 XBT = 100 BTC, and those on the other side will say 1 XBT = 1 mBTC.

To avoid headaches, I use 1 BTC = 1 XBT, 100'000 mBTC = 100'000 mXBT, and 100 µBTC = 100 µXBT and leave the fixing of the social ill to the pope. ISO standard has a field for the decimal (and I believe it does go to 8) so it would be a "trivial" change to use 1 BTC = 1 XBT which makes it simpler in the code to replace.

If the amount changes in the future, we'll change it to something else when we cross that bridge. Anyway, it was a small "loaded" request ....

Copy link

sipa commented Sep 25, 2015

str4d added a commit to str4d/zcash that referenced this pull request Feb 28, 2017
Revert before merging bitcoin/bitcoin#6504.
str4d added a commit to str4d/zcash that referenced this pull request Feb 28, 2017
Revert before merging bitcoin/bitcoin#6504.
str4d added a commit to str4d/zcash that referenced this pull request Mar 2, 2017
Revert before merging bitcoin/bitcoin#6504.
joshuayabut added a commit to zencashio/zen that referenced this pull request Apr 24, 2017
* Don't assume sizes of unsigned short and unsigned int in GetSizeOfCompactSize and WriteCompactSize.
Fixes #2137

Signed-off-by: Daira Hopwood <>

* Inc num of txs in test mempool

* Closes #1969. Default fee now sufficient for large shielded tx.

Sets default min relay tx fee to 100, which is used to initialize
nSatoshisPerK for min fee calculation.  The default z_sendmany
fee of 10000 is now sufficient to cover a tx of size 100000 bytes,
so txs will not be treated as "free" and hit the free rate limiter.

* Part of #1969. Changing min fee calculation also changes the dust threshold.

* Part of #1969. Update tests to avoid error 'absurdly high fee' from change in min fee calc.

*   Pause mining during joinsplit creation

* add conditional for --enable-man, default is yes

* change help string --enable-man to --disable-man

* regenerated all manpages with commit tag stripped, also add bitcoin-tx

* improved, includes bitcoin-tx and strips commit tag, now also runs binaries from build dir by default, added variables for more control

* Adjust for Zcash, use in Debian builds

* Regenerate and collate Zcash manpages, delete Bitcoin ones

* Update release process with

* rpc: make `gettxoutsettinfo` run lock-free

For leveldb "An iterator operates on a snapshot of the database taken
when the iterator is created". This means that it is unnecessary to
lock out other threads while computing statistics, and neither to hold
cs_main for the whole time. Let the thread run free.

* [REST] add JSON support for /rest/headers/

* fundrawtransaction tests

* Small tweaks to CCoinControl for fundrawtransaction

* Add fundrawtransaction RPC method

* Add FundTransaction method to wallet

Some code stolen from Jonas Schnelli <>

* Add DummySignatureCreator which just creates zeroed sigs

* [net] extend core functionallity for ban/unban/listban

* [RPC] add setban/listbanned/clearbanned RPC commands

* [QA] add setban/listbanned/clearbanned tests

* [net] remove unused return type bool from CNode::Ban()

* [RPC] extend setban to allow subnets

* Add getblockheader RPC call

Alternative to getblock that works even when the block itself has been
pruned, returning all available information.

* Return all available information via validateaddress

`"validateaddress"` omits some information, even in cases where is it available.

The primary motivation is to be able to retrieve redeemScripts, after using `"addmultisigaddress"`, when not all keys are available in the keystore, but the redeemScript actually is.

The output of `"validateaddress"` with this commit:

Keys not available:
validateaddress "n4KWZKx349gdMQGgTnZ8W6WfgSwybkGSK3"
  "isvalid": true,
  "address": "n4KWZKx349gdMQGgTnZ8W6WfgSwybkGSK3",
  "scriptPubKey": "76a914fa20d564550b105787f7ce3a9ad7fd9a45cd407088ac",
  "ismine": false,
  "iswatchonly": false,
  "isscript": false
validateaddress "2N2g2H7gjA8a11g1yKBgh5VTqndyvbnWpBK"
  "isvalid": true,
  "address": "2N2g2H7gjA8a11g1yKBgh5VTqndyvbnWpBK",
  "scriptPubKey": "a9146769c19a16c9400b908756e19a4d2afb9e9760e187",
  "ismine": false,
  "iswatchonly": false,
  "isscript": true

After adding the redeemScript:
addmultisigaddress 2 '["02537357B156A33306A7A014A3748631C59DF405B56F11BA4AA4A3CE81501AF095","02F1FB200390E7864EF4450C07B15988179A57C3CF3A878F668E1070CB615749FE"]'

validateaddress "2N2g2H7gjA8a11g1yKBgh5VTqndyvbnWpBK"
  "isvalid": true,
  "address": "2N2g2H7gjA8a11g1yKBgh5VTqndyvbnWpBK",
  "scriptPubKey": "a9146769c19a16c9400b908756e19a4d2afb9e9760e187",
  "ismine": false,
  "iswatchonly": false,
  "isscript": true,
  "script": "multisig",
  "hex": "522102537357b156a33306a7a014a3748631c59df405b56f11ba4aa4a3ce81501af0952102f1fb200390e7864ef4450c07b15988179a57c3cf3a878f668e1070cb615749fe52ae",
  "addresses": [
  "sigsrequired": 2,
  "account": ""

All keys available:
validateaddress "n4KWZKx349gdMQGgTnZ8W6WfgSwybkGSK3"
  "isvalid": true,
  "address": "n4KWZKx349gdMQGgTnZ8W6WfgSwybkGSK3",
  "scriptPubKey": "76a914fa20d564550b105787f7ce3a9ad7fd9a45cd407088ac",
  "ismine": true,
  "iswatchonly": false,
  "isscript": false,
  "pubkey": "02537357b156a33306a7a014a3748631c59df405b56f11ba4aa4a3ce81501af095",
  "iscompressed": true,
  "account": ""
validateaddress "2N2g2H7gjA8a11g1yKBgh5VTqndyvbnWpBK"
  "isvalid": true,
  "address": "2N2g2H7gjA8a11g1yKBgh5VTqndyvbnWpBK",
  "scriptPubKey": "a9146769c19a16c9400b908756e19a4d2afb9e9760e187",
  "ismine": true,
  "iswatchonly": false,
  "isscript": true,
  "script": "multisig",
  "hex": "522102537357b156a33306a7a014a3748631c59df405b56f11ba4aa4a3ce81501af0952102f1fb200390e7864ef4450c07b15988179a57c3cf3a878f668e1070cb615749fe52ae",
  "addresses": [
  "sigsrequired": 2,
  "account": ""

* Fix univalue handling of \u0000 characters.

Univalue's parsing of \u escape sequences did not handle NUL characters
correctly.  They were, effectively, dropped.  The extended test-case
fails with the old code, and is fixed with this patch.

* Add paytxfee to getwalletinfo, warnings to getnetworkinfo

* New RPC command disconnectnode

* rename json field "bannedtill" to "banned_until"

* setban: rewrite to UniValue, allow absolute bantime

* fix CSubNet comparison operator

* setban: add RPCErrorCode

* add RPC tests for setban & disconnectnode

* test: Move reindex test to standard tests

This test finishes very quickly, so it should be part of the default set
of tests in rpc-tests.

* fix missing lock in CNode::ClearBanned()

* setban: add IPv6 tests

* fix lock issue for QT node diconnect and RPC disconnectnode

Zcash: only RPC disconnectnode

* UniValue: don't escape solidus, keep espacing of reverse solidus

Zcash: The UniValue changes are already merged; this updates the test

* add tests for the decodescript rpc. add mention of the rpc regression tests to the testing seciton of the main readme.

* When processing RPC commands during warmup phase, parse the
request object before returning an error so that id value can
be used in the response.

Prior to this commit, RPC commands sent during Bitcoin's
warmup/startup phase were responded to with a JSON-RPC error
with an id of null, which violated the JSON-RPC 2.0 spec:

id: This member is REQUIRED. It MUST be the same as the value
of the id member in the Request Object. If there was an error
in detecting the id in the Request object (e.g. Parse
error/Invalid Request), it MUST be Null.

* rpc: Remove chain-specific RequireRPCPassword

I've never liked the chain-specific exception to having to set a
password. It gives issues with #6388 which makes it valid to
set no password in every case (as it enables random cookie authentication).

This pull removes the flag, so that all chains are regarded the same.

It also removes the username==password test, which doesn't provide any
substantial extra security.

* [QA] fix possible reorg issue in RPC test

- added missing mempool sync between block generations

* [QA] remove from the extended test list is already in the standard test list

* Adjust blockheaderToJSON() for Zcash block header

* Exempt unspendable transaction outputs from dust checks

Since unspendable outputs can't be spent, there is no threshold at which it would be uneconomic to spend them.

This primarily targets transaction outputs with `OP_RETURN`.


Initially based on:

commit 9cf0ae26350033d43d5dd3c95054c0d1b1641eda
Author: zathras-crypto <>
Date:   Wed Mar 25 02:04:02 2015 -0700


- cherry-picked on top of bitcoin:master
- added RPC test for fundrawtransaction

* rpc: Accept strings in AmountFromValue

Accept strings containing decimal values, in addition to bare values.

Useful from JSON-RPC implementations where it's not possible to have
direct control over the text of numbers (e.g. where numbers are always
doubles), and it's still desired to send an exact value.

This would allow users to post JSON content with numbers encoded like
`{"value": "0.00000001"}` instead of `{"value": 0.00000001}` which some
php/python encoders wrap into 1e-8, or worse.

* [QA] add testcases for parsing strings as values

* univalue: Avoid unnecessary roundtrip through double for numbers

JSON makes no distinction between numbers and reals, and our code
doesn't need to do so either.

This removes VREAL, as well as its specific post-processing in
`UniValue::write`. Non-monetary amounts do not need to be forcibly
formatted with 8 decimals, so the extra roundtrip was unnecessary
(and potentially loses precision).

Zcash: cherry-picked from commit 7650449a6777710cf818d41862626164da0cd412
Left over from 2aee461

* Fix crash in validateaddress with -disablewallet

Fix a null pointer dereference in validateaddress with -disablewallet. Also add a regression testcase.

* Adjust fundrawtransaction RPC test for Zcash

- Enable wallet encryption
- Correct block reward

* BTC -> ZEC in paytxfee RPC docs

Revert before merging bitcoin/bitcoin#6504.

* Update default RPC port in help strings

* Fix typo in listbanned RPC keys

* Re-encode t-addrs in with Zcash prefixes

* Improve comment explaining purpose of MAX_MONEY constant

* use const references where appropriate

* Reduce checkpoints' effect on consensus.

Instead of only checking height to decide whether to disable script checks,
actually check whether a block is an ancestor of a checkpoint, up to which
headers have been validated. This means that we don't have to prevent
accepting a side branch anymore - it will be safe, just less fast to

We still need to prevent being fed a multitude of low-difficulty headers
filling up our memory. The mechanism for that is unchanged for now: once
a checkpoint is reached with headers, no headers chain branching off before
that point are allowed anymore.

* [init] add -blockversion help and extend -upnp help

* Consensus: Refactor: Separate Consensus::CheckTxInputs and GetSpendHeight in CheckInputs

- Replaces some of the refactoring performed in #1017
- Exposed Consensus::CheckTxInputs for testing

* make CAddrMan::size() return the correct type of size_t

* Improve proxy initialization

Simplify and make the code in AppInit2 more clear.

This provides a straightforward flow, gets rid of .count() (which makes
it possible to override an earlier provided proxy option to nothing), as
well as comments the different cases.

* tests: Extend RPC proxy tests

Also test -noonion


Now that boost spirit is no longer used, `-DBOOST_SPIRIT_THREADSAFE`
doesn't need to be passed to the compiler anymore.

* Fix various warnings

Found while building on Debian 7

* [bitcoin-cli] improve error output

* Add BITCOIND_SIGTERM_TIMEOUT to OpenRC init scripts

This allows users to specify, e.g. raise, the default timeout of 60
seconds. Some bitcoind instances, especially long running ones on slow
hardware, require a higher timeout for a clean shut down.

Also add a comment to bitcoind.openrc's 'retry=', since it is not
obvious from the variable name what it does.

* configure --enable-debug changes

Three changes to how configure --enable-debug behaves:

1. Preserve user-passed CXXFLAGS/CFLAGS
2. Compile with -DDEBUG_LOCKORDER
3. Add -DDEBUG -DDEBUG_LOCKORDER to CPPFLAGS (since they are preprocessor options)

* Update Linearize tool to support Windows paths

* remove unused inv from ConnectTip()

* Buffer log messages and explicitly open logs

Prevents stomping on debug logs in datadirs that are locked by other
instances and lost parameter interaction messages that can get wiped by

The log is now opened explicitly and all emitted messages are buffered
until this open occurs.  The version message and log cut have also been
moved to the earliest possible sensible location.

* fix and extend CBitcoinExtKeyBase template

- fix Decode call (req. only one param)
- add constructor for base58c->CExtKey

* extend bip32 tests to cover Base58c/CExtKey decode

* don't try to decode invalid encoded ext keys

* Testing infrastructure: mocktime fixes

New, undocumented-on-purpose -mocktime=timestamp command-line
argument to startup with mocktime set. Needed because
time-related blockchain sanity checks are done on startup, before a
test has a chance to make a setmocktime RPC call.

And changed the setmocktime RPC call so calling it will not result in
currently connected peers being disconnected due to inactivity timeouts.

* tests: Fix bitcoin-tx signing testcase

Fixes wrong scriptPubkey problem, which caused the transaction to
not actually be signed.

* Assert on probable deadlocks if the second lock isnt try_lock

* locking: teach Clang's -Wthread-safety to cope with our scoped lock macros

This allows us to use function/variable/class attributes to specify locking
requisites, allowing problems to be detected during static analysis.

This works perfectly with newer Clang versions (tested with 3.3-3.7). For older
versions (tested 3.2), it compiles fine but spews lots of false-positives.

* locking: add a quick example of GUARDED_BY

This was chosen not because it's necessarily helpful, but because its locking
assumptions were already correct.

* Don't share objects between TestInstances

* Remove src/qt.

Signed-off-by: Daira Hopwood <>

* Update release to 1.0.7, generate manpages

* Add 1.0.7 release notes and update

* Update debian changelog for 1.0.7 release process

* Update README for 1.0.7 release

* Document returned results of submitblock

* License updates for removal of src/qt.

Signed-off-by: Daira Hopwood <>

* Correct license text for LGPL.

Signed-off-by: Daira Hopwood <>

* Remove QT gunk from Makefiles.

Signed-off-by: Daira Hopwood <>

* Remove some more QT-related stragglers.

Signed-off-by: Daira Hopwood <>

* Update documentation for QT removal.

Signed-off-by: Daira Hopwood <>

* Update which libraries are allowed to be linked to zcashd by

Signed-off-by: Daira Hopwood <>

* Remove NO_QT make option.

Signed-off-by: Daira Hopwood <>

* .gitignore cache/ and venv-mnf/

Signed-off-by: Daira Hopwood <>

* Remove unused packages and patches.

Signed-off-by: Daira Hopwood <>

* Add -t to git fetch for

* Update version to 1.0.7-1

* Update auto-generated manpages to 1.0.7-1

* Add updated release notes for v1.0.7-1

* Update debian package changelog for 1.0.7+1 (use + instead of - for debian versioning)

* Remove stale Qt comments and dead code

* Delete -rootcertificates from bash completion script.

Signed-off-by: Daira Hopwood <>

* Add anchor to output of getblock

Closes #2164.

* Remove QT translation support files

* Remove redundant gui options from build scripts

* Edit for clarity

* Implement accurate memory accounting for mempool

* Separate core memory usage computation in core_memusage.h

* Implement REST mempool API, add test and documentation.

* Migrate IncrementalMerkleTree memory usage calls

* Removed markdown from COPYING

Updated the Copyright statement at the top of the file from "2016" to "2016-2017" and removed markdown markup from the main text.

* Add tests for getmempoolinfo

* Usability improvements for z_importkey

- Add height parameter to z_importkey to reduce rescan range
- Change semantics of rescan parameter, so users can explicitly force a rescan
  for existing keys.

Closes #2032

* Updated the Bitcoin Core copyright statement

* Introduce librustzcash and Rust to depends system.

* Allow Rust-language related assets to be disabled with `--disable-rust`.

* Implement an AtomicTimer

* Use AtomicTimer for more accurate local solution rate

* Metrics: Move local solution rate into stats

* Metrics: Improve mining status

* Expand on reasons for mining being paused

* Simplify z_importkey by making rescan a string

Transparently handles older boolean values as well.

* libevent: add depends

* build: build-system changes for libevent

* evhttpd implementation

- *Replace usage of boost::asio with [libevent2](*.
boost::asio is not part of C++11, so unlike other boost there is no
forwards-compatibility reason to stick with it. Together with #4738 (convert
json_spirit to UniValue), this rids Bitcoin Core of the worst offenders with
regard to compile-time slowness.

- *Replace spit-and-duct-tape http server with evhttp*. Front-end http handling
is handled by libevent, a work queue (with configurable depth and parallelism)
is used to handle application requests.

- *Wrap HTTP request in C++ class*; this makes the application code mostly

- *Refactor RPC to move all http-specific code to a separate file*.
Theoreticaly this can allow building without HTTP server but with another RPC
backend, e.g. Qt's debug console (currently not implemented) or future RPC
mechanisms people may want to use.

- *HTTP dispatch mechanism*; services (e.g., RPC, REST) register which URL
paths they want to handle.

By using a proven, high-performance asynchronous networking library (also used
by Tor) and HTTP server, problems such as #5674, #5655, #344 should be avoided.

What works? bitcoind, bitcoin-cli, bitcoin-qt. Unit tests and RPC/REST tests
pass. The aim for now is everything but SSL support.

Configuration options:

- `-rpcthreads`: repurposed as "number of  work handler threads". Still
defaults to 4.

- `-rpcworkqueue`: maximum depth of work queue. When this is reached, new
requests will return a 500 Internal Error.

- `-rpctimeout`: inactivity time, in seconds, after which to disconnect a

- `-debug=http`: low-level http activity logging

* doc: remove documentation for rpcssl

* qa: Remove -rpckeepalive tests from httpbasics

This option was a temporary workaround, and is no longer necessary
with the new web server.

* Remove rpc_boostasiotocnetaddr test

Dropping all use of boost::asio.

* tests: GET requests cannot have request body, use POST in

Sending a request body with GET request is not valid in HTTP spec, and
not compatible with evhttpd.

* Implement RPCTimerHandler for Qt RPC console

Implement RPCTimerHandler for Qt RPC console, so that `walletpassphrase`
works with GUI and `-server=0`.

Also simplify HTTPEvent-related code by using boost::function directly.

Zcash: QT changes ommitted

* Fix race condition between starting HTTP server thread and setting EventBase()

Split StartHTTPServer into InitHTTPServer and StartHTTPServer to give
clients a window to register their handlers without race conditions.

Thanks @ajweiss for figuring this out.

* Document options for new HTTP/RPC server in --help

* libevent: Windows reuseaddr workaround in depends

Make it possible to reuse sockets.
This is necessary to make the RPC tests work in WINE.

* Move windows socket init to utility function

* Revert "rpc-tests: re-enable rpc-tests for Windows"

This reverts commit bd30c3dced21fca869a14c75081f15195762afe1.

Disable windows RPC tests for now. These should be re-enabled once a
suitable Wine version is used on Travis.

* init: Ignore SIGPIPE

Ignore SIGPIPE on all non-win32 OSes, otherwise an unexpectedly disconnecting
RPC client will terminate the application. This problem was introduced
with the libhttp-based RPC server.

Fixes #6660.

* http: Disable libevent debug logging, if not explicitly enabled

Add a option "-debug=libevent" to enable libevent debugging for troubleshooting.
Libevent logging is redirected to our own log.

* rpc: Split option -rpctimeout into -rpcservertimeout and -rpcclienttimeout

The two timeouts for the server and client, are essentially different:

- In the case of the server it should be a lower value to avoid clients
clogging up connection slots

- In the case of the client it should be a high value to accomedate slow
  responses from the server, for example for slow queries or when the
  lock is contended

Split the options into `-rpcservertimeout` and `-rpcclienttimeout` with
respective defaults of 30 and 900.

* Make RPC tests cope with server-side timeout between requests

Python's httplib does not graciously handle disconnections from the http server, resulting in BadStatusLine errors.
See "httplib persistent connections violate MUST in RFC2616 sec 8.1.4."

This was fixed in Python 3.5.

Work around it for now.

* Add explicit shared_ptr constructor due to C++11 error

* Avoid a compile error on hosts with libevent too old for EVENT_LOG_WARN.

This uses _EVENT_LOG_WARN instead, which appears to be defined in the
 old versions of libevent that I have on some systems.

* chain: define enum used as bit field as uint32_t

Bitwise logic combined with `<` with undefined signedness will
potentially results in undefined behavior. Fix this by defining the type
as a c++11 typed enum.

Fixes #6017.

* auto_ptr → unique_ptr

Change the few occurrences of the deprecated `auto_ptr` to c++11 `unique_ptr`.
Silences the deprecation warnings.

Also add a missing `std::` for consistency.

* bitcoin-cli: More detailed error reporting

Register a evhttp error handler to get a more detailed error message
if the HTTP request fails.

* depends: Add libevent compatibility patch for windows

Add a patch that seems to be necessary for compatibilty of libevent
2.0.22 with recent mingw-w64 gcc versions (at least GCC 5.3.1 from Ubuntu

Without this patch the Content-Length in the HTTP header ends up as
`Content-Length: zu`, causing communication between the RPC
client and server to break down. See discussion in #8653.


Thanks to @sstone for the suggestion.

* Add common failure cases for rpc server connection failure

* bitcoin-cli: Make error message less confusing

Sorry for the churn on this, but the current message (introduced in #9073)
isn't acceptable:

    $ src/bitcoin-cli getinfo
    rpc: couldn't connect to server
    (make sure server is running and you are connecting to the correct RPC port: -1 unknown)

Putting the error code after the words "RPC port" made me wonder whether
there was a port configuration issue.

This changes it to:

    $ src/bitcoin-cli getinfo
    error: couldn't connect to server: unknown (code -1)
    (make sure server is running and you are connecting to the correct RPC port)

* Added std::unique_ptr<> wrappers with deleters for libevent modules.

* Switched bitcoin-cli.cpp to use RAII unique pointers with deleters.

* Added some simple tests for the RAII-style events.

* Added EVENT_CFLAGS to test makefile to explicitly include libevent headers.

* [depends] libevent 2.1.7rc

* Skip RAII event tests if libevent is built without event_set_mem_functions

* Revert "Closes #1680, temporary fix for rpc deadlock inherited from upstream."

This reverts commit f4404d7.

* Add libevent to zcash-gtest

* Docs: add details to -rpcclienttimeout doc

* [depends] libevent 2.1.8

* Test boolean fallback in z_importkey

* Add security warning to zcash-cli --help and --version message output

* Closes #2186. RPC getblock now accepts height or hash.

* Require that z_importkey height parameter be in valid range

* Add security warning to zcashd metrics display

* [TRIVIAL] Fix typo: exactmath -> exactmatch

... but not yet in trivial tree

* Fix interrupted HTTP RPC connection workaround for Python 3.5+

* test: Avoid ConnectionResetErrors during RPC tests

This is necessary on FreeBSD and MacOSX, at least.

See bitcoin/bitcoin#8834 (comment)

* Add security message to license text, rm url from translation string

* Update LocalSolPS test

* Add AtomicTimer tests

* Revert "Revert "rpc-tests: re-enable rpc-tests for Windows""

This reverts commit 7fd5d4e.

We need to un-revert this before pulling in

* Wrap error string

* Fix typo

* Consolidate individual references to the current maximum peer connection
value of 125 into a single constant declaration.

* net: Automatically create hidden service, listen on Tor

Starting with Tor version it is possible, through Tor's control socket
API, to create and destroy 'ephemeral' hidden services programmatically.

This means that if Tor is running (and proper authorization is available),
bitcoin automatically creates a hidden service to listen on, without user
manual configuration. This will positively affect the number of available
.onion nodes.

- When the node is started, connect to Tor through control socket
- Send `ADD_ONION` command
- First time:
    - Make it create a hidden service key
    - Save the key in the data directory for later usage
- Make it redirect port 8333 to the local port 8333 (or whatever port we're listening on).
- Keep control socket connection open for as long node is running. The hidden service will
  (by default) automatically go away when the connection is closed.

* Better error message if Tor version too old

* torcontrol improvements and fixes

- Force AUTHCOOKIE size to be 32 bytes: This provides protection against
  an attack where a process pretends to be Tor and uses the cookie
  authentication method to nab arbitrary files such as the
- torcontrol logging
- fix cookie auth
- add HASHEDPASSWORD auth, fix fd leak when fwrite() fails
- better error reporting when cookie file is not ok
- better init/shutdown flow
- stop advertizing service when disconnected from tor control port

* doc: update docs for Tor listening

- add new data directory files for 0.12 to doc/
- mention torcontrol in doc/

* [doc] [tor] Clarify when to use bind

c.f. #6585

* Connect to Tor hidden services by default

Adds for the .onion proxy if we can succesfully connect
to the control port.

Natural followup to creating hidden services automatically.

* torcontrol: only output disconnect if -debug=tor

* tests: Disable Tor interaction

This is unnecessary during the current tests (any test for Tor
interaction can explicitly enable it) and interferes with the proxy

* torcontrol debug: Change to a blanket message that covers both cases

* Fixing typos on and torcontrol.cpp

* Do not absolutely protect local peers from eviction.

With automatic tor HS support in place we should probably not be providing
 absolute protection for local peers, since HS inbound could be used to
 attack pretty easily.  Instead, this counts on the latency metric inside
 AttemptToEvictConnection to privilege actually local peers.

* Decide eviction group ties based on time.

This corrects a bug the case of tying group size where the code may
 fail to select the group with the newest member. Since newest time
 is the final selection criteria, failing to break ties on it
 on the step before can undermine the final selection.

Tied netgroups are very common.

* Remove vfReachable and modify IsReachable to only use vfLimited.

We do not know that a class of Network is reachable, only that it is not.

* Fix memleak in TorController [rework]

It looks like, TorController::disconnected_cb(TorControlConnection&
conn) gets called multiple times which results in multiple event_new().

Avoid this by creating the event only once in the constructore, and
deleting it only once in the destructor (thanks to Cory Fields for the

Replaces the fix by Jonas Schnelli in #7610, see discussion there.

* Fix torcontrol.cpp unused private field warning

* [doc] Update port in

Tor Browser Bundle spawns the Tor process and listens on port 9150, it doesn't randomly pick a port.

[ci skip]
(cherry picked from commit 1b63cf98347b2a62915425576930f55c2126c2ff)

* tor: Change auth order to only use HASHEDPASSWORD if -torpassword

Change authentication order to make it more clear (see #7700).

- If the `-torpassword` option is provided, force use of

- Give error message if `-torpassword` provided, but
  `HASHEDPASSWORD` auth is not available.

- Give error message if only `HASHEDPASSWORD` available, but
  `-torpassword` not given.

* Clarify documentation for running a tor node

Previous wording suggested that no additional setup was required for a
tor hidden service to be created.

* Clarify `listenonion`

> This new feature is enabled by default if Bitcoin Core is listening, and a connection to Tor can be made. It can be configured with the -listenonion, -torcontrol and -torpassword settings. To show verbose debugging information, pass -debug=tor.

But it is correct to say that the feature is enabled *regardless* of whether a connection to Tor can be made.

I propose to clarify that so that users can eliminate these in their logs (when `listen=1` and no Tor).
And I think it's okay to clarify about the `listen` option, because on several occasions when I read this before I always assumed `listening` meant `server=1` which cost me a lot of time in troubleshooting.

2016-10-24 06:19:22.551029 tor: Error connecting to Tor control socket
2016-10-24 06:19:22.551700 tor: Not connected to Tor control port, trying to reconnect


* torcontrol: Explicitly request RSA1024 private key

When generating a new service key, explicitly request a RSA1024 one.

The bitcoin P2P protocol has no support for the longer hidden service names
that will come with ed25519 keys, until it does, we depend on the old
hidden service type so make this explicit.

See #9214.

* Prevent -Wshadow warnings with gcc versions 4.8.5, 5.3.1 and 6.2.1.

Zcash: partial (ignoring src/test/script_tests.cpp due to merge conflicts)

* Make some global variables less-global (static)

* torcontrol: Improve comments

* torcontrol: Add unit tests for Tor reply parsers

* torcontrol: Fix ParseTorReplyMapping

- Ignore remaining input if it is an OptArguments
- Correctly handle escapes

* torcontrol: Check for reading errors in ReadBinaryFile

This ensures that ReadBinaryFile never returns exactly TOR_COOKIE_SIZE bytes if
the file was larger than that.

* Line-wrap privacy notice. Use <> around URL and end sentence with '.'.
Include privacy notice in help text for zcashd -help.

Signed-off-by: Daira Hopwood <>

* torcontrol: Log invalid parameters in Tor reply strings where meaningful

* Update version numbers.

Signed-off-by: Daira Hopwood <>

* Improvement to release process doc.

Signed-off-by: Daira Hopwood <>

* Generate man pages.

Signed-off-by: Daira Hopwood <>

* Update authors, release notes, and Debian package metadata.

Signed-off-by: Daira Hopwood <>

* Use a larger -rpcclienttimeout for slow performance measurements

Closes #2238.

* Don't rely on a finite upper bound on fee rate or priority.

Signed-off-by: Daira Hopwood <>

* Update tests to check actual infinity as well as INF_FEERATE

* Add unit test for security issue 2017-04-11.a

* Simplify JoinSplit priority calculation. refs 1896

Signed-off-by: Daira Hopwood <>

* Add check for JoinSplit priority as calculated by CCoinsViewCache::GetPriority.

Signed-off-by: Daira Hopwood <>

* Update text to Zclassic

* User Zcash repos for depends

* Remove Zclassic references

* Add libevents to gtest makefile
zkbot added a commit to zcash/zcash that referenced this pull request Sep 18, 2017
Rationalize currency unit to "ZEC"

Cherry-picked from the upstream PR bitcoin/bitcoin#6504

Part of #2074
@rnicoll rnicoll deleted the rnicoll:normalize-units branch Mar 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

6 participants
You can’t perform that action at this time.