Commit Graph

427 Commits

Author SHA1 Message Date
Wladimir J. van der Laan f3558834db
Merge #11083: Fix combinerawtransaction RPC help result section
f9ca0fe Fix combinerawtransaction RPC help result section (Jonas Nick)

Pull request description:

  Without this PR it looks like the RPC would return something like a dictionary. But it just returns the transaction in hex.

Tree-SHA512: 565571fbb60cb805f81198cf0eab9ecdc04b62aff58c56145449235cd7c21215f4a1d7a5694d01c1a815fe0e787e5b790d24b71e2f9cc595cda16462ab680b8d
2017-08-18 09:52:48 +02:00
Jonas Nick f9ca0fe44e Fix combinerawtransaction RPC help result section 2017-08-17 19:35:30 -07:00
practicalswift 64fb0ac016 Declare single-argument (non-converting) constructors "explicit"
In order to avoid unintended implicit conversions.
2017-08-16 16:33:25 +02:00
Marko Bencun bb81e17355 scripted-diff: stop using the gArgs wrappers
They were temporary additions to ease the transition.

-BEGIN VERIFY SCRIPT-
find src/ -name "*.cpp" ! -wholename "src/util.h" ! -wholename "src/util.cpp" | xargs perl -i -pe 's/(?<!\.)(ParseParameters|ReadConfigFile|IsArgSet|(Soft|Force)?(Get|Set)(|Bool|)Arg(s)?)\(/gArgs.\1(/g'
-END VERIFY SCRIPT-
2017-08-14 17:02:10 +02:00
Wladimir J. van der Laan ce74799a3c
Merge #10483: scripted-diff: Use the C++11 keyword nullptr to denote the pointer literal instead of the macro NULL
90d4d89 scripted-diff: Use the C++11 keyword nullptr to denote the pointer literal instead of the macro NULL (practicalswift)

Pull request description:

  Since C++11 the macro `NULL` may be:
  * an integer literal with value zero, or
  * a prvalue of type `std::nullptr_t`

  By using the C++11 keyword `nullptr` we are guaranteed a prvalue of type `std::nullptr_t`.

  For a more thorough discussion, see "A name for the null pointer: nullptr" (Sutter &
  Stroustrup), http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2431.pdf

  With this patch applied there are no `NULL` macro usages left in the repo:

  ```
  $ git grep NULL -- "*.cpp" "*.h" | egrep -v '(/univalue/|/secp256k1/|/leveldb/|_NULL|NULLDUMMY|torcontrol.*NULL|NULL cert)' | wc -l
  0
  ```

  The road towards `nullptr` (C++11) is split into two PRs:
  * `NULL` → `nullptr` is handled in PR #10483 (scripted, this PR)
  * `0` → `nullptr` is handled in PR #10645 (manual)

Tree-SHA512: 3c395d66f2ad724a8e6fed74b93634de8bfc0c0eafac94e64e5194c939499fefd6e68f047de3083ad0b4eff37df9a8a3a76349aa17d55eabbd8e0412f140a297
2017-08-14 16:30:59 +02:00
Felix Weis 86279464b4 [RPC] trivial: gettxout no longer shows version of tx
Since the switch to a per-txout chainstate db in #10195, the tx version information is no longer stored. Updated `gettxout` rpc help text accordingly.
2017-08-11 12:16:55 +08:00
Wladimir J. van der Laan 46347add43 rpc: Move ValueFromAmount to core_write
This is necessary because core_write has to write amounts in
TxToUniv, and mistakingly uses FormatMoney for that
(which is only for debugging).

We don't move AmountFromValue at the same time, as
this is more challenging due to the RPCError depencency
there.
2017-08-07 17:01:21 +02:00
practicalswift 90d4d89230 scripted-diff: Use the C++11 keyword nullptr to denote the pointer literal instead of the macro NULL
-BEGIN VERIFY SCRIPT-
sed -i 's/\<NULL\>/nullptr/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h src/qt/*/*.cpp src/qt/*/*.h src/wallet/*/*.cpp src/wallet/*/*.h src/support/allocators/*.h
sed -i 's/Prefer nullptr, otherwise SAFECOOKIE./Prefer NULL, otherwise SAFECOOKIE./g' src/torcontrol.cpp
sed -i 's/tor: Using nullptr authentication/tor: Using NULL authentication/g' src/torcontrol.cpp
sed -i 's/METHODS=nullptr/METHODS=NULL/g' src/test/torcontrol_tests.cpp src/torcontrol.cpp
sed -i 's/nullptr certificates/NULL certificates/g' src/qt/paymentserver.cpp
sed -i 's/"nullptr"/"NULL"/g' src/torcontrol.cpp src/test/torcontrol_tests.cpp
-END VERIFY SCRIPT-
2017-08-07 07:36:37 +02:00
Russell Yanofsky e526b3d34c Fix misleading "Method not found" multiwallet errors
Raise RPC_WALLET_NOT_SPECIFIED instead of RPC_METHOD_NOT_FOUND when a required
wallet filename was not specified in an RPC call.

Also raise more specific RPC_WALLET_NOT_FOUND error instead of
RPC_INVALID_PARAMETER in case an invalid wallet was specified, for consistency.
2017-07-26 02:48:15 -04:00
Karl-Johan Alm f999c46cae
listsinceblock: optionally find and list any transactions that were undone due to reorg when requesting a non-main chain block in a new 'removed' array. 2017-07-21 09:50:59 +09:00
Wladimir J. van der Laan 041dad94b0
Merge #10783: [RPC] Various rpc argument fixes
4dc1915 check for null values in rpc args and handle appropriately (Gregory Sanders)
999ef20 importmulti options are optional (Gregory Sanders)
a70d025 fixup some rpc param counting for rpc help (Gregory Sanders)

Pull request description:

  Audited where named args will fail to use correct default values or may fail when additional optional arguments are added.

  Previously for these parameters, it was fine to omit them as positional arguments, but it would trigger UniValue runtime errors to set them to null, or to omit them while passing named parameters with greater positions (which would internally set earlier missing arguments to null). Now null values are treated the same as missing values so these errors do not occur.

  Included a few other small fixes while working on it.

  I didn't bother fixing account-based rpc calls.

Tree-SHA512: 8baf781a35bd48de7878d4726850a580dab80323d3416c1c146b4fa9062f8a233c03f37e8ae3f3159e9d04a8f39c326627ca64c14e1cb7ce72538f934ab2ae1e
2017-07-20 17:02:07 +02:00
Wladimir J. van der Laan adf170daf9
Merge #10571: [RPC]Move transaction combining from signrawtransaction to new RPC
6b4f231 Move transaction combining from signrawtransaction to new RPC (Andrew Chow)

Pull request description:

  Create a combinerawtransaction RPC which accepts a json array of hex raw transactions to combine them into one transaction. Signrawtransaction is changed to no longer combine transactions and only accept one transaction at a time.

  The tests have been updated to test this. Tests for the signrawtransaction merge have also been removed.

  This is part of #10570

Tree-SHA512: 035aebbd6537c1c017d5c8e06d309228b4c23fe52d5b31ffde19741c81a11a6346ddbbdc582b77b02a47f4c22b1952b69d3c2ee1109c29b3f0f1b612d8de53ed
2017-07-20 16:42:27 +02:00
Wladimir J. van der Laan d445a2c2ea
Merge #10857: [RPC] Add a deprecation warning to getinfo's output
1c9b818 getinfo deprecation warning (Andrew Chow)

Pull request description:

  This is an alternative to #10841

  This PR implements @gmaxwell's suggestion of a `nag` field for getinfo which warns about the deprecation. Instead of calling it `nag`, I have named it `deprecation-warning`. The output of `getinfo` will look like this:
  ```
  {
    "version": 149900,
    "protocolversion": 70015,
    "walletversion": 139900,
    "balance": 0.00000000,
    "blocks": 476281,
    "timeoffset": 0,
    "connections": 2,
    "proxy": "",
    "difficulty": 804525194568.1318,
    "testnet": false,
    "keypoololdest": 1496858803,
    "keypoolsize": 197,
    "unlocked_until": 0,
    "paytxfee": 0.00000000,
    "relayfee": 0.00001000,
    "errors": "This is a pre-release test build - use at your own risk - do not use for mining or merchant applications",
    "deprecation-warning": "WARNING: getinfo is deprecated and will be fully removed in 0.16. Projects should transition to using getblockchaininfo, getnetworkinfo, and getwalletinfo before upgrading to 0.16"
  }
  ```

  I think this should be tagged for 0.15

Tree-SHA512: ea1bac96a67f797519e8748ddd661cf0a1127cbc38f145b98f10cf9b54dcf0519b353062ce9888e1f51875497299c75ff5147566944451bc3fc117620e773489
2017-07-19 17:01:19 +02:00
Andrew Chow 1c9b818756 getinfo deprecation warning 2017-07-18 12:34:37 -07:00
Andrew Chow 6b4f231f5f Move transaction combining from signrawtransaction to new RPC
Create a combinerawtransaction RPC which accepts a json array of hex raw
transactions to combine them into one transaction. Signrawtransaction is changed
to no longer combine transactions and only accept one transaction at a time.
2017-07-18 10:59:06 -07:00
practicalswift e0d459264f Avoid redundant redeclaration of GetWarnings(const string&)
std::string GetWarnings(const std::string& strFor) is declared in
warnings.h and defined in warnings.cpp.
2017-07-18 15:54:38 +02:00
Alex Morcos 06bcdb8da6 Convert named argument from nblocks to conf_target
in estimatesmartfee and estimaterawfee.  Also reuse existing bounds checking.
2017-07-17 10:52:14 -04:00
Alex Morcos 439c4e8ad5 Improve api to estimatesmartfee
Change parameter for conservative estimates to be an estimate_mode string.
Change to never return a -1 for failure but to instead omit the feerate and
return an error string.  Throw JSONRPC error on invalid nblocks parameter.
2017-07-17 10:52:14 -04:00
Gregory Sanders 4dc1915bce check for null values in rpc args and handle appropriately 2017-07-17 08:53:18 -04:00
Wladimir J. van der Laan 6859ad2936
Merge #10706: Improve wallet fee logic and fix GUI bugs
11590d3 Properly bound check conf_target in wallet RPC calls (Alex Morcos)
fd29d3d Remove checking of mempool min fee from estimateSmartFee. (Alex Morcos)
2fffaa9 Make QT fee displays use GetMinimumFee instead of estimateSmartFee (Alex Morcos)
1983ca6 Use CoinControl to pass custom fee setting from QT. (Alex Morcos)
03ee701 Refactor to use CoinControl in GetMinimumFee and FeeBumper (Alex Morcos)
ecd81df Make CoinControl a required argument to CreateTransaction (Alex Morcos)

Pull request description:

  This builds on #10589  (first 5 commits from that PR, last 5 commits are new)

  The first couple commits refactor to use the CCoinControl class to pass fee calculation parameters around.

  This allows for fixing the buggy interaction in QT between the global payTxFee which can be modified by the RPC call settxfee or temporarily modified by the QT custom fee settings.  Before these changes the GUI could sometimes send a transaction with a recently set payTxFee and not respect the settings displayed in the GUI.   After these changes, using the GUI does not involve the global transaction confirm target or payTxFee.

  The prospective fee displays in the smart fee slider and the coin control dialog are changed to use the fee calculation from GetMinimumFee, this simplifies the code and makes them slightly more correct in edge cases.

  Maxing the fee calculation with the mempool min fee is move from estimateSmartFee to GetMinimumFee.

  This fixes a long standing bug, and should be tagged for 0.15 as it is holding up finalizing the estimatesmartfee RPC API before release.

Tree-SHA512: 4d36a1bd5934aa62f3806d380fcafbef73e9fe5bdf190fc5259a3e3a13349e5ce796e50e7068c46dc630ccf56d061bce5804f0bfe2e082bb01ca725b63efd4c1
2017-07-17 09:25:33 +02:00
Pieter Wuille 10b22e3141
Merge #10760: Avoid dereference-of-casted-pointer
0aadc11fd Avoid dereference-of-casted-pointer (Pieter Wuille)

Pull request description:

  And prefer a static_cast to the intended reference type.

Tree-SHA512: e83b20023a4dca6029b46f7040a8a6fd54e1b42112ec0c87c3c3b567ed641de97a9e2335b57a2efb075491f641e5b977bc226a474276bea0c3c3c71d8d6ac54d
2017-07-15 12:22:50 -07:00
Alex Morcos 11590d39b9 Properly bound check conf_target in wallet RPC calls 2017-07-14 23:41:40 -04:00
Alex Morcos fd29d3df29 Remove checking of mempool min fee from estimateSmartFee.
This check has been moved to the wallet logic GetMinimumFee. The rpc call to
estimatesmartfee will now no longer return a result maxed with the mempool min
fee, but automated fee calculations from the wallet will produce the same result
as before and coincontrol and sendcoins dialogs in the GUI will correctly
display the right prospective fee.

changes to policy/fees.cpp include a big whitespace indentation change.
2017-07-14 23:41:40 -04:00
Gregory Maxwell 3babbcb487 Remove confusing MAX_BLOCK_BASE_SIZE.
Some people keep thinking that MAX_BLOCK_BASE_SIZE is a separate
 size limit from the weight limit when it fact it is superfluous,
 and used in early tests before the witness data has been
 validated or just to compute worst case sizes.  The size checks
 that use it would not behave any differently consensus wise
 if they were eliminated completely.

Its correct value is not independently settable but is a function
 of the weight limit and weight formula.

This patch just eliminates it and uses the scale factor as
 required to compute the worse case constants.

It also moves the weight factor out of primitives into consensus,
 which is a more logical place for it.
2017-07-14 19:24:17 +00:00
Wladimir J. van der Laan b27b004532
Merge #10543: Change API to estimaterawfee
5e3b7b5 Improve error reporting for estimaterawfee (Alex Morcos)
1fafd70 Add function to report highest estimate target tracked per horizon (Alex Morcos)
9c85b91 Change API to estimaterawfee (Alex Morcos)

Tree-SHA512: e624c6e7967e9e48abe49f5818bd674e5710e571cc093029d2f90d39fdfba3c1f30e83bf89f6dce97052b59a7d9636a64642ccfb26effd149c417d0afbed0c0b
2017-07-11 15:36:56 +02:00
Wladimir J. van der Laan 104f5f21dc
Merge #10589: More economical fee estimates for RBF and RPC options to control
f135923 Add RPC options for RBF, confirmation target, and conservative fee estimation. (Alex Morcos)
f0bf33d Change default fee estimation mode. (Alex Morcos)
e0738e3 remove default argument from estimateSmartFee (Alex Morcos)
d507c30 Introduce a fee estimate mode. (Alex Morcos)
cfaef69 remove default argument from GetMinimumFee (Alex Morcos)

Tree-SHA512: 49c3a49a6893790a7e8b4e93a48f123dd5307af26c2017800683b76b4df8fc904ba73402917878676242c7440e3e04288d0c1ff3c2c907418724efc03cedab50
2017-07-11 11:58:02 +02:00
Wladimir J. van der Laan 379aed0e53
Merge #10676: document script-based return fields for validateaddress
f2f1d0a document script-based return fields for validateaddress (Gregory Sanders)

Tree-SHA512: 3310bb82b63ef20e46dd7ebcc9e15828cc7b6767ef19ddd869eeb5e4ee5b31ee307d21a44a9c81dbfe9d031bd48219e3ee1d330fc7b343d63d5365b68639c062
2017-07-11 11:43:37 +02:00
Alex Morcos 5e3b7b5686 Improve error reporting for estimaterawfee 2017-07-10 20:07:17 -04:00
Alex Morcos 9c85b91dc1 Change API to estimaterawfee
Report results for all 3 possible time horizons instead of specifying time horizon as an argument.
2017-07-10 20:07:13 -04:00
Alex Morcos f135923ee2 Add RPC options for RBF, confirmation target, and conservative fee estimation.
Add support for setting each of these attributes on a per RPC call basis to sendtoaddress, sendmany, fundrawtransaction (already had RBF), and bumpfee (already had RBF and conf target).
2017-07-10 12:40:02 -04:00
Wladimir J. van der Laan 9edda0c5f5
Merge #10747: [rpc] fix verbose argument for getblock in bitcoin-cli
58e9864 [rpc] fix verbose argument for getblock in bitcoin-cli (John Newbery)

Tree-SHA512: 7f176e1ddd9f3f7722ea0d268549629567ecf0c30bebf368824997566df0bfa01d31cf761abc9ca355e48c0bf0cb06d49d15a02b858999fcb7472dc7df2fbbf2
2017-07-10 17:50:21 +02:00
Pieter Wuille 0aadc11fd8 Avoid dereference-of-casted-pointer 2017-07-07 10:45:31 -07:00
Wladimir J. van der Laan 5af6572534
Merge #10698: Be consistent in calling transactions "replaceable" for Opt-In RBF
73c942e Use "replaceable" instead of "rbfoptin" in bitcoin-tx. (Matt Corallo)
fb915d5 Use "replaceable" instead of "optIntoRbf" in fundrawtransaction. (Matt Corallo)
928c681 Use "replaceable" instead of "optintorbf" in createrawtransaction. (Matt Corallo)

Tree-SHA512: 8922451c00abb63aaa08b4a9e314e89c22233b32f207259fbc25367f7d5b67efbaccc7e2a4958c18611ad498da302296242860c7be965a0e996dcde3e89efa07
2017-07-06 20:37:40 +02:00
Wladimir J. van der Laan 30bc0f6726
Merge #10710: REST/RPC example update
b8bb425 REST/RPC example update (Michael Rotarius)

Tree-SHA512: 3a7003f5996f58d9881e7b7a9155f8b1c233faea2977cd02c481567b60fa47105433184da3d887ef3ec28775ad33719b779bff2753d64b775b29d8a7a6214fda
2017-07-06 18:17:51 +02:00
Matt Corallo 928c6811f2 Use "replaceable" instead of "optintorbf" in createrawtransaction.
To be consistent with other places (and add the missing named
args entry for it).
2017-07-05 18:11:19 -04:00
John Newbery 58e9864083 [rpc] fix verbose argument for getblock in bitcoin-cli 2017-07-05 12:09:58 +01:00
Wladimir J. van der Laan 6dbcc74a0e
Merge #10193: scripted-diff: Remove #include <boost/foreach.hpp>
b1268a1 clang-format: Delete ForEachMacros (Jorge Timón)
5995735 scripted-diff: Remove #include <boost/foreach.hpp> (Jorge Timón)
3eff827 scripted-diff: Remove BOOST_REVERSE_FOREACH (Jorge Timón)
33aed5b Fix const_reverse_iterator constructor (pass const ptr) (Jorge Timón)
300851e Introduce src/reverse_iterator.hpp and include it... (Jorge Timón)

Tree-SHA512: df3405328e9602d0a433ac134ba59a5c9a6202ef64188df2f94a59b2ce58dec7c988b25d0671c7937de516a96b2e6daeb9d04c82fa363b616ee4cf6e9cb0fac6
2017-07-04 18:05:18 +02:00
Wladimir J. van der Laan d81bec7666
Merge #10683: rpc: Move the `generate` RPC call to rpcwallet
2a96283 rpc: Update `generate` for developer notes (Wladimir J. van der Laan)
df7e2f0 rpc: Move the `generate` RPC call to rpcwallet (Wladimir J. van der Laan)

Tree-SHA512: ec658d6178f8435dc54b9d9c6dd59f873055a8ae0c3f177c02049d77b93107dd5fc17a1ff56d50f051810d52fdf306846eaba2ef4fc8d2a6cfa831f57a1045c4
2017-07-03 13:59:50 +02:00
Gregory Sanders f2f1d0a83e document script-based return fields for validateaddress 2017-06-30 08:43:23 -04:00
Michael Rotarius b8bb4257fe REST/RPC example update 2017-06-30 13:21:08 +02:00
Wladimir J. van der Laan df7e2f057b rpc: Move the `generate` RPC call to rpcwallet
This makes it possible to mine to any wallet when multi-wallet mode is added.
Solves the same problem as #10649, but IMO in a cleaner way.

It also gets rid of the circuitous `ScriptForMining` method on
`CValidationInterface`, which really doesn't belong there.

After this change it's still possible to mine without wallet through
`generatetoaddress`.
2017-06-29 12:02:43 +02:00
Matt Corallo 381b8fc365 Clarify CCoinsViewMemPool documentation.
Thanks to @sdaftuar for correcting my misunderstanding.
2017-06-27 14:47:07 -04:00
Ricardo Velhote c07475294a
[RPC] Add an uptime command that displays the amount of time that bitcoind has been running 2017-06-25 20:25:45 +01:00
Wladimir J. van der Laan b62b4c873e
Merge #10627: fixed listunspent rpc convert parameter
e503b2b fixed listunspent rpc convert parameter (tnaka)

Tree-SHA512: 6da1cee8fd8459187825fad47678b36bbf6b4582f03f557c8a48c2c4273d9e12405e8bb6ade02a06e6555419eefb1dc298d4d4781ebb3b6b72743ca6108cb18e
2017-06-24 15:39:43 +02:00
Wladimir J. van der Laan 00350bd6db
Merge #10191: [trivial] Rename unused RPC arguments 'dummy'
0ef7de9 [RPCs] Remove submitblock parameters argument help text (John Newbery)

Tree-SHA512: f39ad4bb3006e3d722fa51ae2ab4a48726e740993d6bed5737b355d1e0a99cf475ca9519f97adf8cde1b7187b14a24d5951ce4f34624d01d9ef84b49124c2894
2017-06-24 15:15:18 +02:00
Wladimir J. van der Laan 2772dc9f21
Merge #10446: net: avoid extra dns query per seed
c1be285 chainparams: make supported service bits option explicit (Cory Fields)
d5c7c1c net: use an internal address for fixed seeds (Cory Fields)
6cdc488 net: switch to dummy internal ip for dns seed source (Cory Fields)
6d0bd5b net: do not allow resolving to an internal address (Cory Fields)
7f31762 net: add an internal subnet for representing unresolved hostnames (Cory Fields)

Tree-SHA512: 9bf1042bef546ac3ef0e0d3a9a5555eb21628ff2674a0cf8c6367194b22bfdab477adf452c0e7c56f44e0fb37debc5e14bdb623452e076fb9c492c7702601d7a
2017-06-24 12:25:13 +02:00
Dimitris Tsapakidis 0a5a6b90bc Fixed multiple typos
A few "a->an" and "an->a".
"Shows, if the supplied default SOCKS5 proxy" -> "Shows if the supplied default SOCKS5 proxy". Change made on 3 occurrences.
"without fully understanding the ramification of a command" -> "without fully understanding the ramifications of a command".
Removed duplicate words such as "the the".
2017-06-22 19:18:10 +03:00
Jorge Timón 5995735c5b
scripted-diff: Remove #include <boost/foreach.hpp>
-BEGIN VERIFY SCRIPT-
sed -i ':a;N;$!ba;s/#include <boost\/foreach.hpp>\n//' ./src/*.h ./src/*.cpp ./src/*/*.h ./src/*/*.cpp ./src/*/*/*.h ./src/*/*/*.cpp
-END VERIFY SCRIPT-
2017-06-22 03:48:52 +02:00
tnaka e503b2b680 fixed listunspent rpc convert parameter 2017-06-19 11:48:57 +09:00
Wladimir J. van der Laan c2ab38bdd5
Merge #10284: Always log debug information for fee calculation in CreateTransaction
1bebfc8 Output Fee Estimation Calculations in CreateTransaction (Alex Morcos)

Tree-SHA512: e25a27f7acbbc3a666d5d85da2554c5aaec4c923ee2fdbcfc532c29c6fbdec3c9e0d6ae6044543ecc339e7bd81df09c8d228e0b53a2c5c2dae0f1098c9453272
2017-06-15 14:20:14 +02:00