Commit Graph

10486 Commits

Author SHA1 Message Date
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
Wladimir J. van der Laan d101d7b8e6
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 2aee461930
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 5bfd954fc6
[QA] remove rawtransactions.py from the extended test list
rawtransactions.py is already in the standard test list
2017-03-02 13:23:03 -08:00
Jonas Schnelli 897a370c39
[QA] fix possible reorg issue in rawtransaction.py/fundrawtransaction.py RPC test
- added missing mempool sync between block generations
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
mruddy 81ae51c883
add tests for the decodescript rpc. add mention of the rpc regression tests to the testing seciton of the main readme. 2017-03-02 13:23:03 -08:00
Wladimir J. van der Laan bf890b6518
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.
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
Jonas Schnelli 788d8e6a6f
fundrawtransaction tests 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 2ab237a088
add RPC tests for setban & disconnectnode 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 b75b2de004 Auto merge of #2124 - str4d:2086-help2man, r=str4d
Improve autogenerated manpages

Cherry-picked from bitcoin/bitcoin#8608.

Closes #2086.
2017-03-02 19:20:10 +00:00
Jack Grigg 633787060a
Update release process with gen-manpages.sh 2017-03-02 11:18:47 -08:00
Jack Grigg 1f5cc3fa74
Regenerate and collate Zcash manpages, delete Bitcoin ones 2017-03-02 11:18:46 -08:00
Jack Grigg a0e6d5a185
Adjust gen-manpages.sh for Zcash, use in Debian builds 2017-03-02 11:18:44 -08:00
nomnombtc 076406650c
improved gen-manpages.sh, includes bitcoin-tx and strips commit tag, now also runs binaries from build dir by default, added variables for more control 2017-03-02 11:18:43 -08:00
nomnombtc 4a558b2bea
regenerated all manpages with commit tag stripped, also add bitcoin-tx 2017-03-02 11:18:42 -08:00
nomnombtc 1b5e712c72
change help string --enable-man to --disable-man 2017-03-02 11:18:40 -08:00
nomnombtc abfcaefe3d
add conditional for --enable-man, default is yes 2017-03-02 11:18:22 -08:00
zkbot 6ee75b3b7b Auto merge of #2014 - arcalinea:test-prioritisetransaction, r=arcalinea
Test prioritisetransaction

After talking with @str4d about #1884 , I wrote a test for prioritisetransaction. It uses small blocks (11kb), and checks whether a transaction makes it into the next block after being prioritized by that node.

Should this be improved with a larger number of txs in the mempool, or by testing over multiple runs?

As for getblocktemplate(), it seems to return the prioritized transaction within the block size set by the node (about 50 txs fit in an 11kb block), but the block "sizelimit" it displays is set at 2 MB in `rpcmining.cpp` line 690:
```
result.push_back(Pair("sizelimit", (int64_t)MAX_BLOCK_SIZE));
```

This was quite confusing, I didn't think the `-blockmaxsize` parameter I was setting was working for awhile.
2017-03-02 06:47:04 +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