Commit Graph

7362 Commits

Author SHA1 Message Date
Amgad Abdelhafez 8dafb9c6ce Update timedata.cpp
Capitalizing the 'z' in "Zcash" string
2017-05-05 11:24:48 -04:00
Amgad Abdelhafez bed9dd2cd2 Update timedata.cpp
Changing error message string from botcoin core to zcash
2017-05-02 19:33:52 -04:00
Daira Hopwood 8d8318c947 Alert 1003 (versions 1.0.3-1.0.8 inclusive).
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2017-04-24 19:55:20 +01:00
Daira Hopwood fa151bc517 Alert 1002 (versions 1.0.0-1.0.2 inclusive).
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2017-04-24 19:42:12 +01:00
Jack Grigg 409606118b
Check that >3-digit octals are truncated. 2017-04-21 13:23:29 +12:00
Jack Grigg 8df5fd1116
Correctly handle three-digit octals with leading digit 4-7 2017-04-21 13:22:51 +12:00
Jack Grigg d15cab21bc
Address Daira's further comments 2017-04-21 13:15:39 +12:00
zkbot 20d61ac0ea Auto merge of #2270 - bitcartel:2269_change_regtest_port, r=daira
Change regtest port to 18344.  Closes #2269.
2017-04-19 11:07:49 +00:00
Jack Grigg 0b431fbdb5
Address Daira's comments 2017-04-19 15:23:28 +12:00
Jack Grigg 519713d32e
torcontrol: Add missing copyright header 2017-04-18 12:54:22 +12:00
Jack Grigg b93cedafe4
torcontrol: Handle escapes in Tor QuotedStrings
https://trac.torproject.org/projects/tor/ticket/14999 is tracking an encoding
bug with the Tor control protocol, where many of the QuotedString instances that
Tor outputs are in fact CStrings, but it is not documented which ones are which.

https://spec.torproject.org/control-spec section 2.1.1 provides a future-proofed
rule for handing QuotedStrings, which this commit implements.
2017-04-18 12:54:16 +12:00
zkbot 8e96dc44dd Auto merge of #2205 - arcalinea:1804_zcash_addresses_in_help, r=daira
Change help text examples to use Zcash addresses

Closes #1804 and #2109

Ensures command line help text addresses are Zcash addresses.

Didn't change the text strings that say bitcoin or btc, leaving that for #2150 to close

Did I get all the addresses?
2017-04-17 15:49:37 +00:00
Simon 05844ba53b Change regtest port to 18344. Closes #2269. 2017-04-16 14:48:04 -07:00
zkbot f7f764e0b2 Auto merge of #2189 - bitcartel:1.0.7_with_apache_qpid, r=bitcartel
Add AMQP 1.0 support via Apache Qpid Proton C++ API 0.17.0

Closes #2188
2017-04-16 15:09:19 +00:00
Nathan Wilcox 451047d14a Bump version numbers for v1.0.8-1. 2017-04-13 17:10:32 -07:00
Daira Hopwood 60b7410cce Add check for JoinSplit priority as calculated by CCoinsViewCache::GetPriority.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2017-04-13 22:40:37 +01:00
Daira Hopwood ec19e8e283 Simplify JoinSplit priority calculation. refs 1896
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2017-04-13 22:40:20 +01:00
str4d c83c5932e4 Add unit test for security issue 2017-04-11.a 2017-04-13 17:59:36 +01:00
str4d e40180aa0f Update tests to check actual infinity as well as INF_FEERATE 2017-04-13 17:59:36 +01:00
Daira Hopwood 0090c64534 Don't rely on a finite upper bound on fee rate or priority.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2017-04-13 17:59:36 +01:00
Daira Hopwood 5a49c929dd Delete old protocol version constants and simplify code that used them.
fixes #2244

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2017-04-09 13:19:48 +01:00
Jack Grigg 0d0265fd11
Use AtomicTimer for metrics screen thread count 2017-03-29 18:25:09 +13:00
Wladimir J. van der Laan 2854c4e366
Remove ChainParams::DefaultMinerThreads
No longer relevant after #5957. This hack existed because of another
hack where the numthreads parameter, on regtest, doubled as how many
blocks to generate.
2017-03-29 16:06:02 +13:00
Wladimir J. van der Laan da1357e6cc
Use real number of cores for default -par, ignore virtual cores
To determine the default for `-par`, the number of script verification
threads, use [boost:🧵:physical_concurrency()](http://www.boost.org/doc/libs/1_58_0/doc/html/thread/thread_management.html#thread.thread_management.thread.physical_concurrency)
which counts only physical cores, not virtual cores.

Virtual cores are roughly a set of cached registers to avoid context
switches while threading, they cannot actually perform work, so spawning
a verification thread for them could even reduce efficiency and will put
undue load on the system.

Should fix issue #6358, as well as some other reported system overload
issues, especially on Intel processors.

The function was only introduced in boost 1.56, so provide a utility
function `GetNumCores` to fall back for older Boost versions.
2017-03-29 16:06:00 +13:00
Daira Hopwood 83aac13083 Update version numbers.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2017-03-27 21:01:18 +01:00
zkbot 45faa928ec Auto merge of #2177 - str4d:2061-tor-ephemeral-hs, r=daira
Tor ephemeral hidden services

Cherry-picked from the following upstream PRs:

- bitcoin/bitcoin#6503 (included to reduce merge conflicts)
- bitcoin/bitcoin#6639
- bitcoin/bitcoin#6643
- bitcoin/bitcoin#7090
- bitcoin/bitcoin#7035
- bitcoin/bitcoin#7170
- bitcoin/bitcoin#7218 (non-QT part)
- bitcoin/bitcoin#7313
- bitcoin/bitcoin#7438
- bitcoin/bitcoin#7553
- bitcoin/bitcoin#7637
- bitcoin/bitcoin#7683
- bitcoin/bitcoin#7813
- bitcoin/bitcoin#7703
- bitcoin/bitcoin#8203
- bitcoin/bitcoin#9004
- bitcoin/bitcoin#9234
- bitcoin/bitcoin#9911 (partial)

Closes #2061.
2017-03-26 02:44:06 +00:00
zkbot f7fcad709b Auto merge of #2203 - arcalinea:2142_security_log_message, r=daira
Add message directing users to security guide

Addresses #2142, which was blocking on updates to zcash/support/security.html. That page has now been added, so this message directing users to the site can be included.

It displays in the zcash-cli --help and --version message text, and on the zcashd metrics screen.
2017-03-26 01:36:24 +00:00
Jack Grigg 87b7f4d878
torcontrol: Log invalid parameters in Tor reply strings where meaningful 2017-03-26 14:35:13 +13:00
Daira Hopwood f0d1accb7d 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 <daira@jacaranda.org>
2017-03-26 02:08:29 +01:00
Jack Grigg 3290567bbd
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.
2017-03-26 13:53:13 +13:00
Simon 99eb947a98 Add AMQP 1.0 support via Apache Qpid Proton C++ API 0.17.0 2017-03-25 08:51:40 -07:00
Jack Grigg 64101d0407
torcontrol: Fix ParseTorReplyMapping
- Ignore remaining input if it is an OptArguments
- Correctly handle escapes
2017-03-26 00:35:13 +13:00
Jack Grigg 6dbd95afa1
torcontrol: Add unit tests for Tor reply parsers 2017-03-26 00:34:53 +13:00
Jack Grigg 8966598033
torcontrol: Improve comments 2017-03-25 20:25:59 +13:00
Pavel Janík 4b5ba449bb
Make some global variables less-global (static) 2017-03-25 20:25:57 +13:00
Pavel Janík f0e9019223
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)
2017-03-25 20:25:56 +13:00
Wladimir J. van der Laan 9e5c9d0a04
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.
2017-03-25 20:25:55 +13:00
Wladimir J. van der Laan ca5e229514
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
  `HASHEDPASSWORD` auth.

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

- Give error message if only `HASHEDPASSWORD` available, but
  `-torpassword` not given.
2017-03-25 20:25:50 +13:00
Jonas Schnelli 1a41e3f660
Fix torcontrol.cpp unused private field warning 2017-03-25 20:25:48 +13:00
Wladimir J. van der Laan 3d7cddcaa2
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
idea).

Replaces the fix by Jonas Schnelli in #7610, see discussion there.
2017-03-25 20:25:46 +13:00
Patrick Strateman a05be280e7
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.
2017-03-25 20:25:45 +13:00
Gregory Maxwell f28a87b4ba
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.
2017-03-25 20:25:44 +13:00
Gregory Maxwell 35db253fb6
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.
2017-03-25 20:25:42 +13:00
calebogden e10e212470
Fixing typos on security-check.py and torcontrol.cpp 2017-03-25 20:25:41 +13:00
MarcoFalke 9b46a35b8d
torcontrol debug: Change to a blanket message that covers both cases 2017-03-25 20:25:39 +13:00
Daniel Cousens 65fd8eb134
torcontrol: only output disconnect if -debug=tor 2017-03-25 20:25:35 +13:00
Peter Todd 2b30758b2f
Connect to Tor hidden services by default
Adds 127.0.0.1:9050 for the .onion proxy if we can succesfully connect
to the control port.

Natural followup to creating hidden services automatically.
2017-03-25 20:24:58 +13:00
Wladimir J. van der Laan 975dc649af
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
  wallet
- 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
- COOKIE->SAFECOOKIE auth
2017-03-25 20:22:12 +13:00
Peter Todd 77e5601e9e
Better error message if Tor version too old 2017-03-25 20:22:11 +13:00
Wladimir J. van der Laan eb5f63fe58
net: Automatically create hidden service, listen on Tor
Starting with Tor version 0.2.7.1 it is possible, through Tor's control socket
API, to create and destroy 'ephemeral' hidden services programmatically.
https://stem.torproject.org/api/control.html#stem.control.Controller.create_ephemeral_hidden_service

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.
2017-03-25 20:22:09 +13:00
Matt Quinn 8a5ae3c7a9
Consolidate individual references to the current maximum peer connection
value of 125 into a single constant declaration.
2017-03-25 20:22:07 +13:00
zkbot f9f48667be Auto merge of #2176 - str4d:1593-libevent, r=bitcartel
libevent-based http server

Cherry-picked from the following upstream PRs:

- bitcoin/bitcoin#5677
- bitcoin/bitcoin#6695
- bitcoin/bitcoin#6899
- bitcoin/bitcoin#7016
- bitcoin/bitcoin#7964
- bitcoin/bitcoin#8722
- bitcoin/bitcoin#8730
- bitcoin/bitcoin#9073
- bitcoin/bitcoin#9265
- bitcoin/bitcoin#9387
- bitcoin/bitcoin#9471
- bitcoin/bitcoin#9647
- bitcoin/bitcoin#9903
- bitcoin/bitcoin#6640
- bitcoin/bitcoin#8139
- bitcoin/bitcoin#8839

Closes #1593 and #1856.
2017-03-25 04:52:16 +00:00
Jack Grigg 3da13e885e
Fix typo 2017-03-25 17:40:27 +13:00
Jack Grigg 206e2b9737
Wrap error string 2017-03-25 17:39:56 +13:00
zkbot 2bdb37276e Auto merge of #2198 - str4d:2139-timer, r=str4d
Improve mining metrics

Closes #2139.
2017-03-25 00:08:47 +00:00
Jack Grigg 601f00f6fb
Add AtomicTimer tests 2017-03-25 13:06:00 +13:00
Jack Grigg 5c0d105b6b
Update LocalSolPS test 2017-03-25 12:57:22 +13:00
Jay Graber 704547965a Change help text examples to use Zcash addresses 2017-03-24 14:52:28 -07:00
Jay Graber ab1d2d575c Add security message to license text, rm url from translation string 2017-03-24 13:48:27 -07:00
paveljanik 17694e4bcf
[TRIVIAL] Fix typo: exactmath -> exactmatch
... but not yet in trivial tree
2017-03-24 18:42:45 +13:00
zkbot 6344719817 Auto merge of #2052 - str4d:2032-z_importkey-partial-rescan, r=bitcartel
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
2017-03-24 03:47:11 +00:00
Jay Graber 54c0a28123 Add security warning to zcashd metrics display 2017-03-23 20:43:23 -07:00
Jack Grigg 33589401ba
Require that z_importkey height parameter be in valid range 2017-03-24 16:07:53 +13:00
zkbot 23f792c2f5 Auto merge of #2187 - bitcartel:1.0.7_getblock_by_height, r=bitcartel
Closes #2186. RPC getblock now accepts height or hash.
2017-03-24 02:55:27 +00:00
Simon 7d3b152897 Closes #2186. RPC getblock now accepts height or hash. 2017-03-23 19:25:04 -07:00
Jay Graber efa9c265c4 Add security warning to zcash-cli --help and --version message output 2017-03-23 18:13:09 -07:00
Ian Kelling 629a875229
Docs: add details to -rpcclienttimeout doc 2017-03-24 09:03:59 +13:00
Luke Dashjr c65969a5a6
Skip RAII event tests if libevent is built without event_set_mem_functions 2017-03-24 09:03:59 +13:00
Karl-Johan Alm ca50af75b1
Added EVENT_CFLAGS to test makefile to explicitly include libevent headers. 2017-03-24 09:03:59 +13:00
Karl-Johan Alm e8b6d84b9f
Added some simple tests for the RAII-style events. 2017-03-24 09:03:59 +13:00
Karl-Johan Alm 68377e18a8
Switched bitcoin-cli.cpp to use RAII unique pointers with deleters. 2017-03-24 09:03:59 +13:00
Karl-Johan Alm 17fb609097
Added std::unique_ptr<> wrappers with deleters for libevent modules. 2017-03-24 09:03:59 +13:00
Wladimir J. van der Laan 7c2ab05969
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)
2017-03-24 09:03:59 +13:00
instagibbs 603205e381
Add common failure cases for rpc server connection failure 2017-03-24 09:03:59 +13:00
Wladimir J. van der Laan 6415573a59
bitcoin-cli: More detailed error reporting
Register a evhttp error handler to get a more detailed error message
if the HTTP request fails.
2017-03-24 09:03:59 +13:00
Wladimir J. van der Laan 08c581940a
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.
2017-03-24 09:03:59 +13:00
Wladimir J. van der Laan 0e2b1ae259
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.
2017-03-24 09:03:59 +13:00
Gregory Maxwell 599d2c4034
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.
2017-03-24 09:03:59 +13:00
Bob McElrath c922edd00f
Add explicit shared_ptr constructor due to C++11 error 2017-03-24 09:03:59 +13:00
Wladimir J. van der Laan 89bccddcd8
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.
2017-03-24 09:03:59 +13:00
Wladimir J. van der Laan a659991a2c
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.
2017-03-24 09:03:59 +13:00
Wladimir J. van der Laan 7ed4d40c61
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.
2017-03-24 09:03:59 +13:00
Jack Grigg 077ddc1187
Add libevent to zcash-gtest 2017-03-24 09:03:59 +13:00
Wladimir J. van der Laan 167b6231c9
Move windows socket init to utility function 2017-03-24 09:03:59 +13:00
Wladimir J. van der Laan 116503c0b8
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.
2017-03-24 09:03:59 +13:00
Wladimir J. van der Laan 9fb5b94e64
Document options for new HTTP/RPC server in --help 2017-03-24 09:03:59 +13:00
Wladimir J. van der Laan 858afa1a4a
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
2017-03-24 09:03:59 +13:00
Wladimir J. van der Laan afd64f76ea
evhttpd implementation
- *Replace usage of boost::asio with [libevent2](http://libevent.org/)*.
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
HTTP-server-neutral

- *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
client.

- `-debug=http`: low-level http activity logging
2017-03-24 09:03:59 +13:00
Wladimir J. van der Laan df377ca82c
build: build-system changes for libevent 2017-03-24 09:03:59 +13:00
Wladimir J. van der Laan 72f52420ec
Remove rpc_boostasiotocnetaddr test
Dropping all use of boost::asio.
2017-03-24 09:03:59 +13:00
Jack Grigg bec25c91cb
Revert "Closes #1680, temporary fix for rpc deadlock inherited from upstream."
This reverts commit f4404d7b5b.
2017-03-24 09:03:59 +13:00
zkbot 7d9bf65501 Auto merge of #2168 - str4d:2164-getblock-anchor, r=daira
Add anchor to output of getblock

Closes #2164.
2017-03-23 18:21:10 +00:00
zkbot 00e59e5935 Auto merge of #2175 - str4d:2074-txn-mempool, r=bitcartel
Bitcoin 0.12 mempool memory usage PRs

Cherry-picked from the following upstream PRs:

- bitcoin/bitcoin#6410
- bitcoin/bitcoin#6453
- bitcoin/bitcoin#6013 (excludes changes to docs we deleted)

Part of #2074.
2017-03-23 17:29:35 +00:00
Jack Grigg b7e5b7d5ee
Simplify z_importkey by making rescan a string
Transparently handles older boolean values as well.
2017-03-23 15:57:11 +13:00
Jack Grigg 493d8d81fb
Expand on reasons for mining being paused 2017-03-23 15:16:04 +13:00
Jack Grigg af370021a0
Metrics: Improve mining status 2017-03-23 14:08:36 +13:00
Jack Grigg dd20d04679
Metrics: Move local solution rate into stats 2017-03-23 14:08:33 +13:00
Jack Grigg 07be8f7eb9
Use AtomicTimer for more accurate local solution rate 2017-03-23 14:07:52 +13:00
Jack Grigg 73bf85b44f
Implement an AtomicTimer 2017-03-23 14:07:29 +13:00
zkbot 3b11e24f92 Auto merge of #2183 - ebfull:rust-introduction, r=ebfull
Introduce Rust/librustzcash into the zcash build system

Introduces Rust into the build system and brings a trivial xor operation into the code (near where we will likely be working).
2017-03-21 03:40:12 +00:00
zkbot c4a7c9f20f Auto merge of #2157 - arcalinea:1652_submitblock_documentation, r=daira
Document returned results of submitblock

documentation for #1652
2017-03-20 17:11:50 +00:00
Sean Bowe 802ea76b3a Allow Rust-language related assets to be disabled with `--disable-rust`. 2017-03-18 07:47:40 -06:00
Sean Bowe 6a0c7ceae9 Introduce librustzcash and Rust to depends system. 2017-03-17 11:46:41 -06:00
Jack Grigg a31ba7a0cb
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
2017-03-16 19:34:41 +13:00
Jack Grigg 43a03e3bfc
Migrate IncrementalMerkleTree memory usage calls 2017-03-14 18:01:05 +13:00
Pavel Janík 30c163d99d
Implement REST mempool API, add test and documentation. 2017-03-14 13:52:06 +13:00
Pieter Wuille 6bd1d60c97
Separate core memory usage computation in core_memusage.h 2017-03-14 13:45:05 +13:00
Pieter Wuille bde5c8b0f1
Implement accurate memory accounting for mempool 2017-03-14 13:44:39 +13:00
zkbot a28b17b7b7 Auto merge of #1636 - daira:fix-licensing-and-remove-qt, r=str4d
Remove QT code

This removes the QT wallet code, and updates license documentation accordingly.
2017-03-10 23:47:43 +00:00
Jack Grigg 0bc1e2c431
Add anchor to output of getblock
Closes #2164.
2017-03-10 20:09:40 +13:00
Simon 07cf426404 Remove stale Qt comments and dead code 2017-03-09 17:04:59 -08:00
Jay Graber 0fe4b85708 Update version to 1.0.7-1 2017-03-08 12:50:33 -08:00
Daira Hopwood 38ba3c666f Remove QT gunk from Makefiles.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2017-03-07 19:15:08 +00:00
Jay Graber 552d755339 Document returned results of submitblock 2017-03-06 13:18:58 -08:00
Jay Graber a83f0677b4 Update release to 1.0.7, generate manpages 2017-03-03 21:55:36 -08:00
Daira Hopwood d395fee8a5 Remove src/qt.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2017-03-04 05:11:57 +00:00
zkbot a7cf698873 Auto merge of #2100 - str4d:2074-rpc, r=arcalinea
Bitcoin 0.12 RPC PRs 1

Cherry-picked from the following upstream PRs:

- bitcoin/bitcoin#6266
- bitcoin/bitcoin#6257
- bitcoin/bitcoin#6271
- bitcoin/bitcoin#6158
- bitcoin/bitcoin#6307
- bitcoin/bitcoin#6290
- bitcoin/bitcoin#6262
- bitcoin/bitcoin#6088
- bitcoin/bitcoin#6339
- bitcoin/bitcoin#6299 (partial, remainder in #2099)
- bitcoin/bitcoin#6350
- bitcoin/bitcoin#6247
- bitcoin/bitcoin#6362
- bitcoin/bitcoin#5486
- bitcoin/bitcoin#6417
- bitcoin/bitcoin#6398 (partial, remainder was included in #1950)
- bitcoin/bitcoin#6444
- bitcoin/bitcoin#6456 (partial, remainder was included in #2082)
- bitcoin/bitcoin#6380
- bitcoin/bitcoin#6970

Part of #2074.
2017-03-04 02:57:46 +00:00
zkbot dadb1ab74c Auto merge of #2101 - str4d:2074-tests, r=arcalinea
Bitcoin 0.12 test PRs 1

Cherry-picked from the following upstream PRs:

- bitcoin/bitcoin#6337
- bitcoin/bitcoin#6390
- bitcoin/bitcoin#5515
- bitcoin/bitcoin#6287 (partial, remainder included in bitcoin/bitcoin#6703)
- bitcoin/bitcoin#6465

Part of #2074.
2017-03-03 21:25:03 +00:00
Cory Fields 72b25b0ffd
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.
2017-03-03 11:47:10 -08:00
Cory Fields 5093299af0
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.
2017-03-03 11:47:08 -08:00
Matt Corallo 8e4bc69d1f
Assert on probable deadlocks if the second lock isnt try_lock 2017-03-03 11:47:02 -08:00
Wladimir J. van der Laan 1eb6654314
tests: Fix bitcoin-tx signing testcase
Fixes wrong scriptPubkey problem, which caused the transaction to
not actually be signed.
2017-03-03 11:47:01 -08:00
Gavin Andresen abb0e8cced
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.
2017-03-03 11:46:59 -08:00
Jonas Schnelli 4d1d95310f
don't try to decode invalid encoded ext keys 2017-03-03 10:57:27 -08:00
Jonas Schnelli 51878774bf
extend bip32 tests to cover Base58c/CExtKey decode 2017-03-03 10:57:25 -08:00
Jonas Schnelli 53bcf8379a
fix and extend CBitcoinExtKeyBase template
- fix Decode call (req. only one param)
- add constructor for base58c->CExtKey
2017-03-03 10:57:24 -08:00
Adam Weiss 8550bcfeca
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
ShrinkDebugFile().

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.
2017-03-03 10:57:23 -08:00
Pavel Vasin 2af5a65066
remove unused inv from ConnectTip() 2017-03-03 10:57:22 -08:00
Jonas Schnelli f061578b8f
[bitcoin-cli] improve error output 2017-03-03 10:57:17 -08:00
Luke Dashjr a79c8e24a5
Fix various warnings
Found while building on Debian 7
2017-03-03 10:57:15 -08:00
Wladimir J. van der Laan 55fca515d8
build: Remove -DBOOST_SPIRIT_THREADSAFE
Now that boost spirit is no longer used, `-DBOOST_SPIRIT_THREADSAFE`
doesn't need to be passed to the compiler anymore.
2017-03-03 10:57:14 -08:00
Wladimir J. van der Laan 8d9719e0ef
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.
2017-03-03 10:57:12 -08:00
Philip Kaufmann da7579184e
make CAddrMan::size() return the correct type of size_t 2017-03-03 10:57:11 -08:00
Jorge Timón e079f010bf
Consensus: Refactor: Separate Consensus::CheckTxInputs and GetSpendHeight in CheckInputs
Zcash:
- Replaces some of the refactoring performed in #1017
- Exposed Consensus::CheckTxInputs for testing
2017-03-03 10:57:09 -08:00
Philip Kaufmann fbbd3cc638
[init] add -blockversion help and extend -upnp help 2017-03-03 10:57:08 -08:00
Pieter Wuille bfa832c7ed
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
do.

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.
2017-03-03 10:57:07 -08:00
Philip Kaufmann db954a65ac
use const references where appropriate 2017-03-03 10:57:05 -08:00
Peter Todd 5e478618e6
Improve comment explaining purpose of MAX_MONEY constant 2017-03-03 10:56:49 -08:00
Jack Grigg 14454a3a82
Fix typo in listbanned RPC keys 2017-03-02 13:26:34 -08:00
Jack Grigg 4acd140eeb
Update default RPC port in help strings 2017-03-02 13:26:34 -08:00
Jack Grigg 3c014397a9
BTC -> ZEC in paytxfee RPC docs
Revert before merging bitcoin/bitcoin#6504.
2017-03-02 13:26:34 -08:00
Wladimir J. van der Laan 56215c77d8
Fix crash in validateaddress with -disablewallet
Fix a null pointer dereference in validateaddress with -disablewallet. Also add a regression testcase.
2017-03-02 13:26:34 -08:00
Wladimir J. van der Laan 84d1d5fd6f
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.
2017-03-02 13:26:34 -08:00
zathras-crypto a11c4bbd26
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 <zathrasc@gmail.com>
Date:   Wed Mar 25 02:04:02 2015 -0700

Changes:

- cherry-picked on top of bitcoin:master
- added RPC test for fundrawtransaction
2017-03-02 13:26:34 -08:00
Wladimir J. van der Laan ce83df8fc4
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.
2017-03-02 13:23:03 -08:00
Jonas Schnelli 81eb80d841
[REST] add JSON support for /rest/headers/ 2017-03-02 13:23:03 -08:00
Forrest Voight 483672f772
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.
2017-03-02 13:23:03 -08:00
Jack Grigg 0352b37bff
Adjust blockheaderToJSON() for Zcash block header 2017-03-02 13:23:03 -08:00
Peter Todd d3d5483eef
Add getblockheader RPC call
Alternative to getblock that works even when the block itself has been
pruned, returning all available information.
2017-03-02 13:23:03 -08:00
Jonas Schnelli 5548701eeb
UniValue: don't escape solidus, keep espacing of reverse solidus
Zcash: The UniValue changes are already merged; this updates the test
2017-03-02 13:23:03 -08:00
Matt Corallo 3d8013a01b
Add fundrawtransaction RPC method 2017-03-02 13:23:03 -08:00
Matt Corallo aa30f65502
Add FundTransaction method to wallet
Some code stolen from Jonas Schnelli <jonas.schnelli@include7.ch>
2017-03-02 13:23:03 -08:00
Matt Corallo b6616548ce
Small tweaks to CCoinControl for fundrawtransaction 2017-03-02 13:23:03 -08:00
Pieter Wuille 18e804a925
Add DummySignatureCreator which just creates zeroed sigs 2017-03-02 13:23:03 -08:00
dexX7 9c7167d1bc
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:
```js
validateaddress "n4KWZKx349gdMQGgTnZ8W6WfgSwybkGSK3"
{
  "isvalid": true,
  "address": "n4KWZKx349gdMQGgTnZ8W6WfgSwybkGSK3",
  "scriptPubKey": "76a914fa20d564550b105787f7ce3a9ad7fd9a45cd407088ac",
  "ismine": false,
  "iswatchonly": false,
  "isscript": false
}
```
```js
validateaddress "2N2g2H7gjA8a11g1yKBgh5VTqndyvbnWpBK"
{
  "isvalid": true,
  "address": "2N2g2H7gjA8a11g1yKBgh5VTqndyvbnWpBK",
  "scriptPubKey": "a9146769c19a16c9400b908756e19a4d2afb9e9760e187",
  "ismine": false,
  "iswatchonly": false,
  "isscript": true
}
```

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

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

All keys available:
```js
validateaddress "n4KWZKx349gdMQGgTnZ8W6WfgSwybkGSK3"
{
  "isvalid": true,
  "address": "n4KWZKx349gdMQGgTnZ8W6WfgSwybkGSK3",
  "scriptPubKey": "76a914fa20d564550b105787f7ce3a9ad7fd9a45cd407088ac",
  "ismine": true,
  "iswatchonly": false,
  "isscript": false,
  "pubkey": "02537357b156a33306a7a014a3748631c59df405b56f11ba4aa4a3ce81501af095",
  "iscompressed": true,
  "account": ""
}
```
```js
validateaddress "2N2g2H7gjA8a11g1yKBgh5VTqndyvbnWpBK"
{
  "isvalid": true,
  "address": "2N2g2H7gjA8a11g1yKBgh5VTqndyvbnWpBK",
  "scriptPubKey": "a9146769c19a16c9400b908756e19a4d2afb9e9760e187",
  "ismine": true,
  "iswatchonly": false,
  "isscript": true,
  "script": "multisig",
  "hex": "522102537357b156a33306a7a014a3748631c59df405b56f11ba4aa4a3ce81501af0952102f1fb200390e7864ef4450c07b15988179a57c3cf3a878f668e1070cb615749fe52ae",
  "addresses": [
    "n4KWZKx349gdMQGgTnZ8W6WfgSwybkGSK3",
    "mmSKNtbYYHRrhTLKiok5TuYrGEs4Y2A4k6"
  ],
  "sigsrequired": 2,
  "account": ""
}
```
2017-03-02 13:23:03 -08:00
Wladimir J. van der Laan a0455eca11
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.
2017-03-02 13:23:03 -08:00
Jonas Schnelli cbf3ab51f9
fix lock issue for QT node diconnect and RPC disconnectnode
Zcash: only RPC disconnectnode
2017-03-02 13:23:03 -08:00
Jonas Schnelli fa80be8ff5
setban: add IPv6 tests 2017-03-02 13:23:03 -08:00
Jonas Schnelli 0382246bb1
fix missing lock in CNode::ClearBanned() 2017-03-02 13:23:03 -08:00
Jonas Schnelli 1cad8c9ff9
setban: add RPCErrorCode 2017-03-02 13:23:03 -08:00
Jonas Schnelli 171b4de8d9
fix CSubNet comparison operator 2017-03-02 13:23:03 -08:00
Jonas Schnelli fcc8920f36
setban: rewrite to UniValue, allow absolute bantime 2017-03-02 13:23:03 -08:00
Jonas Schnelli 63c06b232b
rename json field "bannedtill" to "banned_until" 2017-03-02 13:23:03 -08:00
Jonas Schnelli e521939942
[RPC] extend setban to allow subnets 2017-03-02 13:23:03 -08:00
Jonas Schnelli 445cd761c5
[net] remove unused return type bool from CNode::Ban() 2017-03-02 13:23:03 -08:00
Jonas Schnelli 962ec4b5e4
[QA] add setban/listbanned/clearbanned tests 2017-03-02 13:23:03 -08:00
Jonas Schnelli ed3f13a057
[RPC] add setban/listbanned/clearbanned RPC commands 2017-03-02 13:23:03 -08:00
Jonas Schnelli 997829713c
[net] extend core functionallity for ban/unban/listban 2017-03-02 13:23:03 -08:00
Alex van der Peet 94ee48c42a
New RPC command disconnectnode 2017-03-02 13:23:03 -08:00
Stephen 6699b42518
Add paytxfee to getwalletinfo, warnings to getnetworkinfo 2017-03-02 13:23:03 -08:00
Daniel Kraft e940185294
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.
2017-03-02 13:23:03 -08:00
zkbot 28a5393401 Auto merge of #2138 - daira:2137.compactsize-portability.0, r=arcalinea
Don't assume sizes of unsigned short and unsigned int in GetSizeOfCompactSize and WriteCompactSize.

Fixes #2137

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2017-03-02 21:07:20 +00:00
zkbot 14711a4a43 Auto merge of #2141 - bitcartel:1969_free_rate_limiter, r=daira
Closes #1969. Large shielded transactions using the default fee are no longer treated as "free" transactions
2017-03-02 03:51:14 +00:00
zkbot c1cff6069f Auto merge of #2130 - str4d:2095-metrics-reindex-msg, r=arcalinea
Do not ask a UI question on metrics screen

Based on bitcoin/bitcoin#8257.

Closes #2095.
2017-03-02 03:08:29 +00:00
zkbot 1a41597af8 Auto merge of #2114 - bitcartel:fix_fr_test_bug_and_new_testnet_addresses, r=daira
Closes #2113. Fixes bug in test and updates testnet fr addresses.

Updating the testnet fr addresses will introduce a consensus change on testnet, so all testnet nodes will be required to upgrade.  See #2113 for more information.
2017-03-02 02:18:33 +00:00
zkbot 312fbd9d0e Auto merge of #1932 - aniemerg:1522-pause-mining-for-joinsplit, r=arcalinea
Pause mining during JoinSplit creation

Closes #1522 .
2017-03-02 01:23:44 +00:00
Allan Niemerg 49c2cecb9f Pause mining during joinsplit creation 2017-03-01 16:54:26 -08:00
zkbot 44ccf1ff20 Auto merge of #2123 - bitcartel:2112_z_getoperationresult_returns_executing_status, r=arcalinea
Closes #2112 where z_getoperationresult could return stale status.

The problem was similar to a check-then-act race condition.  Status object was obtained from an operation, which might be in an 'executing' state.  Instead of checking the state recorded in the status object, the operation was queried again to see if it was in a finished state (failed,success,cancelled) and if yes, the status object was returned to the user.  However, if the operation had changed state in the background, the status object would be stale.
2017-03-02 00:24:26 +00:00
Simon ebe750a882 Part of #1969. Changing min fee calculation also changes the dust threshold. 2017-02-28 11:44:07 -08:00
Simon 0f724e716d 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.
2017-02-28 11:43:04 -08:00
zkbot 6f5d8fbe81 Auto merge of #2126 - bitcartel:checkpoint_mainnet_67500, r=daira
Add checkpoint at block 67500 (mainnet)

Close #2125
2017-02-28 01:01:56 +00:00
zkbot 98ddf87d18 Auto merge of #2128 - bitcartel:checkpoint_testnet_38000, r=daira
Add checkpoint at block 38000 (testnet)

Closes #2127
2017-02-28 00:12:04 +00:00
Daira Hopwood d76ed723c5 Don't assume sizes of unsigned short and unsigned int in GetSizeOfCompactSize and WriteCompactSize.
Fixes #2137

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2017-02-27 19:34:23 +00:00
Jack Grigg 0cd769fbb7
Treat metrics screen as non-interactive for now
Closes #2095
2017-02-23 12:55:14 +00:00
Jack Grigg f42cde3c30
Remove reference to -reindex-chainstate
Revert this when bitcoin/bitcoin#7917 is merged.
2017-02-23 12:42:28 +00:00
Pieter Wuille 5d66d0a11e
Do not ask a UI question from bitcoind 2017-02-23 12:40:45 +00:00
Simon 5a888f7294 Add testnet checkpoint at block 38000 2017-02-22 22:34:20 -08:00
Simon b897de531c Add mainnet checkpoint at block 67500 2017-02-22 21:36:44 -08:00
Simon 2f21206cfc Closes #2112 where z_getoperationresult could return stale status. 2017-02-22 16:14:56 -08:00
Simon 1003180260 Keep first three original testnet fr addresses so existing coinbase
transactions on testnet remain valid during upgrade.  New addresses
will be used starting from block 53127.
2017-02-22 11:04:17 -08:00
zkbot 4e338b0c36 Auto merge of #2093 - bitcartel:sent_network_alerts, r=daira
Closes #2092. Maintain record of alerts sent onto mainnet.
2017-02-20 17:28:40 +00:00
Simon 4340ec9705 Update founders reward addresses for testnet 2017-02-20 09:23:06 -08:00
Simon 2911b35712 Fix bug where test was generating but not saving keys to wallet on disk. 2017-02-20 09:23:06 -08:00
Simon f47269cda9 Add assert to check alert message length is valid 2017-02-17 11:55:41 -08:00
Leo Arias 82c754f628 Fix the path to the example configuration 2017-02-11 13:52:15 -06:00
Simon 2ddec8f0e4 Bump version to 1.0.6 as part of release process 2017-02-10 09:55:49 -08:00
zkbot 93baaeee3e Auto merge of #2081 - daira:1955-single-address-mining, r=bitcartel
Address @str4d's comment on #1965 about the case where -gen is not set

https://github.com/zcash/zcash/pull/1965#discussion_r100414069

Note that the case of calling the ``setgenerate true`` RPC with the wallet disabled was already handled correctly.

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2017-02-10 08:58:19 +00:00
zkbot eaaa5f625f Auto merge of #2082 - str4d:univalue-subtree, r=bitcartel
Add UniValue as subtree

Cherry-picked from the following upstream PRs:

- bitcoin/bitcoin#6637
- bitcoin/bitcoin#6239
- bitcoin/bitcoin#6379
- bitcoin/bitcoin#6456
- bitcoin/bitcoin#6788
2017-02-10 07:46:58 +00:00
zkbot e51bd1b556 Auto merge of #1990 - str4d:1985-replace-json-spirit-with-univalue, r=str4d
Convert entire source tree from json_spirit to UniValue

This PR cherry-picks bitcoin/bitcoin#6121 and then migrates the Zcash-specific code to UniValue.

Also cherry-picks:
- bitcoin/bitcoin#6241
- bitcoin/bitcoin#6234

Closes #1985.
2017-02-10 05:15:53 +00:00
Jack Grigg f54db399f2
Get rid of fPlus argument to FormatMoney in Zcash-specific code 2017-02-10 02:19:14 +00:00
Jack Grigg c24109ecc3
UniValue::getValues const reference 2017-02-10 02:19:12 +00:00
Jack Grigg 2cc6bab201
Update UniValue includes in Zcash-specific code 2017-02-10 02:19:06 +00:00
Cory Fields 1dc626314d
build: match upstream build change 2017-02-10 02:19:03 +00:00
Wladimir J. van der Laan a8c22cc4d1
util: use locale-independent parsing in ParseDouble
Use locale-indepent C++ based parsing instead of C's strtod,
which checks for different input based on the user's locale.
Fixes #6443.
2017-02-10 02:19:02 +00:00
Wladimir J. van der Laan 2aee461930
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
Dropped changes to qa/rpc-tests/rest.py pending addition of /rest/headers/
2017-02-10 02:19:01 +00:00
Wladimir J. van der Laan d5bf1afae9
rpc: Make ValueFromAmount always return 8 decimals
This is the format that was always returned to JSON clients.
The difference was not noticed before, because VREAL values
are post-processed by univalue.

By implementing the functionality directly it breaks the dependency
of rpcserver on utilmoneystr. FormatMoney is now only used for debugging
purposes.

To test, port over the formatting tests from util_tests.cpp to
rpc_tests.cpp.
2017-02-10 02:18:59 +00:00
Wladimir J. van der Laan fed500e2dd
rpc: Accept scientific notation for monetary amounts in JSON
Add a function `ParseFixedPoint` that parses numbers according
to the JSON number specification and returns a 64-bit integer.

Then this in `AmountFromValue`, rather than `ParseMoney`.

Also add lots of tests (thanks to @jonasschnelli for some of them).

Fixes issue #6297.
2017-02-10 02:18:58 +00:00
Wladimir J. van der Laan e76a3849c6
Changes necessary now that zero values accepted in AmountFromValue
- Add an accept test for zero amounts, and a reject test for negative
  amounts
- Remove ugly hack in `settxfee` that is no longer necessary
- Do explicit zero checks in wallet RPC functions
- Don't add a check for zero amounts in `createrawtransaction` - this
  could be seen as a feature
2017-02-10 02:18:57 +00:00
Wladimir J. van der Laan a5beb3a51b
Get rid of fPlus argument to FormatMoney
It's never used with any other value than false, the default.
2017-02-10 02:18:55 +00:00
Wladimir J. van der Laan c66dff3dc7
Don't go through double in AmountFromValue and ValueFromAmount
My prime gripe with JSON spirit was that monetary values still had to be
converted from and to floating point which can cause deviations (see #3759
and https://bitcoin.stackexchange.com/questions/22716/bitcoind-sendfrom-round-amount-error).

As UniValue stores internal values as strings, this is no longer
necessary. This avoids risky double-to-integer and integer-to-double
conversions completely, and results in more elegant code to boot.
2017-02-10 02:18:54 +00:00
Jonas Schnelli fbc98d7720
remove $(@F) and subdirs from univalue make 2017-02-10 02:18:52 +00:00
Jonas Schnelli a10a6e2a0e
[Univalue] add univalue over subtree
similar to secp256k1 include and compile univalue over a subtree
2017-02-10 02:18:51 +00:00
Jack Grigg 0025fb4b0e
Merge commit 'a4071034f6ad640ef91057fa3f45098c4933f444' as 'src/univalue' 2017-02-10 02:18:46 +00:00
Jonas Schnelli 7fc7bab25d
remove univalue, prepare for subtree 2017-02-10 00:56:22 +00:00
Jack Grigg 02972a1bcd
[cleanup] Simplify test code 2017-02-10 00:53:15 +00:00
Jack Grigg 873c40365a
[cleanup] Remove unused import 2017-02-10 00:53:14 +00:00
Jack Grigg cc71666a51
unsigned int -> size_t for comparing with UniValue.size() 2017-02-10 00:53:13 +00:00
Jack Grigg 5fb326d41d
Manually iterate over UniValue arrays in tests 2017-02-10 00:53:09 +00:00
Jack Grigg 0d37ae3a59
Migrate Zcash-specific code to UniValue 2017-02-10 00:52:57 +00:00
Jonas Schnelli f70084cf06
fix rpcmining/getblocktemplate univalue transition logic error 2017-02-10 00:35:24 +00:00
Jonas Schnelli b60e9f230f
fix util_tests.cpp clang warnings
was introduced with #6121
2017-02-10 00:35:24 +00:00
Jonas Schnelli 6b1e42bbfa
univalue: add type check unit tests 2017-02-10 00:35:24 +00:00
Wladimir J. van der Laan 4bcb9c9099
univalue: add strict type checking 2017-02-10 00:35:24 +00:00
Wladimir J. van der Laan 5960d70002
util: Add ParseInt64 and ParseDouble functions
Strict parsing functions for other numeric types.

- ParseInt64 analogous to ParseInt32, but for 64-bit values.
- ParseDouble for doubles.
- Make all three Parse* functions more strict (e.g. reject whitespace on
  the inside)

Also add tests.
2017-02-10 00:35:24 +00:00
Wladimir J. van der Laan ff67da37cd
Simplify RPCclient, adapt json_parse_error test
# Conflicts:
#	src/test/rpc_tests.cpp
2017-02-10 00:35:24 +00:00
Jonas Schnelli c288192b19
fix univalue json parse tests 2017-02-10 00:35:24 +00:00
Jonas Schnelli b47f3aea36
fix missing univalue types during constructing 2017-02-10 00:35:24 +00:00
Jonas Schnelli bf3f56025d
fix rpc batching univalue issue 2017-02-10 00:35:24 +00:00
Jonas Schnelli d014114d67
Remove JSON Spirit wrapper, remove JSON Spirit leftovers
- implement find_value() function for UniValue
- replace all Array/Value/Object types with UniValues, remove JSON Spirit to UniValue wrapper
- remove JSON Spirit sources
2017-02-10 00:35:24 +00:00
Jonas Schnelli 851f58f94e
remove JSON Spirit UniValue wrapper 2017-02-10 00:35:24 +00:00
Jonas Schnelli 565d26737a
fix rpc unit test, plain numbers are not JSON compatible object
UniValues read() does only read valid json.
2017-02-10 00:35:24 +00:00
Jonas Schnelli 9ccfdd9a01
univalue: correct bool support 2017-02-10 00:35:24 +00:00
Jonas Schnelli 49a5df0ef3
univalue: add support for real, fix percision and make it json_spirit compatible
- avoid breaking the API because of different number/percision handling
2017-02-10 00:35:24 +00:00
Jonas Schnelli 23f71dc740
special threatment for null,true,false because they are non valid json 2017-02-10 00:35:24 +00:00
Jonas Schnelli 38fc4b7090
expicit set UniValue type to avoid empty values 2017-02-10 00:35:24 +00:00
Jonas Schnelli 9756b7bd29
extend conversion to UniValue 2017-02-10 00:35:24 +00:00
Jeff Garzik ed21d5bd4b
Convert tree to using univalue. Eliminate all json_spirit uses. 2017-02-10 00:35:24 +00:00
Jeff Garzik 03912600e8
UniValue: export NullUniValue global constant 2017-02-10 00:35:24 +00:00
Jeff Garzik ec57cc0ffe
UniValue: prefer .size() to .count(), to harmonize w/ existing tree 2017-02-10 00:35:24 +00:00
zkbot f52293b982 Auto merge of #2078 - ebfull:uaf, r=bitcartel
Fix use after free in transaction_tests.

Fixes #2026
2017-02-10 00:29:57 +00:00
Daira Hopwood 3df7c4c8c0 Address @str4d's comment about the case where -gen is not set.
Also avoid shadowing mineToLocalWallet variable.

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2017-02-10 00:15:12 +00:00
zkbot 7d4ced95ed Auto merge of #2056 - str4d:2035-experimental-mode, r=bitcartel
Add a flag for enabling experimental features

Closes #2035.
2017-02-09 23:39:02 +00:00
Simon 6605125d4e Add comment about fix for #2026. 2017-02-09 15:17:21 -08:00
zkbot d32511c72c Auto merge of #2054 - str4d:2030-decoderawtransaction-joinsplit-fields, r=bitcartel
Show all JoinSplit components in getrawtransaction and decoderawtransaction

Closes #2030.
2017-02-09 22:56:01 +00:00
Jack Grigg b8eb37757b
Require -experimentalmode for wallet encryption 2017-02-09 22:10:58 +00:00
Jack Grigg 1f015f6afa
Add a flag for enabling experimental features 2017-02-09 22:10:58 +00:00
Sean Bowe 05ec7887f1 Fix use after free in transaction_tests. 2017-02-09 14:35:33 -07:00
zkbot 0c78782662 Auto merge of #1965 - str4d:1955-single-address-mining, r=bitcartel
Switch miner to P2PKH, add -mineraddress option

Closes #945 and #1955.
2017-02-09 20:58:00 +00:00
zkbot 253c610783 Auto merge of #2050 - str4d:2020-zmq, r=bitcartel
Add ZeroMQ notifications

Cherry-picked from the following upstream PRs:

- bitcoin/bitcoin#6103
- bitcoin/bitcoin#6684
- bitcoin/bitcoin#6686
- bitcoin/bitcoin#6736
- bitcoin/bitcoin#6739
- bitcoin/bitcoin#6743
- bitcoin/bitcoin#6768
- bitcoin/bitcoin#6779
- bitcoin/bitcoin#6810
- bitcoin/bitcoin#6927
- bitcoin/bitcoin#6980 (only upgrading zeromq)
- bitcoin/bitcoin#6680
- bitcoin/bitcoin#7058
- bitcoin/bitcoin#7621
- bitcoin/bitcoin#7335 (only parts affecting `zmq_test.py`)
- bitcoin/bitcoin#7853 (only parts affecting `zmq_test.py`)
- bitcoin/bitcoin#7762
- bitcoin/bitcoin#7993 (only upgrading zeromq)
- bitcoin/bitcoin#8238
- bitcoin/bitcoin#8701
- bitcoin/bitcoin#6685

Closes #2020.
2017-02-09 20:08:15 +00:00
Daira Hopwood 9bba9b37c8 Better error reporting for the !ENABLE_WALLET && ENABLE_MINING case.
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
2017-02-09 19:31:47 +00:00