Commit Graph

456 Commits

Author SHA1 Message Date
Wladimir J. van der Laan 16f6c98fa8
Merge #10426: Replace bytes_serialized with bogosize
8b22af3 Replace bytes_serialized with bogosize (Pieter Wuille)

Tree-SHA512: e70a981bbb977329f9e324c45f9a1346ec9aacfbbad5474e608cdd1f852257502bb7db8003fd578260a609e45d1a9cf87ce96df9c4187d92d50f60a209e232ce
2017-06-06 11:46:31 +02:00
Wladimir J. van der Laan 323a46e034
Merge #10463: Names: BIP9 vs versionbits
b463bc9 scripted-diff: s/BIP9DeploymentInfo/VBDeploymentInfo/ (Jorge Timón)
29c0719 Rename -bip9params to -vbparams (shaolinfry)

Tree-SHA512: a8a2bf6e24a4a7fc82f784c78c0cd92472e9ba55ce3fb22dafef3eccdcfccb2da5a6078fbeec1a8a4b6ab1f1b226976c5aba964dd5e3d029a21b109a7c044374
2017-06-06 10:18:02 +02:00
Luke Dashjr 9a5a1d7d45 RPC/rawtransaction: createrawtransaction: Check opt_into_rbf when provided with either value 2017-06-05 23:14:34 +00:00
Luke Dashjr b005bf21a7 Introduce MAX_BIP125_RBF_SEQUENCE constant 2017-06-05 23:14:34 +00:00
Luke Dashjr 578ec80d4f RPC: rawtransaction: Add RBF support for createrawtransaction 2017-06-05 23:09:01 +00:00
Pieter Wuille 8b22af3ee5 Replace bytes_serialized with bogosize 2017-06-05 12:43:45 -07:00
Jorge Timón 1238f13cf6
scripted-diff: Remove PAIRTYPE
-BEGIN VERIFY SCRIPT-
sed -i 's/PAIRTYPE(\([^,]*\), \([^\)]*\))/std::pair<\1, \2>/' ./src/*.h ./src/*.cpp ./src/*/*.h ./src/*/*.cpp ./src/*/*/*.h ./src/*/*/*.cpp ;
sed -i ':a;N;$!ba;s/#define std::pair<t1, t2>    std::pair<t1, t2>\n//' ./src/utilstrencodings.h ;
-END VERIFY SCRIPT-
2017-06-05 20:14:53 +02:00
Jorge Timón 7c00c26726
scripted-diff: Fully remove BOOST_FOREACH
-BEGIN VERIFY SCRIPT-
sed -i 's/BOOST_FOREACH *(\(.*\),/for (\1 :/' ./src/*.h ./src/*.cpp ./src/*/*.h ./src/*/*.cpp ./src/*/*/*.h ./src/*/*/*.cpp ;
-END VERIFY SCRIPT-
2017-06-05 20:10:50 +02:00
Wladimir J. van der Laan a7e3c2814c rpc: Add listen address to incoming connections in `getpeerinfo`
This adds the listening address on which incoming connections were received to the
CNode and CNodeStats structures.

The address is reported in `getpeerinfo`.

This can be useful for distinguishing connections received on different listening ports
(e.g. when using a different listening port for Tor hidden service connections)
or different networks.
2017-06-05 13:35:30 +02:00
practicalswift 90593ed92c Limit variable scope 2017-06-05 00:52:36 +02:00
practicalswift 656dbd871a Perform member initialization in initialization lists where possible 2017-06-04 01:09:48 +02:00
Pieter Wuille 1088b02f0c
Merge #10195: Switch chainstate db and cache to per-txout model
589827975 scripted-diff: various renames for per-utxo consistency (Pieter Wuille)
a5e02bc7f Increase travis unit test timeout (Pieter Wuille)
73de2c1ff Rename CCoinsCacheEntry::coins to coin (Pieter Wuille)
119e552f7 Merge CCoinsViewCache's GetOutputFor and AccessCoin (Pieter Wuille)
580b02309 [MOVEONLY] Move old CCoins class to txdb.cpp (Pieter Wuille)
8b25d2c0c Upgrade from per-tx database to per-txout (Pieter Wuille)
b2af357f3 Reduce reserved memory space for flushing (Pieter Wuille)
41aa5b79a Pack Coin more tightly (Pieter Wuille)
97072d668 Remove unused CCoins methods (Pieter Wuille)
ce23efaa5 Extend coins_tests (Pieter Wuille)
508307968 Switch CCoinsView and chainstate db from per-txid to per-txout (Pieter Wuille)
4ec0d9e79 Refactor GetUTXOStats in preparation for per-COutPoint iteration (Pieter Wuille)
13870b56f Replace CCoins-based CTxMemPool::pruneSpent with isSpent (Pieter Wuille)
05293f3cb Remove ModifyCoins/ModifyNewCoins (Pieter Wuille)
961e48397 Switch tests from ModifyCoins to AddCoin/SpendCoin (Pieter Wuille)
8b3868c1b Switch CScriptCheck to use Coin instead of CCoins (Pieter Wuille)
c87b957a3 Only pass things committed to by tx's witness hash to CScriptCheck (Matt Corallo)
f68cdfe92 Switch from per-tx to per-txout CCoinsViewCache methods in some places (Pieter Wuille)
000391132 Introduce new per-txout CCoinsViewCache functions (Pieter Wuille)
bd83111a0 Optimization: Coin&& to ApplyTxInUndo (Pieter Wuille)
cb2c7fdac Replace CTxInUndo with Coin (Pieter Wuille)
422634e2f Introduce Coin, a single unspent output (Pieter Wuille)
7d991b55d Store/allow tx metadata in all undo records (Pieter Wuille)
c3aa0c119 Report on-disk size in gettxoutsetinfo (Pieter Wuille)
d34242430 Remove/ignore tx version in utxo and undo (Pieter Wuille)
7e0032290 Add specialization of SipHash for 256 + 32 bit data (Pieter Wuille)
e484652fc Introduce CHashVerifier to hash read data (Pieter Wuille)
f54580e7e error() in disconnect for disk corruption, not inconsistency (Pieter Wuille)
e66dbde6d Add SizeEstimate to CDBBatch (Pieter Wuille)

Tree-SHA512: ce1fb1e40c77d38915cd02189fab7a8b125c7f44d425c85579d872c3bede3a437760997907c99d7b3017ced1c2de54b2ac7223d99d83a6658fe5ef61edef1de3
2017-06-01 16:20:27 -07:00
Pieter Wuille 589827975f scripted-diff: various renames for per-utxo consistency
Thanks to John Newberry for pointing these out.

-BEGIN VERIFY SCRIPT-
sed -i 's/\<GetCoins\>/GetCoin/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h
sed -i 's/\<HaveCoins\>/HaveCoin/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h
sed -i 's/\<HaveCoinsInCache\>/HaveCoinInCache/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h
sed -i 's/\<IsPruned\>/IsSpent/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h
sed -i 's/\<FetchCoins\>/FetchCoin/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h
sed -i 's/\<CoinsEntry\>/CoinEntry/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h
sed -i 's/\<vHashTxnToUncache\>/coins_to_uncache/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h
sed -i 's/\<vHashTxToUncache\>/coins_to_uncache/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h
sed -i 's/\<fHadTxInCache\>/had_coin_in_cache/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h
sed -i 's/\<coinbaseids\>/coinbase_coins/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h
sed -i 's/\<disconnectedids\>/disconnected_coins/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h
sed -i 's/\<duplicateids\>/duplicate_coins/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h
sed -i 's/\<oldcoins\>/old_coin/g' src/test/coins_tests.cpp
sed -i 's/\<origcoins\>/orig_coin/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h
-END VERIFY SCRIPT-
2017-06-01 13:15:25 -07:00
Pieter Wuille 5083079688 Switch CCoinsView and chainstate db from per-txid to per-txout
This patch makes several related changes:
* Changes the CCoinsView virtual methods (GetCoins, HaveCoins, ...)
  to be COutPoint/Coin-based rather than txid/CCoins-based.
* Changes the chainstate db to a new incompatible format that is also
  COutPoint/Coin based.
* Implements reconstruction code for hash_serialized_2.
* Adapts the coins_tests unit tests (thanks to Russell Yanofsky).

A side effect of the new CCoinsView model is that we can no longer
use the (unreliable) test for transaction outputs in the UTXO set
to determine whether we already have a particular transaction.
2017-06-01 12:59:38 -07:00
Pieter Wuille 4ec0d9e794 Refactor GetUTXOStats in preparation for per-COutPoint iteration 2017-06-01 12:43:16 -07:00
Pieter Wuille 13870b56fc Replace CCoins-based CTxMemPool::pruneSpent with isSpent 2017-06-01 12:43:16 -07:00
Pieter Wuille f68cdfe92b Switch from per-tx to per-txout CCoinsViewCache methods in some places 2017-06-01 11:56:06 -07:00
Wladimir J. van der Laan 39039b12a7
Merge #10475: [RPC] getmempoolinfo mempoolminfee is a BTC/KB feerate
f128f78 getmempool mempoolminfee is a BTC/KB feerate (Gregory Sanders)

Tree-SHA512: 5b32ffc0d2ba7ca623d4ce450fb67855d17b4fa8c3ffb8570a63dc53b3d476d52b39ad6190ac4357dbf01f6b535fa187cd8c34175a16469e9b00097e3bf2e2bc
2017-06-01 19:21:26 +02:00
Jorge Timón b463bc9215
scripted-diff: s/BIP9DeploymentInfo/VBDeploymentInfo/
-BEGIN VERIFY SCRIPT-
sed -i 's/BIP9DeploymentInfo/VBDeploymentInfo/' ./src/*.h ./src/*.cpp ./src/*/*.h ./src/*/*.cpp ./src/*/*/*.h ./src/*/*/*.cpp ;
-END VERIFY SCRIPT-
2017-05-30 19:21:52 +02:00
Gregory Sanders f128f78ddb getmempool mempoolminfee is a BTC/KB feerate 2017-05-29 14:14:07 -04:00
Pieter Wuille c3aa0c1194 Report on-disk size in gettxoutsetinfo 2017-05-26 13:33:39 -07:00
Pieter Wuille d342424301 Remove/ignore tx version in utxo and undo
This makes the following changes:
* In undo data and the chainstate database, the transaction nVersion
  field is removed from the data structures, always written as 0, and
  ignored when reading.
* The definition of hash_serialized in gettxoutsetinfo is changed to no
  longer incude the nVersion field. It is renamed to hash_serialized_2
  to avoid confusion. The new definition also includes transaction
  height and coinbase information, as this information was missing
  before.

This depends on having a CHashVerifier-based undo data checksum
verifier.

Apart from changing the definition of serialized_hash, downgrading
after using this patch is supported, as no release ever used the value
of nVersion field in UTXO entries.
2017-05-26 13:27:50 -07:00
Luke Dashjr 870824e919 RPC/Mining: Restore API compatibility for prioritisetransaction
Breaking API serves no purpose other than to be incompatible with older versions and other implementations that do support priority
2017-05-23 20:46:14 +00:00
Wladimir J. van der Laan 46771514fa
Merge #9571: RPC: getblockchaininfo returns BIP signaling statistics
557c9a6 RPC: getblockchaininfo: BIP9 stats (Matthew Zipkin)

Tree-SHA512: ecf0bf47f04f92becc77acc649fdfa270e768939acce42df39d30069398d40d9a30539862f7c307e08239f78d5c58c470ca5f6e717d2ab8e24db9be0dd7bec0c
2017-05-23 19:12:29 +02:00
Pieter Wuille c33652576c
Merge #10395: Replace boost::function with std::function (C++11)
1b936f5 Replace boost::function with std::function (C++11) (practicalswift)

Tree-SHA512: c4faec8cf3f801842010976115681f68ffa08fbc97ba50b22e95c936840f47e1b3bd8d7fd2f5b4e094b5a46bf3d29fc90b69d975a99e77322c0d19f8a00d53d3
2017-05-17 17:22:43 -07:00
Pieter Wuille e317c0d192
Merge #8384: Add witness data output to TxInError messages
6e9e026 Expand signrawtransaction.py to cover error witness checking (Gregory Sanders)
9f7341b Add witness data output to TxInError messages (Gregory Sanders)

Tree-SHA512: 6f2a758544fa2657f3a57051bdb80fb14cb10501c8ef4ccbab7a62d4b6a823e74f40991c8796248865def24619b620b859dc2bb08dc2cc72511c1cf3897ab1a9
2017-05-17 17:14:18 -07:00
Pieter Wuille 318ea50a1c
Merge #10199: Better fee estimates
38bc1ec Make more json-like output from estimaterawfee (Alex Morcos)
2d2e170 Comments and improved documentation (Alex Morcos)
ef589f8 minor cleanup: remove unnecessary variable (Alex Morcos)
3ee76d6 Introduce a scale factor (Alex Morcos)
5f1f0c6 Historical block span (Alex Morcos)
aa19b8e Clean up fee estimate debug printing (Alex Morcos)
10f7cbd Track first recorded height (Alex Morcos)
3810e97 Rewrite estimateSmartFee (Alex Morcos)
c7447ec Track failures in fee estimation. (Alex Morcos)
4186d3f Expose estimaterawfee (Alex Morcos)
2681153 minor refactor: explicitly track start of new bucket range and don't update curNearBucket on final loop. (Alex Morcos)
1ba43cc Make EstimateMedianVal smarter about small failures. (Alex Morcos)
d3e30bc Refactor to update moving average on fly (Alex Morcos)
e5007ba Change parameters for fee estimation and estimates on all 3 time horizons. (Alex Morcos)
c0a273f Change file format for fee estimates. (Alex Morcos)

Tree-SHA512: 186e7508d86a1f351bb656edcd84ee9091f5f2706331eda9ee29da9c8eb5bf67b8c1f2abf6662835560e7f613b1377099054f20767f41ddcdbc89c4f9e78946d
2017-05-17 13:15:07 -07:00
Alex Morcos 38bc1ec4a4 Make more json-like output from estimaterawfee 2017-05-17 15:42:32 -04:00
Gregory Sanders 9f7341b078 Add witness data output to TxInError messages 2017-05-17 13:30:42 -04:00
Pedro Branco bc63d0ed3b Add query options to listunspent rpc call 2017-05-17 08:37:34 +02:00
Wladimir J. van der Laan 96c850c209
Merge #8704: [RPC] Transaction details in getblock
e3c9f2d Use a verbosity instead of two verbose parameters (Andrew Chow)
c99ab3c RPC: Allow multiple names for parameters (Luke Dashjr)

Tree-SHA512: 686b38f6b0106563738d51f55666fe6d49a5b121b30d4480c2bfb640a59ede8e6f7f3c05c3c5d80a5288e127991e191d19d1d4f9ace566fd39edeb27b31857ff
2017-05-15 17:20:16 +02:00
practicalswift 1b936f5926 Replace boost::function with std::function (C++11) 2017-05-13 17:59:09 +02:00
Andrew Chow e3c9f2ddb1 Use a verbosity instead of two verbose parameters
Verbose is changed to an int. This can have values from 0-2 for each level of verbosity.
Verbosity level 2 has transaction details displayed in the results.
2017-05-12 11:58:42 -04:00
Alex Morcos 2d2e17052c Comments and improved documentation 2017-05-10 11:48:46 -04:00
Alex Morcos 3ee76d6de5 Introduce a scale factor
For the per confirmation number tracking of data, introduce a scale factor so that in the longer horizones confirmations are bucketed together at a resolution of the scale.  (instead of 1008 individual data points for each fee bucket, have 42 data points each covering 24 different confirmation values.. (1-24), (25-48), etc.. )
2017-05-10 11:47:45 -04:00
Alex Morcos 3810e976d6 Rewrite estimateSmartFee
Change the logic of estimateSmartFee to check a 60% threshold at half the target, a 85% threshold at the target and a 95% threshold at double the target. Always check the shortest time horizon possible and ensure that estimates are monotonically decreasing.  Add a conservative mode, which makes sure that the 95% threshold is also met at longer time horizons as well.
2017-05-10 11:47:44 -04:00
Alex Morcos c7447ec303 Track failures in fee estimation.
Start tracking transactions which fail to confirm within the target and are then evicted or otherwise leave mempool.

Fix slight error in unit test.
2017-05-10 11:45:27 -04:00
Alex Morcos 4186d3fdfd Expose estimaterawfee
Track information the ranges of fee rates that were used to calculate the fee estimates (the last range of fee rates in which the data points met the threshold and the first to fail) and provide an RPC call to return this information.
2017-05-10 11:45:26 -04:00
Wladimir J. van der Laan 08a7316c14
Merge #9279: Consensus: Move CFeeRate out of libconsensus
381a46e Consensus: Policy: MOVEONLY: Move CFeeRate out of the consensus module (Jorge Timón)
330bb5a Consensus: Minimal way to move dust out of consensus (Jorge Timón)

Tree-SHA512: 19a2ea8169afd5a9d3f940d8974e34cfaead153e3ff3068ac82fccdb8694d19d9b45938904ec9e8cd095bd5ca3a0080364da29372f6aaf56b11a6c2ccd6c7a4d
2017-05-09 09:19:50 +02:00
MarcoFalke f4b15e2de9
Merge #10310: [doc] Add hint about getmempoolentry to getrawmempool help.
3a0a5bc [doc] Add hint about getmempoolentry to getrawmempool help. (Karl-Johan Alm)

Tree-SHA512: 8327d7d7ad93296525fbf95b7a824e3525bde84653999f125afd845823eb39e3a03cd39725962ed949aa2b9ad207ecad6d287294fa321ff1a4d7fbd5a4b8560b
2017-05-08 19:28:58 +02:00
Karl-Johan Alm 3a0a5bc234
[doc] Add hint about getmempoolentry to getrawmempool help. 2017-05-06 12:51:01 +09:00
Jorge Timón 381a46e38f
Consensus: Policy: MOVEONLY: Move CFeeRate out of the consensus module
...from amount.o to policy/feerate.o

Policy, because it moves policy code to the policy directory (common module)
2017-05-03 18:00:13 +02:00
Pieter Wuille bd1f138e73 Add getchaintxstats RPC 2017-05-03 08:08:27 +02:00
practicalswift 3fe8a83969 Remove unused forward declaration for non-existent ScriptPubKeyToJSON(...) 2017-05-02 17:18:03 +02:00
jonnynewbs 0ff9320bf5 refactor TxToJSON() and ScriptPubKeyToJSON() 2017-04-28 10:01:56 -04:00
Wladimir J. van der Laan 86ea3c2ff2
Merge #10181: Include cleanup
1c897fc Missing includes (Jorge Timón)
a1fd450 Trivial: Remove unneeded includes from .h: (Jorge Timón)

Tree-SHA512: ada3e62cc2435e58172a88b380be371b717a05725956c15e5493b6e19fe2903e5e6e43fd22dc24699333a0e8a0c7b42eb1ae61b41cb4ba82495be18e2d4ef3c6
2017-04-20 23:24:00 +02:00
Wladimir J. van der Laan 14c948987f
Merge #9942: Refactor CBlockPolicyEstimator
68af651 MOVEONLY: move TxConfirmStats to cpp (Alex Morcos)
2332f19 Initialize TxConfirmStats in constructor (Alex Morcos)
5ba81e5 Read and Write fee estimate file directly from CBlockPolicyEstimator (Alex Morcos)
14e10aa Call estimate(Smart)Fee directly from CBlockPolicyEstimator (Alex Morcos)
dbb9e36 Give CBlockPolicyEstimator it's own lock (Alex Morcos)
f6187d6 Make processBlockTx private. (Alex Morcos)
ae7327b Make feeEstimator its own global instance of CBlockPolicyEstimator (Alex Morcos)

Tree-SHA512: dbf3bd2b30822e609a35f3da519b62d23f8a50e564750695ddebd08553b4c01874ae3e07d792c6cc78cc377d2db33b951ffedc46ac7edaf5793f9ebb931713af
2017-04-20 21:17:17 +02:00
John Newbery 23e6e64a24 Allow disconnectnode() to be called with node id
disconnectnode() can currently only be called with the IP address/port
of the node the user wishes to connect. This commit allows the node to
be disconnected using the nodeid returned by getpeerinfo().
2017-04-19 13:47:51 -04:00
John Newbery 883154cbcb [rpc] rename disconnectnode argument 2017-04-13 15:38:59 -04:00
Jorge Timón 1c897fc3da
Missing includes 2017-04-13 02:31:44 +02:00
Wladimir J. van der Laan 350b22497c
Merge #10150: [rpc] Add logging rpc
7fd50c3 allow libevent logging to be updated during runtime (John Newbery)
5255aca [rpc] Add logging RPC (John Newbery)
4d9950d Set BCLog::LIBEVENT correctly for old libevent versions. (John Newbery)

Tree-SHA512: d6788a7205372c0528da71eca052910dfb055f2940ca884f422ff3db66e23a2b49c6a15b8f27d5255554fe5c5a928f5dd903fdc63b0bd6c8fa7783e77bb30fe8
2017-04-12 19:57:22 +02:00
John Newbery 7fd50c3b70 allow libevent logging to be updated during runtime 2017-04-10 17:05:59 -04:00
John Newbery 5255aca3f4 [rpc] Add logging RPC
Adds an RPC to get and set currently active logging categories.
2017-04-10 17:05:59 -04:00
Wladimir J. van der Laan 67023e9004
Merge #9725: CValidationInterface Cleanups
b1a6d4c Take a CTransactionRef in AddToWalletIfInvolvingMe to avoid a copy (Matt Corallo)
1c95e2f Use std::shared_ptr instead of boost::shared_ptr in ScriptForMining (Matt Corallo)
91f1e6c Remove dead-code tracking of requests for blocks we generated (Matt Corallo)
acad82f Add override to functions using CValidationInterface methods (Matt Corallo)
e6d5e6c Hold cs_wallet for whole block [dis]connection processing (Matt Corallo)
461e49f SyncTransaction->TxAddedToMempool/BlockConnected/Disconnected (Matt Corallo)
f404334 Handle SyncTransaction in ActivateBestChain instead of ConnectTrace (Matt Corallo)
a147687 Keep conflictedTxs in ConnectTrace per-block (Matt Corallo)
d3167ba Handle conflicted transactions directly in ConnectTrace (Matt Corallo)
29e6e23 Make ConnectTrace::blocksConnected private, hide behind accessors (Matt Corallo)
822000c Add pblock to connectTrace at the end of ConnectTip, not start (Matt Corallo)
f5e9a01 Include missing #include in zmqnotificationinterface.h (Matt Corallo)

Tree-SHA512: 8893d47559da3b28d2ef7359768547cba8a4b43b6f891d80f5848f995a84b1517bfb0f706fdc8cd43f09a1350349eb440d9724a59363ab517dfcc4fcb31b2018
2017-04-10 21:21:01 +02:00
Alex Morcos 14e10aa842 Call estimate(Smart)Fee directly from CBlockPolicyEstimator 2017-04-10 13:56:50 -04:00
Luke Dashjr c99ab3ca4b RPC: Allow multiple names for parameters 2017-04-10 09:26:03 -04:00
Wladimir J. van der Laan a3a2160b66
Merge #10162: [trivial] Log calls to getblocktemplate
1352092 Log calls to getblocktemplate (John Newbery)

Tree-SHA512: de2c6faac8baea2f63eb499dbcd0669062a71759050cf8bcada9b454fe82f056c23635d41c755badf55158ffc40a380f82bea1f40c8a2cc51604d981515b71eb
2017-04-07 14:55:29 +02:00
Matt Corallo 1c95e2f9c9 Use std::shared_ptr instead of boost::shared_ptr in ScriptForMining 2017-04-07 11:53:43 +02:00
Matt Corallo acad82f375 Add override to functions using CValidationInterface methods 2017-04-07 11:53:43 +02:00
Wladimir J. van der Laan 8c28670e92
Merge #9902: Lightweight abstraction of boost::filesystem
f110272 Remove `namespace fs=fs` (Wladimir J. van der Laan)
75594bd torcontrol: Use fs::path instead of std::string for private key path (Wladimir J. van der Laan)
2a5f574 Use fsbridge for fopen and freopen (Wladimir J. van der Laan)
bac5c9c Replace uses of boost::filesystem with fs (Wladimir J. van der Laan)
7d5172d Replace includes of boost/filesystem.h with fs.h (Wladimir J. van der Laan)
19e36bb Add fs.cpp/h (Wladimir J. van der Laan)

Tree-SHA512: 2c34f059dfa6850b9323f3389e9090a6b5f839a457a2960d182c2ecfafd9883c956f5928bb796613402d3aad68ebc78259796a7a313f4a6cfa98aaf507a66842
2017-04-06 20:35:15 +02:00
John Newbery 1352092dbd Log calls to getblocktemplate 2017-04-06 10:37:30 -04:00
Wladimir J. van der Laan 72bc7e1303
Merge #10146: Better error handling for submitblock
30f30c0 Add braces to submitblock per current style. (Gregory Maxwell)
4f15ea1 Check transaction count early in submitblock. (Gregory Maxwell)
ada0caa Make GetWitnessCommitmentIndex callable on blocks without a coinbase txn. (Gregory Maxwell)

Tree-SHA512: 02dcd337ad9cdd8e4fa6a42c009d016026d1229c193676ed6fcc9ce55e924fedec57f516ac1e95c3db0985243ba908307338ce783a70416cb292bed881002bfc
2017-04-04 09:00:23 +02:00
Wladimir J. van der Laan bac5c9cf64 Replace uses of boost::filesystem with fs
Step two in abstracting away boost::filesystem.

To repeat this, simply run:
```
git ls-files \*.cpp \*.h | xargs sed -i 's/boost::filesystem/fs/g'
```
2017-04-03 12:32:32 +02:00
Wladimir J. van der Laan 7d5172d354 Replace includes of boost/filesystem.h with fs.h
This is step one in abstracting the use of boost::filesystem.
2017-04-03 12:32:32 +02:00
Gregory Maxwell 30f30c0f99 Add braces to submitblock per current style. 2017-04-03 07:23:07 +00:00
Gregory Maxwell 4f15ea102d Check transaction count early in submitblock.
There is no point in even hashing a submitted block which doesn't have
 a coinbase transaction.

This also results in more useful error reporting on corrupted input.

Thanks to rawodb for the bug report.
2017-04-03 07:15:36 +00:00
practicalswift 4b87973c32 [rpc] Remove auth cookie on shutdown
Accidentally removed in 40b556d374
2017-04-02 15:52:41 +02:00
Gregory Maxwell 6b3bb3d9ba Change LogAcceptCategory to use uint32_t rather than sets of strings.
This changes the logging categories to boolean flags instead of strings.

This simplifies the acceptance testing by avoiding accessing a scoped
 static thread local pointer to a thread local set of strings.  It
 eliminates the only use of boost::thread_specific_ptr outside of
 lockorder debugging.

This change allows log entries to be directed to multiple categories
 and makes it easy to change the logging flags at runtime (e.g. via
 an RPC, though that isn't done by this commit.)

It also eliminates the fDebug global.

Configuration of unknown logging categories now produces a warning.
2017-04-01 18:53:29 +00:00
Wladimir J. van der Laan 4aa07fa735
Merge #10095: refactor: Move GetDifficulty out of `rpc/server.h`
f885b67 refactor: Make rest.cpp dependency on `*toJSON` in `blockchain.cpp` explicit (Wladimir J. van der Laan)
8d8f28d refactor: Move RPCNotifyBlockChange out of `rpc/server.h` (Wladimir J. van der Laan)
e6dcfee refactor: Move GetDifficulty out of `rpc/server.h` (Wladimir J. van der Laan)

Tree-SHA512: fc2656611d18442f2fddba5ac1554d958151f6785c2039afdfc36735d7e71592d9686ff6cc7b2ad95180071d7514470e62c52d697c5a1e88f851bddaf5942edb
2017-03-31 12:57:30 +02:00
Wladimir J. van der Laan f885b67029 refactor: Make rest.cpp dependency on `*toJSON` in `blockchain.cpp` explicit 2017-03-29 09:56:47 +02:00
Wladimir J. van der Laan 8d8f28dd52 refactor: Move RPCNotifyBlockChange out of `rpc/server.h` 2017-03-27 16:23:22 +02:00
Wladimir J. van der Laan e6dcfeec05 refactor: Move GetDifficulty out of `rpc/server.h`
It has no business in `rpcserver.h`. Define it in the interface header
of the implementation unit `rpcblockchain` where it is defined.

Also modernize the signature to:

    double GetDifficulty(const CBlockIndex* blockindex = nullptr);

(remove `extern`, replace `NULL` with `nullptr`)
2017-03-27 12:21:35 +02:00
MarcoFalke fa55853219 rpc: Rename first named arg of createrawtransaction 2017-03-26 12:08:44 +02:00
Matthew Zipkin 557c9a68fb RPC: getblockchaininfo: BIP9 stats
add RPC tests for BIP9 counting stats
2017-03-24 16:57:05 -07:00
Jonas Schnelli 86f7d5b69b
Merge #10029: Fix parameter naming inconsistencies between .h and .cpp files
97b8213 Fix parameter naming inconsistencies between .h and .cpp files (practicalswift)

Tree-SHA512: 4f46cc3973a898d2478bdb1b8c8d1829c3a7298b63bc47359c5dc2f135466773072d9672134ef3e7557dfc913720e49b675176b9e435b8bd1992af9ad53866e4
2017-03-23 08:16:27 +01:00
Wladimir J. van der Laan d34995a7ba
Merge #10038: Add mallocinfo mode to `getmemoryinfo` RPC
e141aa4 Add mallocinfo mode to `getmemoryinfo` RPC (Wladimir J. van der Laan)

Tree-SHA512: e778631765c29b3b5fb94eb66e5f50a8f108a234891bdcc4883f1e6e2fdd223f7660fad987eb2d7cbda5b800482d78adc1a309a3f6f83a84c556af43ebee2ed7
2017-03-20 15:05:56 +01:00
Wladimir J. van der Laan e141aa4ba6 Add mallocinfo mode to `getmemoryinfo` RPC
This adds a mode argument to `getmemoryinfo`. By default the output
will remain the same. However if a mode argument of `mallocinfo` is
provided the result of glibc `malloc_info` (if available) will
be returned as a string, as-is.

This is useful for tracking heap usage over time or troubleshooting
memory fragmentation issues.
2017-03-20 10:30:18 +01:00
James Evans 05a9f22358 Trivial: Fix typo in help getrawtransaction RPC 2017-03-20 05:19:41 -03:00
practicalswift 97b8213674 Fix parameter naming inconsistencies between .h and .cpp files
Inconsistencies prior to this commit:

* serializeFlags vs serialFlags
src/core_io.h:std::string EncodeHexTx(const CTransaction& tx, const int serializeFlags = 0);
src/core_write.cpp:std::string EncodeHexTx(const CTransaction& tx, const int serialFlags)

* statusOut vs outStatus
src/rpc/server.h:bool RPCIsInWarmup(std::string *statusOut);
src/rpc/server.cpp:bool RPCIsInWarmup(std::string *outStatus)

* hashesToUpdate vs vHashesToUpdate
src/txmempool.h:    void UpdateTransactionsFromBlock(const std::vector<uint256> &hashesToUpdate);
src/txmempool.cpp:void CTxMemPool::UpdateTransactionsFromBlock(const std::vector<uint256> &vHashesToUpdate)

* nPruneUpToHeight vs nManualPruneHeight
src/validation.h:void PruneBlockFilesManual(int nPruneUpToHeight);
src/validation.cpp:void PruneBlockFilesManual(int nManualPruneHeight);
2017-03-19 16:14:29 +01:00
Wladimir J. van der Laan aab1e55860
Merge #9987: Remove unused code
8dc957a Remove unused code (practicalswift)

Tree-SHA512: c7bb286e3b92e42fec8aa1ac2491fd38be36602efca16b4bdc4e9d5ada75c11d99e7713092ec13794abd69d5ef2c732b86209a6d01710e5ebf6fc51b8a65c92a
2017-03-18 10:10:33 +01:00
practicalswift 8dc957ae06 Remove unused code 2017-03-17 04:37:43 +01:00
Suhas Daftuar abe7b3d3ab Don't require segwit in getblocktemplate for segwit signalling or mining
Segwit's version bit will be signalled for all invocations of CreateNewBlock,
and not specifying segwit only will cause CreateNewBlock to skip transactions
with witness from being selected.
2017-03-14 06:43:37 -04:00
practicalswift 9ea249014a [trival] Fix typo introduced into rpc/protocol.h in commit 338bf06
The typo was introduced in commit 338bf065a4, which was merged yesterday.

Changes summarized to facilitate reviewing:
* exampled → example
2017-03-09 10:16:16 +01:00
Wladimir J. van der Laan 02bd6e9bc6
Merge #9853: Fix error codes from various RPCs
adaa281 Update release notes to include RPC error code changes. (John Newbery)
338bf06 Add commenting around JSON error codes (John Newbery)
dab804c Return correct error codes in fundrawtransaction(). (John Newbery)
a012087 Return correct error codes in setban(). (John Newbery)
960bc7f Return correct error codes in removeprunedfunds(). (John Newbery)
c119096 Return correct error codes in blockchain.cpp. (John Newbery)
6d07c62 Return correct error codes in bumpfee(). (John Newbery)

Tree-SHA512: 4bb39ad221cd8c83d98ac5d7ad642f3a8c265522720dc86b2eebc70e74439a85b06d6ddcd6a874e879d986511de3ab0878bb7fe58b50cb0546b78913632ea809
2017-03-09 10:02:17 +01:00
Wladimir J. van der Laan 6805c4112c
Merge #9575: Remove unused, non-working RPC PostCommand signal
54fae05 Remove unreachable code (g_rpcSignals.PostCommand) (practicalswift)

Tree-SHA512: b416d63ffa1c35fa0434b6bc0a930ae1b04919a12114ef65154ce4621aa43d744eb4fc515f48eac2e96c0f528cedb4cdbe2349952d215c2c74e900a63e155e0a
2017-03-09 10:01:03 +01:00
practicalswift 54fae05dad Remove unreachable code (g_rpcSignals.PostCommand) 2017-03-09 09:47:04 +01:00
John Newbery 338bf065a4 Add commenting around JSON error codes
RPC_INVALID_REQUEST and RPC_METHOD_NOT_FOUND are mapped internally to
HTTP error codes and should not be used for application-layer errors.
This commit adds commenting around those definitions to warn not to use
them for application errors.
2017-03-08 14:22:55 -05:00
Karl-Johan Alm f3c264e9a6
Refactor: Remove using namespace <xxx> from rpc/ 2017-03-08 08:07:55 -08:00
John Newbery a012087667 Return correct error codes in setban().
The setban() RPC was returning misleading or incorrect error
codes (for example RPC_CLIENT_NODE_ALREADY_ADDED when an invalid IP
address was entered). This commit fixes those error codes:

- RPC_CLIENT_INVALID_IP_OR_SUBNET should be returned if the client
  enters an invalid IP address or subnet.

This commit also updates the test cases to explicitly test the error code.

This commit also adds a testcase for trying to setban on an invalid subnet.
2017-03-07 16:45:09 -05:00
John Newbery c1190963b3 Return correct error codes in blockchain.cpp.
RPCs in blockchain.cpp were returning misleading or incorrect error
codes (for example getblock() returning RPC_INTERNAL_ERROR when the
block had been pruned). This commit fixes those error codes:

- RPC_INTERNAL_ERROR should not be returned for application-level
  errors, only for genuine internal errors such as corrupted data.
- RPC_METHOD_NOT_FOUND should not be returned in response to a
  JSON request for an existing method.

Those error codes have been replaced with RPC_MISC_ERROR or
RPC_INVALID_PARAMETER as appropriate.
2017-03-07 16:45:09 -05:00
Wladimir J. van der Laan 30ff3a2fc9
Merge #9602: Remove coin age priority and free transactions - implementation
b421e6d Update example bitcoin.conf (Alex Morcos)
7d4e950 Allow setting minrelaytxfee to 0 (Alex Morcos)
359e8a0 [cleanup] Remove coin age priority completely. (Alex Morcos)
f9b9371 [rpc] Remove priorityDelta from prioritisetransaction (Alex Morcos)
49be7e1 [rpc] Remove priority information from mempool RPC calls (Alex Morcos)
0315888 [test] Remove priority from tests (Alex Morcos)
f838005 No longer allow "free" transactions (Alex Morcos)
ad727f4 [rpc] sendrawtransaction no longer bypasses minRelayTxFee (Alex Morcos)
fe282ac [cleanup] Remove estimatePriority and estimateSmartPriority (Alex Morcos)
400b151 [debug] Change -printpriority option (Alex Morcos)
272b25a [mining] Remove -blockprioritysize. (Alex Morcos)
12839cd [rpc] Remove estimatepriority and estimatesmartpriority. (Alex Morcos)
ddf58c7 wallet: Remove sendfree (MarcoFalke)

Tree-SHA512: a9a4499405923ce794ef18f9e334dbbd59dfc73a3dc2df6f85cc9c62af6f353ec2eed9c2d5e58e904f918d0d7ab738f403dd4939d9bc2276136864fe63710782
2017-03-07 19:30:23 +01:00
Wladimir J. van der Laan 5a6af31722
Merge #9908: Define 7200 second timestamp window constant
e57a1fd Define 7200 second timestamp window constant (Russell Yanofsky)

Tree-SHA512: 449d20e4fd23905cd96be36f717c55a0a2360aba1002aaf55a3699cce4a41f6e94acc2fbe511a93c5cbe8f8e68386995a76cad67620ebb66ba9283e6080ab567
2017-03-06 10:02:05 +01:00
Alex Morcos f9b9371c60 [rpc] Remove priorityDelta from prioritisetransaction
This a breaking API change to the prioritisetransaction RPC call which previously required exactly three arguments and now requires exactly two (hash and feeDelta).  The function prioritiseTransaction is also updated.
2017-03-03 16:50:19 -05:00
Alex Morcos 49be7e1bef [rpc] Remove priority information from mempool RPC calls
"startingpriority" and "currentpriority" are no longer returned in the JSON information about a mempool entry.  This affects getmempoolancestors, getmempooldescendants, getmempooolentry, and getrawmempool.
2017-03-03 16:50:19 -05:00
Alex Morcos f838005444 No longer allow "free" transactions
Remove -limitfreerelay and always enforce minRelayTxFee in the mempool (except from disconnected blocks)

Remove -relaypriority, the option was only used for the ability to allow free transactions to be relayed regardless of their priority.  Both notions no longer apply.
2017-03-03 16:50:19 -05:00
Russell Yanofsky e57a1fd899 Define 7200 second timestamp window constant 2017-03-03 13:51:41 -05:00
Wladimir J. van der Laan eb281842b7
Merge #8775: RPC refactoring: Access wallet using new GetWalletForJSONRPCRequest
d678771 Wallet: Sanitise -wallet parameter (Luke Dashjr)
9756be3 Wallet/RPC: Use filename rather than CWallet pointer, for lockwallet RPCRunLater job name (Luke Dashjr)
86be48a More tightly couple EnsureWalletIsAvailable with GetWalletForJSONRPCRequest where appropriate (Luke Dashjr)
a435632 Move wallet RPC declarations to rpcwallet.h (Luke Dashjr)
ad15734 RPC: Pass on JSONRPCRequest metadata (URI/user/etc) for "help" method (Luke Dashjr)
bf8a04a Reformat touched lines with C++11 (Luke Dashjr)
2e518e3 Move nWalletUnlockTime to CWallet::nRelockTime, and name timed task unique per CWallet (Luke Dashjr)
d77ad6d RPC: Do all wallet access through new GetWalletForJSONRPCRequest (Luke Dashjr)
eca550f RPC/Wallet: Pass CWallet as pointer to helper functions (Luke Dashjr)

Tree-SHA512: bfd592da841693390e16f83b451503eb5cedb71208089aa32b3fc45e973555584a3ed7696dd239f6409324464d565dacf0f3d0e36e8e13ae6a7843848465f960
2017-03-03 13:38:42 +01:00
Gregory Sanders 666597798c remove 'label' filter for rpc command help 2017-03-01 09:15:39 -08:00
Luke Dashjr a4356328e0 Move wallet RPC declarations to rpcwallet.h 2017-02-27 20:45:18 +00:00
Luke Dashjr ad1573472e RPC: Pass on JSONRPCRequest metadata (URI/user/etc) for "help" method 2017-02-27 20:45:18 +00:00
Luke Dashjr bf8a04a165 Reformat touched lines with C++11 2017-02-27 20:45:18 +00:00
Luke Dashjr 2e518e313b Move nWalletUnlockTime to CWallet::nRelockTime, and name timed task unique per CWallet 2017-02-27 20:45:17 +00:00
Luke Dashjr d77ad6d416 RPC: Do all wallet access through new GetWalletForJSONRPCRequest 2017-02-27 20:45:17 +00:00
Luke Dashjr eca550f250 RPC/Wallet: Pass CWallet as pointer to helper functions 2017-02-27 20:45:17 +00:00
Alex Morcos ad727f4eaf [rpc] sendrawtransaction no longer bypasses minRelayTxFee
The prioritisetransaction API can always be used if a transaction needs to be submitted that bypasses minRelayTxFee.
2017-02-27 11:23:51 -05:00
Alex Morcos 12839cdd56 [rpc] Remove estimatepriority and estimatesmartpriority.
The RPC calls were already deprecated.
2017-02-27 11:23:50 -05:00
Marijn Stollenga 83ac719d34 Change bitcoin address in RPC helpaddress to an invalid address, so people don't accidentally send coins there (like I did). 2017-02-26 14:01:05 +01:00
Karl-Johan Alm dc222f8f63
Trivial: Rephrase the definition of difficulty in the code. 2017-02-23 22:06:37 -08:00
Wladimir J. van der Laan bed5b30a56
Merge #9711: [Trivial] Remove incorrect help message from gettxoutproof()
9949ebf [Trivial] Remove incorrect help message from gettxoutproof() (John Newbery)
2017-02-22 13:03:42 +01:00
Wladimir J. van der Laan a8c5751038
Merge #9801: Removed redundant parameter from mempool.PrioritiseTransaction
eaea2bb Removed redundant parameter from mempool.PrioritiseTransaction (gubatron)
2017-02-22 12:18:38 +01:00
gubatron eaea2bbb41 Removed redundant parameter from mempool.PrioritiseTransaction
(Also made the `const uint256 hash` parameter a `const uint256& hash` as suggested by @sdaftuar)
2017-02-21 20:44:23 -07:00
Wladimir J. van der Laan aa791e2911
Merge #9619: Bugfix: RPC/Mining: GBT should return 1 MB sizelimit before segwit activates
279f944 QA: Test GBT size/weight limit values (Luke Dashjr)
9fc7f0b Bugfix: RPC/Mining: GBT should return 1 MB sizelimit before segwit activates (Luke Dashjr)
2017-02-20 17:32:02 +01:00
MarcoFalke aa5fa642b0
Merge #9696: [trivial] Fix recently introduced typos in comments
0c9b9b7 [trivial] Fix recently introduced typos in comments (practicalswift)
2017-02-18 12:13:09 +01:00
Cory Fields 3301587dc5 boost: remove iostreams includes
They're unused and produce nasty deprecation warnings
2017-02-17 15:06:09 -05:00
Alex Morcos 91fb506e0a Add two hour buffer to manual pruning 2017-02-16 17:47:56 -05:00
practicalswift 0c9b9b7d64 [trivial] Fix recently introduced typos in comments 2017-02-14 20:19:40 +01:00
Russell Yanofsky a80f98b1c7 Use importmulti timestamp when importing watch only keys
When importing a watch-only address over importmulti with a specific timestamp,
the wallet's nTimeFirstKey is currently set to 1. After this change, the
provided timestamp will be used and stored as metadata associated with
watch-only key. This can improve wallet performance because it can avoid the
need to scan the entire blockchain for watch only addresses when timestamps are
provided.

Also adds timestamp to validateaddress return value (needed for tests).

Fixes #9034.
2017-02-10 16:11:19 -05:00
Russell Yanofsky 3cf991756c Add test to check new importmulti "now" value
Easiest way to test this was to expose the timestamp via the validateaddress
RPC (which was already looking up and returning key metadata).
2017-02-10 15:40:28 -05:00
John Newbery 9949ebfa6a [Trivial] Remove incorrect help message from gettxoutproof() 2017-02-07 11:21:14 -05:00
Matt Corallo 922bea90c2 Better handle invalid parameters to signrawtransaction
This silently skips trying to merge signatures from inputs which
do not exist from transactions provided to signrawtransaction,
instead of hitting an assert.
2017-02-02 17:32:27 -05:00
Luke Dashjr 9fc7f0bce9 Bugfix: RPC/Mining: GBT should return 1 MB sizelimit before segwit activates 2017-02-02 20:00:25 +00:00
Wladimir J. van der Laan 4e19efba03
Merge #9556: Remove redundant semicolons
8fc6989 Remove redundant semicolons (practicalswift)
2017-02-02 11:57:40 +01:00
Wladimir J. van der Laan d2c9e4d422
Merge #9615: Wallet incremental fee
4b189c1 Change bumpfee result value from 'oldfee' to 'origfee'. (Alex Morcos)
0c0c63f Introduce WALLET_INCREMENTAL_RELAY_FEE (Alex Morcos)
e8021ec Use CWallet::GetMinimumFee in bumpfee (Alex Morcos)
ae9719a Refactor GetMinimumFee to give option of providing targetFee (Alex Morcos)
fe8e8ef [rpc] Add incremental relay fee to getnetworkinfo (Alex Morcos)
6b331e6 Fix to have miner test aware of new separate block min tx fee (Alex Morcos)
de6400d Fix missing use of dustRelayFee (Alex Morcos)
5b15870 Use incrementalRelayFee for BIP 125 replacement (Alex Morcos)
2017-01-30 10:38:56 +01:00
practicalswift cc16d99f1d [trivial] Fix typos in comments 2017-01-27 21:22:35 +01:00
Wladimir J. van der Laan 3f9f9629cc
Merge #9606: net: Consistently use GetTimeMicros() for inactivity checks
99464bc net: Consistently use GetTimeMicros() for inactivity checks (Suhas Daftuar)
2017-01-26 09:57:45 +01:00
Suhas Daftuar 99464bc38e net: Consistently use GetTimeMicros() for inactivity checks
The use of mocktime in test logic means that comparisons between
GetTime() and GetTimeMicros()/1000000 are unreliable since the former
can use mocktime values while the latter always gets the system clock;
this changes the networking code's inactivity checks to consistently
use the system clock for inactivity comparisons.

Also remove some hacks from setmocktime() that are no longer needed,
now that we're using the system clock for nLastSend and nLastRecv.
2017-01-25 09:48:14 -05:00
Alex Morcos fe8e8efcf9 [rpc] Add incremental relay fee to getnetworkinfo 2017-01-20 07:40:36 -05:00
Wladimir J. van der Laan 2ef52d3cf1
Merge #8456: [RPC] Simplified bumpfee command.
cc0243a [RPC] bumpfee (mrbandrews)
52dde66 [wallet] Add include_unsafe argument to listunspent RPC (Russell Yanofsky)
766e8a4 [wallet] Add IsAllFromMe: true if all inputs are from wallet (Suhas Daftuar)
2017-01-19 19:59:24 +01:00
mrbandrews cc0243ad32 [RPC] bumpfee
This command allows a user to increase the fee on a wallet transaction T, creating a "bumper" transaction B.
T must signal that it is BIP-125 replaceable.
T's change output is decremented to pay the additional fee.  (B will not add inputs to T.)
T cannot have any descendant transactions.
Once B bumps T, neither T nor B's outputs can be spent until either T or (more likely) B is mined.

Includes code by @jonasschnelli and @ryanofsky
2017-01-19 11:29:29 -05:00
Russell Yanofsky 52dde66770 [wallet] Add include_unsafe argument to listunspent RPC 2017-01-19 11:29:29 -05:00
Wladimir J. van der Laan 9c9af5ab2d
Merge #9499: Use recent-rejects, orphans, and recently-replaced txn for compact-block-reconstruction
c594580 Add braces around AddToCompactExtraTransactions (Matt Corallo)
1ccfe9b Clarify comment about mempool/extra conflicts (Matt Corallo)
fac4c78 Make PartiallyDownloadedBlock::InitData's second param const (Matt Corallo)
b55b416 Add extra_count lower bound to compact reconstruction debug print (Matt Corallo)
863edb4 Consider all (<100k memusage) txn for compact-block-extra-txn cache (Matt Corallo)
7f8c8ca Consider all orphan txn for compact-block-extra-txn cache (Matt Corallo)
93380c5 Use replaced transactions in compact block reconstruction (Matt Corallo)
1531652 Keep shared_ptrs to recently-replaced txn for compact blocks (Matt Corallo)
edded80 Make ATMP optionally return the CTransactionRefs it replaced (Matt Corallo)
c735540 Move ORPHAN constants from validation.h to net_processing.h (Matt Corallo)
2017-01-19 09:03:46 +01:00
practicalswift 8fc698935f Remove redundant semicolons 2017-01-14 21:45:32 +01:00
Gregory Maxwell 997a98a674 Replace FindLatestBefore used by importmuti with FindEarliestAtLeast.
In spite of the name FindLatestBefore used std::lower_bound to try
 to find the earliest block with a nTime greater or equal to the
 the requested value.  But lower_bound uses bisection and requires
 the input to be ordered with respect to the comparison operation.
 Block times are not well ordered.

I don't know what lower_bound is permitted to do when the data
 is not sufficiently ordered, but it's probably not good.
 (I could construct an implementation which would infinite loop...)

To resolve the issue this commit introduces a maximum-so-far to the
 block indexes and searches that.

For clarity the function is renamed to reflect what it actually does.

An issue that remains is that there is no grace period in importmulti:
 If a address is created at time T and a send is immediately broadcast
 and included by a miner with a slow clock there may not yet have been
 any block with at least time T.

The normal rescan has a grace period of 7200 seconds, but importmulti
 does not.
2017-01-12 14:21:43 +00:00
Wladimir J. van der Laan fac0f30482
Merge #9472: Disentangle progress estimation from checkpoints and update it
df36371 Update estimated transaction count data (Pieter Wuille)
e356d9a Shorten variable names and switch to tx/s (Pieter Wuille)
6dd8116 Remove SIGCHECK_VERIFICATION_FACTOR (Pieter Wuille)
3641141 Move tx estimation data out of CCheckPointData (Pieter Wuille)
a4bac66 [MOVEONLY] Move progress estimation out of checkpoints (Pieter Wuille)
2017-01-12 12:13:14 +01:00
MarcoFalke a65ced1a66
Merge #9518: Return height of last block pruned by pruneblockchain RPC
918d1fb Return height of last block pruned by pruneblockchain RPC (Russell Yanofsky)
2017-01-12 11:50:14 +01:00
MarcoFalke 2456a835f0
Merge #9520: Deprecate non-txindex getrawtransaction and better warning
db904db Deprecate non-txindex getrawtransaction and better warning (Pieter Wuille)
2017-01-12 10:52:32 +01:00
MarcoFalke 0b738075bd
Merge #9297: Various RPC help outputs updated
54ee3fc RPC help updated (Michael Rotarius)
2017-01-12 02:11:04 +01:00
Pieter Wuille db904db7e6 Deprecate non-txindex getrawtransaction and better warning 2017-01-11 15:34:13 -08:00
Michael Rotarius 54ee3fcb8f RPC help updated 2017-01-11 22:05:23 +01:00
Russell Yanofsky 918d1fb86b Return height of last block pruned by pruneblockchain RPC
Change suggested by Jonas Schnelli <dev@jonasschnelli.ch> in
https://github.com/bitcoin/bitcoin/pull/7871#discussion_r95577623
2017-01-11 14:25:32 -05:00
Wladimir J. van der Laan 5754e0341b
Merge #8811: rpc: Add support for JSON-RPC named arguments
4e7e2e1 Update RPC argument names (John Newbery)
481f289 rpc: Named argument support for bitcoin-cli (Wladimir J. van der Laan)
9adb4e1 rpc: Argument name consistency (Wladimir J. van der Laan)
8d713f7 rpc: Named arguments for rawtransaction calls (Wladimir J. van der Laan)
37a166f rpc: Named arguments for wallet calls (Wladimir J. van der Laan)
78b684f rpc: Named arguments for mining calls (Wladimir J. van der Laan)
b8ebc59 rpc: Named arguments for net calls (Wladimir J. van der Laan)
2ca9dcd test: Add test for RPC named arguments (Wladimir J. van der Laan)
fba1a61 rpc: Named arguments for misc calls (Wladimir J. van der Laan)
286ec08 rpc: Add 'echo' call for testing (Wladimir J. van der Laan)
495eb44 rpc: Named arguments for blockchain calls (Wladimir J. van der Laan)
6f1c76a rpc: Support named arguments (Wladimir J. van der Laan)
5865d41 authproxy: Add support for RPC named arguments (Wladimir J. van der Laan)
2017-01-10 14:14:50 +01:00
Russell Yanofsky afffeea7d9 fixup! Add pruneblockchain RPC to enable manual block file pruning.
Extend pruneblockchain RPC to accept block timestamps as well as block indices.
2017-01-10 08:14:50 -05:00
mrbandrews 1fc4ec7bf2 Add pruneblockchain RPC to enable manual block file pruning. 2017-01-10 08:14:50 -05:00
John Newbery 4e7e2e16e4 Update RPC argument names 2017-01-10 12:04:54 +01:00
Wladimir J. van der Laan 481f289765 rpc: Named argument support for bitcoin-cli
Usage e.g.:

    $ src/bitcoin-cli -testnet -named echo arg0="dfdf"
    [
    "dfdf"
    ]

Argument conversion also works, for arguments thus flagged in the table in
`src/rpc/client.cpp`.

    $ src/bitcoin-cli -testnet -named echojson arg0="[1,2,3]"
    [
      [
        1,
        2,
        3
      ]
    ]

Unknown parameter (detected server-side):

    $ src/bitcoin-cli -testnet -named getinfo arg0="dfdf"
    error code: -8
    error message:
    Unknown named parameter arg0
2017-01-10 12:04:54 +01:00
Matt Corallo edded808fc Make ATMP optionally return the CTransactionRefs it replaced 2017-01-09 14:15:18 -05:00
Gregory Maxwell 032ba3f066 RPC help documentation for addnode peerinfo.
Also adds a comment about the netgroup exclusion behavior.
2017-01-05 19:02:15 +00:00
Gregory Maxwell 50bd12ce0c Break addnode out from the outbound connection limits.
Previously addnodes were in competition with outbound connections
 for access to the eight outbound slots.

One result of this is that frequently a node with several addnode
 configured peers would end up connected to none of them, because
 while the addnode loop was in its two minute sleep the automatic
 connection logic would fill any free slots with random peers.
 This is particularly unwelcome to users trying to maintain links
 to specific nodes for fast block relay or purposes.

Another result is that a group of nine or more nodes which are
 have addnode configured towards each other can become partitioned
 from the public network.

This commit introduces a new limit of eight connections just for
 addnode peers which is not subject to any of the other connection
 limitations (including maxconnections).

The choice of eight is sufficient so that under no condition would
 a user find themselves connected to fewer addnoded peers than
 previously.  It is also low enough that users who are confused
 about the significance of more connections and have gotten too
 copy-and-paste happy will not consume more than twice the slot
 usage of a typical user.

Any additional load on the network resulting from this will likely
 be offset by a reduction in users applying even more wasteful
 workaround for the prior behavior.

The retry delays are reduced to avoid nodes sitting around without
 their added peers up, but are still sufficient to prevent overly
 aggressive repeated connections.  The reduced delays also make
 the system much more responsive to the addnode RPC.

Ban-disconnects are also exempted for peers added via addnode since
 the outbound addnode logic ignores bans.  Previously it would ban
 an addnode then immediately reconnect to it.

A minor change was also made to CSemaphoreGrant so that it is
 possible to re-acquire via an object whos grant was moved.
2017-01-05 19:02:09 +00:00
Wladimir J. van der Laan ce43630d1e
Merge #8747: [rpc] Fix transaction size comments and RPC help text.
d29505d Fix transaction size comments. Size now refers to virtual size as defined in BIP141. (jonnynewbs)
2017-01-05 12:06:42 +01:00
Wladimir J. van der Laan 9adb4e1a59 rpc: Argument name consistency
The meaning is clear from the context, and we're inconsistent here.
Also save typing when using named arguments.

- `bitcoinaddress` -> `address`
- `bitcoinprivkey` -> `privkey`
- `bitcoinpubkey` -> `pubkey`
2017-01-05 11:30:20 +01:00