Commit Graph

456 Commits

Author SHA1 Message Date
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
Wladimir J. van der Laan 8d713f761b rpc: Named arguments for rawtransaction calls 2017-01-05 11:30:20 +01:00
Wladimir J. van der Laan 78b684f2ac rpc: Named arguments for mining calls 2017-01-05 11:30:20 +01:00
Wladimir J. van der Laan b8ebc595bb rpc: Named arguments for net calls
Also add a more descriptive message for `setnetworkactive`.
2017-01-05 11:30:20 +01:00
Wladimir J. van der Laan fba1a6150c rpc: Named arguments for misc calls 2017-01-05 11:30:20 +01:00
Wladimir J. van der Laan 286ec08cb0 rpc: Add 'echo' call for testing
This hidden call simply returns what is passed in.
2017-01-05 11:30:20 +01:00
Wladimir J. van der Laan 495eb44a4f rpc: Named arguments for blockchain calls 2017-01-05 11:30:20 +01:00
Wladimir J. van der Laan 6f1c76ae14 rpc: Support named arguments
The [JSON-RPC specification](http://www.jsonrpc.org/specification) allows passing parameters as an Array, for by-position
arguments, or an Object, for by-name arguments.

This implements by-name arguments, but preserves full backwards compatibility. API using by-name arguments are
easier to extend, and easier to use (no need to guess which argument goes where).

Named are mapped to positions by a per-call structure, provided through the RPC command table.

Missing arguments will be replaced by null, except if at the end, then the argument is left out completely.

Currently calls fail (though not crash) on intermediate nulls, but this should be improved on a per-call basis later.
2017-01-05 11:30:20 +01:00
Pieter Wuille 3641141c8f Move tx estimation data out of CCheckPointData 2017-01-04 13:18:49 -08:00
Pieter Wuille a4bac66cca [MOVEONLY] Move progress estimation out of checkpoints 2017-01-04 13:18:49 -08:00
Wladimir J. van der Laan 869781c51c
Merge #9283: A few more CTransactionRef optimizations
91335ba Remove unused MakeTransactionRef overloads (Pieter Wuille)
6713f0f Make FillBlock consume txn_available to avoid shared_ptr copies (Pieter Wuille)
62607d7 Convert COrphanTx to keep a CTransactionRef (Pieter Wuille)
c44e4c4 Make AcceptToMemoryPool take CTransactionRef (Pieter Wuille)
2017-01-04 12:23:10 +01:00
isle2983 27765b6403 Increment MIT Licence copyright header year on files modified in 2016
Edited via:

$ contrib/devtools/copyright_header.py update .
2016-12-31 11:01:21 -07:00
Anditto Heristyo afe5b3f553 Added missing colons in when running help command 2016-12-22 13:26:03 +09:00
Pieter Wuille c44e4c467c Make AcceptToMemoryPool take CTransactionRef 2016-12-21 18:18:23 -08:00
Wladimir J. van der Laan e8cfe1ee2d
Merge #8589: Inline CTxInWitness inside CTxIn
f6fb7ac Move CTxInWitness inside CTxIn (Pieter Wuille)
2016-12-21 14:04:06 +01:00
Wladimir J. van der Laan b68685a16a
Merge #9273: Remove unused CDiskBlockPos* argument from ProcessNewBlock
a13fa4c Remove unused CDiskBlockPos* argument from ProcessNewBlock (Matt Corallo)
2016-12-14 10:56:28 +01:00
jonnynewbs d29505db22 Fix transaction size comments. Size now refers to virtual size as defined in BIP141. 2016-12-08 17:03:57 +00:00
Gregory Sanders bc7ff8db99 Add option to return non-segwit serialization via rpc 2016-12-05 07:43:22 -05:00
Pieter Wuille f6fb7acda4 Move CTxInWitness inside CTxIn 2016-12-04 23:47:12 -08:00
Wladimir J. van der Laan d04aebaec7
Merge #9014: Fix block-connection performance regression
dd0df81 Document ConnectBlock connectTrace postconditions (Matt Corallo)
2d6e561 Switch pblock in ProcessNewBlock to a shared_ptr (Matt Corallo)
2736c44 Make the optional pblock in ActivateBestChain a shared_ptr (Matt Corallo)
ae4db44 Create a shared_ptr for the block we're connecting in ActivateBCS (Matt Corallo)
fd9d890 Keep blocks as shared_ptrs, instead of copying txn in ConnectTip (Matt Corallo)
6fdd43b Add struct to track block-connect-time-generated info for callbacks (Matt Corallo)
2016-12-05 08:07:45 +01:00
Matt Corallo a13fa4c80f Remove unused CDiskBlockPos* argument from ProcessNewBlock 2016-12-04 00:23:17 -08:00
Matt Corallo 2d6e5619af Switch pblock in ProcessNewBlock to a shared_ptr
This (finally) fixes a performance regression in
b3b3c2a562
2016-12-04 00:17:30 -08:00
Matt Corallo 2736c44c8e Make the optional pblock in ActivateBestChain a shared_ptr 2016-12-04 00:13:09 -08:00
Pieter Wuille 42fd8dee30 Make DecodeHexTx return a CMutableTransaction 2016-12-02 18:28:22 -08:00
Pieter Wuille a1883536b4 Switch GetTransaction to returning a CTransactionRef 2016-12-02 18:28:22 -08:00
Pieter Wuille 2efcfa5acf
Merge #9260: Mrs Peacock in The Library with The Candlestick (killed main.{h,cpp})
76faa3c Rename the remaining main.{h,cpp} to validation.{h,cpp} (Matt Corallo)
e736772 Move network-msg-processing code out of main to its own file (Matt Corallo)
87c35f5 Remove orphan state wipe from UnloadBlockIndex. (Matt Corallo)
2016-12-02 18:25:40 -08:00
Matt Corallo 76faa3cdfe Rename the remaining main.{h,cpp} to validation.{h,cpp} 2016-12-02 09:42:51 -08:00
Matt Corallo e736772c56 Move network-msg-processing code out of main to its own file 2016-12-02 09:42:51 -08:00
Alex Morcos d824ad030e Disable fee estimates for a confirm target of 1 block 2016-11-29 12:18:44 -05:00
Wladimir J. van der Laan d932159f34
Merge #9189: Always add default_witness_commitment with GBT client support
95f4a03 [qa] Test getblocktemplate default_witness_commitment (Suhas Daftuar)
ad04d1c Always add default_witness_commitment with GBT client support (Pieter Wuille)
2016-11-25 08:26:25 +01:00
fanquake e3c4f7e182
Correct help output for waitfor RPC commands 2016-11-24 19:50:07 +08:00
Wladimir J. van der Laan 4d8558a287
Merge #9025: getrawtransaction should take a bool for verbose
240189b add testcases for getrawtransaction (John Newbery)
ce2bb23 getrawtransaction should take a bool for verbose (jnewbery)
2016-11-23 07:13:46 +01:00
jnewbery ce2bb23aa5 getrawtransaction should take a bool for verbose 2016-11-22 14:37:33 +00:00
Pieter Wuille ad04d1cb35 Always add default_witness_commitment with GBT client support 2016-11-21 15:01:04 -08:00
Pieter Wuille 1662b437b3 Make CBlock::vtx a vector of shared_ptr<CTransaction> 2016-11-19 17:51:09 -08:00
Pieter Wuille 9346f84299
Merge #9075: Decouple peer-processing-logic from block-connection-logic (#3)
ae22357 Replace CValidationState param in ProcessNewBlock with BlockChecked (Matt Corallo)
7c98ce5 Remove pfrom parameter from ProcessNewBlock (Matt Corallo)
e2e069d Revert "RPC: Give more details when "generate" fails" (Matt Corallo)
2016-11-17 13:23:50 -08:00
Jonas Schnelli ab914a6530
Merge #8996: Network activity toggle
19f46f1 Qt: New network_disabled icon (Luke Dashjr)
54cf997 RPC/Net: Use boolean consistently for networkactive, and remove from getinfo (Luke Dashjr)
b2b33d9 Overhaul network activity toggle (Jonas Schnelli)
32efa79 Qt: Add GUI feedback and control of network activity state. (Jon Lund Steffensen)
e38993b RPC: Add "togglenetwork" method to toggle network activity temporarily (Jon Lund Steffensen)
7c9a98a Allow network activity to be temporarily suspended. (Jon Lund Steffensen)
2016-11-11 11:16:40 +01:00
Masahiko Hyuga a79f864945 fix getnettotals RPC description about timemillis. 2016-11-10 18:18:52 +09:00
Matt Corallo ae22357607 Replace CValidationState param in ProcessNewBlock with BlockChecked 2016-11-09 11:21:55 -08:00
Matt Corallo 7c98ce584e Remove pfrom parameter from ProcessNewBlock
This further decouples ProcessNewBlock from networking/peer logic.
2016-11-09 11:21:45 -08:00
Matt Corallo e2e069dabc Revert "RPC: Give more details when "generate" fails"
This only returned information in the case of CheckBlock failure,
but breaks future changes.
2016-11-08 17:39:44 -08:00
Jorge Timón 1adf82ac39
RPC: Give more details when "generate" fails 2016-11-08 15:08:56 +01:00
Pieter Wuille dc6b9406bd
Merge #9026: Fix handling of invalid compact blocks
d4833ff Bump the protocol version to distinguish new banning behavior. (Suhas Daftuar)
88c3549 Fix compact block handling to not ban if block is invalid (Suhas Daftuar)
c93beac [qa] Test that invalid compactblocks don't result in ban (Suhas Daftuar)
2016-11-07 18:11:18 -08:00
Alex Morcos b2322e0fc6 Remove priority estimation 2016-11-07 13:22:34 +01:00
Suhas Daftuar 88c35491ab Fix compact block handling to not ban if block is invalid 2016-11-03 13:07:12 -04:00
Wladimir J. van der Laan bc785d7185
Merge #9042: [rpc] ParseHash: Fail when length is not 64
fa32619 [rpc] ParseHash: Fail when length is not 64 (MarcoFalke)
2016-11-02 21:04:20 +01:00
Wladimir J. van der Laan f8723d2318
Merge #8753: Locked memory manager
444c673 bench: Add benchmark for lockedpool allocation/deallocation (Wladimir J. van der Laan)
6567999 rpc: Add `getmemoryinfo` call (Wladimir J. van der Laan)
4536148 support: Add LockedPool (Wladimir J. van der Laan)
f4d1fc2 wallet: Get rid of LockObject and UnlockObject calls in key.h (Wladimir J. van der Laan)
999e4c9 wallet: Change CCrypter to use vectors with secure allocator (Wladimir J. van der Laan)
2016-11-02 11:16:29 +01:00
MarcoFalke fa326193ad [rpc] ParseHash: Fail when length is not 64 2016-10-31 10:46:52 +01:00
matthias 7f61b49de8 Change all instance of 'GMT epoch' to 'Unix epoch' 2016-10-31 01:11:46 +01:00
S. Matthew English 1c3ecc70c8 instance of 'mem pool' to 'mempool'
there was only one instance of  'mem pool' and not 'mempool', so I changed it to conform to the others
2016-10-27 16:45:09 +02:00
Wladimir J. van der Laan 6567999096 rpc: Add `getmemoryinfo` call
```
getmemoryinfo
Returns an object containing information about memory usage.

Result:
{
  "locked": {               (json object) Information about locked memory manager
    "used": xxxxx,          (numeric) Number of bytes used
    "free": xxxxx,          (numeric) Number of bytes available in current arenas
    "total": xxxxxxx,       (numeric) Total number of bytes managed
    "locked": xxxxxx,       (numeric) Amount of bytes that succeeded locking. If this number is smaller than total, locking pages failed at some point and key data could be swapped to disk.
  }
}

Examples:
> bitcoin-cli getmemoryinfo
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getmemoryinfo", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/
```
2016-10-27 13:17:26 +02:00
Luke Dashjr 54cf99745f RPC/Net: Use boolean consistently for networkactive, and remove from getinfo 2016-10-24 10:23:58 +00:00
Jonas Schnelli b2b33d9017 Overhaul network activity toggle
- Rename RPC command "togglenetwork" to "setnetworkactive (true|false)"
- Add simple test case
- GUI toggle added to connections icon in statusbar
2016-10-24 10:23:58 +00:00
Jon Lund Steffensen e38993bb36 RPC: Add "togglenetwork" method to toggle network activity temporarily
RPC command "togglenetwork" toggles network and returns new state after command.
RPC command "getinfo" returns "networkactive" field in output.
2016-10-24 10:23:58 +00:00
S. Matthew English 3a286abf8f Eliminating Inconsistencies in Textual Output
There were discrepancies between usage of "block chain" and "blockchain", I've changed them to the latter. The reason for this was that Wikipedia when describing this data structure writes "A blockchain — *originally block chain*", so it seemed the more appropriate term.
2016-10-20 12:39:48 +02:00
Wladimir J. van der Laan f2d705629b
Merge #7551: Add importmulti RPC call
215caba Add consistency check to RPC call importmulti (Pedro Branco)
cb08fdb Add importmulti rpc call (Pedro Branco)
2016-10-20 09:04:32 +02:00
Wladimir J. van der Laan 5d2c8e524e
Merge #7948: RPC: augment getblockchaininfo bip9_softforks data
fc14609 RPC: augment getblockchaininfo bip9_softforks data (mruddy)
2016-10-19 16:41:59 +02:00
Pedro Branco cb08fdbf78 Add importmulti rpc call 2016-10-19 15:17:13 +01:00
mruddy fc146095d2 RPC: augment getblockchaininfo bip9_softforks data 2016-10-19 09:08:39 -04:00
Jonas Schnelli e7156ad61b
[RPC] pass HTTP basic authentication username to the JSONRequest object 2016-10-19 14:47:27 +02:00
Jonas Schnelli 69d1c25768
[RPC] Give RPC commands more information about the RPC request 2016-10-19 14:42:08 +02:00
Wladimir J. van der Laan 23c32a9694
rpc: Change JSONRPCRequest to JSONRPCRequestObj
This is more consistent with `JSONRPCReplyObj`.
2016-10-19 14:30:14 +02:00
Wladimir J. van der Laan b2df292e34
Merge #8951: RPC/Mining: getblocktemplate: Update and fix formatting of help
59daa58 RPC/Mining: getblocktemplate: Update and fix formatting of help (Luke Dashjr)
2016-10-19 10:59:11 +02:00
Luke Dashjr 59daa58d6a RPC/Mining: getblocktemplate: Update and fix formatting of help 2016-10-19 10:47:32 +02:00
Wladimir J. van der Laan 05998da5a7
Merge #8865: Decouple peer-processing-logic from block-connection-logic
a9aec5c Use BlockChecked signal to send reject messages from mapBlockSource (Matt Corallo)
7565e03 Remove SyncWithWallets wrapper function (Matt Corallo)
12ee1fe Always call UpdatedBlockTip, even if blocks were only disconnected (Matt Corallo)
f5efa28 Remove CConnman parameter from ProcessNewBlock/ActivateBestChain (Matt Corallo)
fef1010 Use CValidationInterface from chain logic to notify peer logic (Matt Corallo)
aefcb7b Move net-processing logic definitions together in main.h (Matt Corallo)
0278fb5 Remove duplicate nBlocksEstimate cmp (we already checked IsIBD()) (Matt Corallo)
87e7d72 Make validationinterface.UpdatedBlockTip more verbose (Matt Corallo)
2016-10-18 22:48:51 +02:00
Wladimir J. van der Laan 7f71a3c591
Merge #6996: Add preciousblock RPC
5805ac8 Add preciousblock tests (Pieter Wuille)
5127c4f Add preciousblock RPC (Pieter Wuille)
2016-10-18 21:36:38 +02:00
Wladimir J. van der Laan 744d2652dd
Merge #8223: [c++11] Use std::unique_ptr for block creation.
9fce062 [c++11] Use std::unique_ptr for block creation. (Daniel Kraft)
2016-10-18 21:16:08 +02:00
Wladimir J. van der Laan e10af96cf4
Merge #8287: [wallet] Set fLimitFree = true
fa8b02d [rpc] rawtx: Prepare fLimitFree to make it an option (MarcoFalke)
fa28bfa [wallet] Set fLimitFree = true (MarcoFalke)
2016-10-18 21:05:07 +02:00
Wladimir J. van der Laan f628d9a29a
Merge #8925: qt: Display minimum ping in debug window.
1724a40 Display minimum ping in debug window. (R E Broadley)
2016-10-18 15:16:39 +02:00
Wladimir J. van der Laan 6e094e54f7
Merge #8845: Don't return the address of a P2SH of a P2SH
d51f182 Don't return the address of a P2SH of a P2SH. (jnewbery)
2016-10-18 14:33:26 +02:00
Jorge Timón b26a7b5377
RPC: Chainparams: Remove Chainparams::fTestnetToBeDeprecatedFieldRPC 2016-10-18 13:17:38 +02:00
R E Broadley 1724a405c9 Display minimum ping in debug window. 2016-10-15 20:43:11 +07:00
jnewbery d51f182461 Don't return the address of a P2SH of a P2SH. 2016-10-05 08:58:18 -04:00
Wladimir J. van der Laan 223f4c2dd5
Merge #8884: Bugfix: Trivial: RPC: getblockchaininfo help: pruneheight is the lowest, not highest, block
a78e542 Bugfix: Trivial: RPC: getblockchaininfo help: pruneheight is the lowest, not highest, block (Luke Dashjr)
2016-10-05 14:44:07 +02:00
Luke Dashjr a78e5428ac Bugfix: Trivial: RPC: getblockchaininfo help: pruneheight is the lowest, not highest, block 2016-10-04 22:22:07 +00:00
Matt Corallo f5efa28393 Remove CConnman parameter from ProcessNewBlock/ActivateBestChain 2016-10-04 13:51:32 -04:00
Wladimir J. van der Laan 1c80386bce rpc: Generate auth cookie in hex instead of base64
Base64 contains '/', and the '/' character in credentials is problematic
for AuthServiceProxy which represents the RPC endpoint as an URI with
user and password embedded.

Closes #8399.
2016-10-01 16:57:25 +02:00
MarcoFalke fa05cfdf25 [rpc] throw JSONRPCError when utxo set can not be read 2016-09-28 21:00:58 +02:00
Pavel Janík 4731cab8fb Do not shadow variables 2016-09-27 09:25:15 +02:00
MarcoFalke ddddaafa4a [rpc] Deprecate getinfo
This was replaced by getmininginfo, getnetworkinfo and getwalletinfo
2016-09-21 21:19:20 +02:00
Johnson Lau 86c3f8db0b Remove createwitnessaddress
This RPC command is unsafe as it will return an address even if the script is invalid.
2016-09-13 11:35:14 +08:00
Wladimir J. van der Laan 6423116741
Merge #8085: p2p: Begin encapsulation
0103c5b net: move MAX_FEELER_CONNECTIONS into connman (Cory Fields)
e700cd0 Convert ForEachNode* functions to take a templated function argument rather than a std::function to eliminate std::function overhead (Jeremy Rubin)
d1a2295 Made the ForEachNode* functions in src/net.cpp more pragmatic and self documenting (Jeremy Rubin)
98591c5 net: move vNodesDisconnected into CConnman (Cory Fields)
fa2f8bc net: add nSendBufferMaxSize/nReceiveFloodSize to CConnection::Options (Cory Fields)
a19553b net: Introduce CConnection::Options to avoid passing so many params (Cory Fields)
bafa5fc net: Drop StartNode/StopNode and use CConnman directly (Cory Fields)
e81a602 net: pass CClientUIInterface into CConnman (Cory Fields)
f60b905 net: Pass best block known height into CConnman (Cory Fields)
fdf69ff net: move max/max-outbound to CConnman (Cory Fields)
8a59369 net: move semOutbound to CConnman (Cory Fields)
bd72937 net: move nLocalServices/nRelevantServices to CConnman (Cory Fields)
be9c796 net: move SendBufferSize/ReceiveFloodSize to CConnman (Cory Fields)
63cafa6 net: move send/recv statistics to CConnman (Cory Fields)
adf5d4c net: SocketSendData returns written size (Cory Fields)
ee44fa9 net: move messageHandlerCondition to CConnman (Cory Fields)
960cf2e net: move nLocalHostNonce to CConnman (Cory Fields)
551e088 net: move nLastNodeId to CConnman (Cory Fields)
6c19d92 net: move whitelist functions into CConnman (Cory Fields)
53347f0 net: create generic functor accessors and move vNodes to CConnman (Cory Fields)
c0569c7 net: Add most functions needed for vNodes to CConnman (Cory Fields)
8ae2dac net: move added node functions to CConnman (Cory Fields)
502dd3a net: Add oneshot functions to CConnman (Cory Fields)
a0f3d3c net: move ban and addrman functions into CConnman (Cory Fields)
aaf018e net: handle nodesignals in CConnman (Cory Fields)
b1a5f43 net: move OpenNetworkConnection into CConnman (Cory Fields)
02137f1 net: Move socket binding into CConnman (Cory Fields)
5b446dd net: Pass CConnection to wallet rather than using the global (Cory Fields)
8d58c4d net: Pass CConnman around as needed (Cory Fields)
d7349ca net: Add rpc error for missing/disabled p2p functionality (Cory Fields)
cd16f48 net: Create CConnman to encapsulate p2p connections (Cory Fields)
d93b14d net: move CBanDB and CAddrDB out of net.h/cpp (Cory Fields)
531214f gui: add NodeID to the peer table (Cory Fields)
2016-09-09 11:52:22 +02:00
Jeremy Rubin d1a2295f0d Made the ForEachNode* functions in src/net.cpp more pragmatic and self documenting 2016-09-08 13:06:05 -04:00
Cory Fields bd72937dc4 net: move nLocalServices/nRelevantServices to CConnman
These are in-turn passed to CNode at connection time. This allows us to offer
different services to different peers (or test the effects of doing so).
2016-09-08 12:24:06 -04:00
Cory Fields 63cafa6329 net: move send/recv statistics to CConnman 2016-09-08 12:24:06 -04:00
Cory Fields 53347f0cb9 net: create generic functor accessors and move vNodes to CConnman 2016-09-08 12:24:06 -04:00
Cory Fields c0569c7fa1 net: Add most functions needed for vNodes to CConnman 2016-09-08 12:12:58 -04:00
Cory Fields 8ae2dac1c6 net: move added node functions to CConnman 2016-09-08 12:12:58 -04:00
Cory Fields a0f3d3cdad net: move ban and addrman functions into CConnman 2016-09-08 12:12:57 -04:00
Cory Fields b1a5f43208 net: move OpenNetworkConnection into CConnman 2016-09-08 12:06:24 -04:00
Cory Fields 8d58c4d81f net: Pass CConnman around as needed 2016-09-08 12:04:35 -04:00
Cory Fields d7349ca50d net: Add rpc error for missing/disabled p2p functionality 2016-09-08 12:04:35 -04:00
Cory Fields d6a5dc4a2e add waitfornewblock/waitforblock/waitforblockheight rpcs and use them for tests
waitfornewblock waits until a new block is received, or the timeout expires, then
returns the current block height/hash.

waitforblock waits for a specific blockhash, or until the timeout expires, then
returns the current block height/hash. If the target blockhash is the current
tip, it will return immediately.

waitforblockheight waits until the tip has reached a certain height or higher,
then returns the current height and hash.

waitforblockheight is used to avoid polling in the rpc tests.
2016-09-07 12:46:01 -04:00
Wladimir J. van der Laan 6f939c9080
Merge #8629: C++11: s/boost::scoped_ptr/std::unique_ptr/
cdd79eb C++11: s/boost::scoped_ptr/std::unique_ptr/ (Jorge Timón)
2016-09-02 09:56:33 +02:00
Jorge Timón cdd79eb70f C++11: s/boost::scoped_ptr/std::unique_ptr/ 2016-09-01 19:05:07 +02:00
Pieter Wuille 854f1af22e Make the dummy argument to getaddednodeinfo optional 2016-09-01 16:27:30 +02:00
Wladimir J. van der Laan 0c8875d23b
Merge #8163: Do not shadow global RPC table variable (tableRPC)
de1bbe3 Do not shadow global RPC table variable (tableRPC) (Pavel Janík)
2016-08-31 16:07:58 +02:00
Wladimir J. van der Laan a5bb6387f7
Merge #8607: [doc] Fix doxygen off-by-one comments, fix typos
fafe7b3 contrib: Make fix-copyright-headers.py more portable (MarcoFalke)
fa27c0a [doc] Fix typos in comments, doxygen: Fix comment syntax (MarcoFalke)
fabfd5d [qa] pull-tester: Don't mute zmq ImportError (MarcoFalke)
67a5502 init: Fix typo in help message for -whitelistforcerelay (Wladimir J. van der Laan)
2016-08-28 16:06:03 +02:00
Pieter Wuille 5127c4f21c Add preciousblock RPC
Includes a bugfix by Luke-Jr.
2016-08-26 23:05:45 +02:00
MarcoFalke fa8b02d36d [rpc] rawtx: Prepare fLimitFree to make it an option 2016-08-25 15:28:04 +02:00
Pavel Janík de1bbe3b78 Do not shadow global RPC table variable (tableRPC) 2016-08-25 15:02:26 +02:00
MarcoFalke fa27c0a2c4 [doc] Fix typos in comments, doxygen: Fix comment syntax 2016-08-22 10:51:41 +02:00
Wladimir J. van der Laan f4e777819c
Merge #8461: document return value of networkhashps for getmininginfo RPC endpoint
65f4532 document return value of networkhashps for getmininginfo RPC endpoint (Jameson Lopp)
2016-08-19 12:18:42 +02:00
Wladimir J. van der Laan e753eaeb34
Merge #8505: Trivial: Fix typos in various files
1aacfc2 various typos (leijurv)
2016-08-17 12:51:16 +02:00
Wladimir J. van der Laan 29496fc9e0
Merge #8512: Trivial: Corrected JSON typo on setban of net.cpp
6ffd996 Corrected JSON typo on setban of net.cpp (Sev)
2016-08-17 12:01:46 +02:00
Wladimir J. van der Laan 1030fa718c
Merge #8128: Net: Turn net structures into dumb storage classes
9e9d644 net: fixup nits (Cory Fields)
8945384 net: Have LookupNumeric return a CService directly (Cory Fields)
21ba407 net: narrow include scope after moving to netaddress (Cory Fields)
21e5b96 net: move CNetAddr/CService/CSubNet out of netbase (Cory Fields)
1017b8a net: Add direct tests for new CSubNet constructors (Cory Fields)
b6c3ff3 net: Split resolving out of CSubNet (Cory Fields)
f96c7c4 net: Split resolving out of CService (Cory Fields)
31d6b1d net: Split resolving out of CNetAddr (Cory Fields)
2016-08-15 13:35:27 +02:00
leijurv 1aacfc2da5
various typos 2016-08-14 07:57:11 -06:00
Sev 6ffd996b8e Corrected JSON typo on setban of net.cpp 2016-08-14 15:36:22 +03:00
Wladimir J. van der Laan 3859072963
Merge #8353: Trivial: tiny c++11 refactors
c784086 use std::map::emplace() instead of std::map::insert() (whythat)
5e187e7 use c++11 std::unique_ptr instead of boost::shared_ptr (whythat)
947913f use std::map::erase(const_iterator, const_iterator) to get non-constant iterator (whythat)
2016-08-13 15:55:09 +02:00
whythat c784086075 use std::map::emplace() instead of std::map::insert() 2016-08-09 03:11:45 +03:00
whythat 5e187e7001 use c++11 std::unique_ptr instead of boost::shared_ptr 2016-08-09 03:11:45 +03:00
Luke Dashjr 160f895a80 Bugfix: Use pre-BIP141 sigops until segwit activates 2016-08-08 21:56:32 +00:00
Jameson Lopp 65f4532f13 document return value of networkhashps for getmininginfo RPC endpoint 2016-08-05 04:04:07 -04:00
Cory Fields b6c3ff3dae net: Split resolving out of CSubNet 2016-07-31 14:01:43 -04:00
Cory Fields 31d6b1d5f0 net: Split resolving out of CNetAddr 2016-07-31 13:24:07 -04:00
NicolasDorier 122786d0e0 Consensus: Remove ISM 2016-07-23 01:02:53 +09:00
Suhas Daftuar 2c06bae39e Rename "block cost" to "block weight" 2016-07-18 13:28:26 -04:00
Jonas Schnelli b1c7b244e2
[Wallet] report optional HDKeypath/HDMasterKeyId in validateaddress 2016-07-09 12:12:32 +02:00
Pavel Janík 2129fcea69 The bit field is shown only when status is "started" 2016-06-28 10:25:27 +02:00
Wladimir J. van der Laan 5a06ebbf2d
Merge #8258: RPC: Hide softfork if timeout is 0
409f833 RPC: Hide softfork if timeout is 0 (jl2012)
2016-06-27 16:07:50 +02:00
Wladimir J. van der Laan 1922e5a654
Merge #8244: remove unnecessary LOCK(cs_main) in getrawpmempool
27f8126 remove unnecessary LOCK(cs_main) (Daniel Cousens)
2016-06-25 16:10:10 +02:00
jl2012 409f83322e RPC: Hide softfork if timeout is 0 2016-06-25 00:55:07 +08:00
Daniel Cousens 27f8126ff3 remove unnecessary LOCK(cs_main) 2016-06-23 12:44:53 +10:00
NicolasDorier 745eb678ef [RPC] signrawtransaction can sign P2WSH 2016-06-22 15:43:01 +02:00
Pieter Wuille f4691ab3a9 [RPC] Add wallet support for witness transactions (using P2SH)
Includes support for pushkeyhash wit v0 by Alex Morcos.
2016-06-22 15:43:01 +02:00
Pieter Wuille 605e8473a7 BIP143: Signing logic 2016-06-22 15:43:01 +02:00
Pieter Wuille 2b1f6f9ccf BIP141: Other consensus critical limits, and BIP145
Includes changes by Suhas Daftuar, Luke-jr, and mruddy.
2016-06-22 15:43:00 +02:00
Johnson Lau 7c4bf779e8 [RPC] Return witness data in blockchain RPCs
Includes RPC field name changes by Luke-jr.
2016-06-22 15:43:00 +02:00
Pieter Wuille 3dd410294d BIP143: Verification logic
Includes simplifications by Eric Lombrozo.
2016-06-22 15:43:00 +02:00
Pieter Wuille 0ef1dd3e11 Refactor script validation to observe amounts
This is a preparation for BIP143 support.
2016-06-22 15:43:00 +02:00
Pieter Wuille 8b49040854 BIP141: Commitment structure and deployment
Includes a fix by Suhas Daftuar and LongShao007
2016-06-22 15:42:59 +02:00
Pieter Wuille 449f9b8deb BIP141: Witness program 2016-06-22 15:42:59 +02:00
Pieter Wuille 7030d9eb47 BIP144: Serialization, hashes, relay (sender side)
Contains refactorings by Eric Lombrozo.
Contains fixup by Nicolas Dorier.
Contains cleanup of CInv::GetCommand by Alex Morcos
2016-06-22 15:42:59 +02:00
Daniel Kraft 9fce0629b4 [c++11] Use std::unique_ptr for block creation.
CreateNewBlock returns a pointer for which the caller takes ownership.
Use std::unique_ptr to make this explicit and simplify handling of these
objects in getblocktemplate.
2016-06-18 19:38:28 +02:00
Wladimir J. van der Laan 3f89a534ac
Merge #8113: Rework addnode behaviour
1a5a4e6 Randomize name lookup result in ConnectSocketByName (Pieter Wuille)
f9f5cfc Prevent duplicate connections where one is by name and another by ip (Pieter Wuille)
1111b80 Rework addnode behaviour (Pieter Wuille)
2016-06-16 12:06:51 +02:00
Wladimir J. van der Laan 62fcf27bd8
Merge #8171: [RPC] Fix createrawtx sequence number unsigned int parsing
6fa950a [RPC] Fix createrawtx sequence number unsigned int parsing (Jonas Schnelli)
2016-06-16 11:06:51 +02:00
Pieter Wuille 1111b80df8 Rework addnode behaviour
* Use CNode::addeName to track whether a connection to a name is already open
  * A new connection to a previously-connected by-name addednode is only opened when
    the previous one closes (even if the name starts resolving to something else)
  * At most one connection is opened per addednode (even if the name resolves to multiple)
* Unify the code between ThreadOpenAddedNodeConnections and getaddednodeinfo
  * Information about open connections is always returned, and the dns argument becomes a dummy
  * An IP address and inbound/outbound is only reported for the (at most 1) open connection
2016-06-13 23:53:06 +02:00
Wladimir J. van der Laan e1486eb95c
Merge #7598: Refactor CreateNewBlock to be a method of the BlockAssembler class
c2dd5a3 FIX: correctly measure size of priority block (Alex Morcos)
a278764 FIX: Account for txs already added to block in addPriorityTxs (Alex Morcos)
4dc94d1 Refactor CreateNewBlock to be a method of the BlockAssembler class (Alex Morcos)
2016-06-13 11:35:55 +02:00
Pieter Wuille 7ce9ac5c83
Merge #7292: [RPC] Expose ancestor/descendant information over RPC
176e19b Mention new RPC's in release notes (Suhas Daftuar)
7f6eda8 Add ancestor statistics to mempool entry RPC output (Suhas Daftuar)
a9b8390 Add test coverage for new RPC calls (Suhas Daftuar)
b09b813 Add getmempoolentry RPC call (Suhas Daftuar)
0dfd869 Add getmempooldescendants RPC call (Suhas Daftuar)
8f7b5dc Add getmempoolancestors RPC call (Suhas Daftuar)
5ec0cde Refactor logic for converting mempool entries to JSON (Suhas Daftuar)
2016-06-09 16:32:37 +02:00
Suhas Daftuar 7f6eda8043 Add ancestor statistics to mempool entry RPC output 2016-06-09 09:56:27 -04:00
Suhas Daftuar b09b8135ae Add getmempoolentry RPC call 2016-06-09 09:56:27 -04:00
Suhas Daftuar 0dfd86956d Add getmempooldescendants RPC call 2016-06-09 09:56:27 -04:00
Pieter Wuille 66ed450d77
Merge #7935: Versionbits: GBT support
12c708a getblocktemplate: Use version/force mutation to support pre-BIP9 clients (Luke Dashjr)
9879060 getblocktemplate: Explicitly handle the distinction between GBT-affecting softforks vs not (Luke Dashjr)
72cd6b2 qa/rpc-tests: bip9-softforks: Add tests for getblocktemplate versionbits updates (Luke Dashjr)
d3df40e Implement BIP 9 GBT changes (Luke Dashjr)
2016-06-08 15:44:07 +02:00
Jonas Schnelli 6fa950a573
[RPC] Fix createrawtx sequence number unsigned int parsing 2016-06-08 15:43:28 +02:00
Wladimir J. van der Laan 75ec320a0d
Merge #8153: [rpc] fundrawtransaction feeRate: Use BTC/kB
fa7f4f5 [rpc] fundrawtransaction feeRate: Use BTC/kB (MarcoFalke)
faf82e8 [rpc] fundrawtransaction: Fix help text and interface (MarcoFalke)
2016-06-08 14:14:54 +02:00
Wladimir J. van der Laan 67c91f8c4c
Merge #8065: Addrman offline attempts
6182d10 Do not increment nAttempts by more than one for every Good connection. (Gregory Maxwell)
c769c4a Avoid counting failed connect attempts when probably offline. (Gregory Maxwell)
2016-06-08 13:01:53 +02:00
Wladimir J. van der Laan 79004d4ae6
Merge #7957: [RPC][Bitcoin-TX] Add support for sequence number
ae357d5 [Bitcoin-Tx] Add tests for sequence number support (Jonas Schnelli)
e59336f [bitcoin-tx] allow to set nSequence number over the in= command (Jonas Schnelli)
a946bb6 [RPC] createrawtransaction: add option to set the sequence number per input (Jonas Schnelli)
2016-06-07 18:25:13 +02:00
Wladimir J. van der Laan 9b6a48c2e9
Merge #8118: Reduce unnecessary hashing in signrawtransaction
bd0f413 Reduce unnecessary hashing in signrawtransaction (Jonas Nick)
2016-06-07 14:34:31 +02:00
MarcoFalke fa7f4f577c [rpc] fundrawtransaction feeRate: Use BTC/kB
Also introduce UniValueType

UniValueType is a wrapper for UniValue::VType which allows setting
a typeAny flag. This flag indicates the type does not matter.

(Used by RPCTypeCheckObj)
2016-06-07 13:12:57 +02:00
Luke Dashjr 12c708a4b3 getblocktemplate: Use version/force mutation to support pre-BIP9 clients 2016-06-06 17:10:23 +00:00
Luke Dashjr 98790608a4 getblocktemplate: Explicitly handle the distinction between GBT-affecting softforks vs not 2016-06-06 17:10:23 +00:00
Luke Dashjr d3df40e51a Implement BIP 9 GBT changes
- BIP9DeploymentInfo struct for static deployment info
- VersionBitsDeploymentInfo: Avoid C++11ism by commenting parameter names
- getblocktemplate: Make sure to set deployments in the version if it is LOCKED_IN
- In this commit, all rules are considered required for clients to support
2016-06-06 17:10:22 +00:00
Wladimir J. van der Laan 989df7ecf3
Merge #7896: fix typo in help text
fc95f6e fix typo in help text (Chris Moore)
2016-05-30 12:39:56 +02:00
Jonas Nick bd0f413877 Reduce unnecessary hashing in signrawtransaction 2016-05-30 11:43:53 +02:00
Pieter Wuille c028c7b755
Merge #8049: Expose information on whether transaction relay is enabled in `getnetwork`
1ab1dc3 rpc: Add `relaytxes` flag to `getnetworkinfo` (Wladimir J. van der Laan)
581ddff net: Add fRelayTxes flag (Wladimir J. van der Laan)
2016-05-26 15:02:16 +02:00
Gregory Maxwell c769c4af11 Avoid counting failed connect attempts when probably offline.
If a node is offline failed outbound connection attempts will crank up
 the addrman counter and effectively blow away our state.

This change reduces the problem by only counting attempts made while
 the node believes it has outbound connections to at least two
 netgroups.

Connect and addnode connections are also not counted, as there is no
 reason to unequally penalize them for their more frequent
 connections -- though there should be no real effect from this
 unless their addnode configureation is later removed.

Wasteful repeated connection attempts while only a few connections are
 up are avoided via nLastTry.

This is still somewhat incomplete protection because our outbound
 peers could be down but not timed out or might all be on 'local'
 networks (although the requirement for multiple netgroups helps).
2016-05-26 12:56:27 +00:00
Alex Morcos 4dc94d1036 Refactor CreateNewBlock to be a method of the BlockAssembler class 2016-05-18 14:11:12 -04:00
Wladimir J. van der Laan 83121cca75
Merge #7906: net: prerequisites for p2p encapsulation changes
5d5e7a0 net: No need to export ConnectNode (Cory Fields)
e9ed620 net: No need to export DumpBanlist (Cory Fields)
8b8f877 net: make Ban/Unban/ClearBan functionality consistent (Cory Fields)
cca221f net: Drop CNodeRef for AttemptToEvictConnection (Cory Fields)
563f375 net: use the exposed GetNodeSignals() rather than g_signals directly (Cory Fields)
9faa490 net: remove unused set (Cory Fields)
52cbce2 net: don't import std namespace (Cory Fields)
2016-05-18 12:13:05 +02:00
Suhas Daftuar 8f7b5dc4af Add getmempoolancestors RPC call 2016-05-17 13:12:11 -04:00
Suhas Daftuar 5ec0cde371 Refactor logic for converting mempool entries to JSON 2016-05-17 08:06:37 -04:00
Gregory Maxwell d87b198b73 Remove unneeded feerate param from RelayTransaction/AcceptToMemoryPool. 2016-05-16 04:10:06 +00:00
Wladimir J. van der Laan 1ab1dc3140 rpc: Add `relaytxes` flag to `getnetworkinfo`
Re-work of PR #7841 by dragongem45.
Closes #7771.
2016-05-12 14:26:49 +02:00
Cory Fields 8b8f87714d net: make Ban/Unban/ClearBan functionality consistent
- Ban/Unban/ClearBan call uiInterface.BannedListChanged() as necessary
- Ban/Unban/ClearBan sync to disk if the operation is user-invoked
- Mark node for disconnection automatically when banning
- Lock cs_vNodes while setting disconnected
- Don't spin in a tight loop while setting disconnected
2016-05-10 12:28:22 -04:00
instagibbs 657e07efa3 Rename ReconsiderBlock func to reflect real behavior 2016-05-09 11:26:37 -04:00
instagibbs addb9d2a09 Remove state arg from ReconsiderBlock 2016-05-06 12:53:23 -04:00
Wladimir J. van der Laan 0630353323
Merge #7953: Create signmessagewithprivkey rpc
7db0ecb Test for signing messages (Andrew Chow)
f90efbf Create signmessagewithprivkey rpc (Andrew)
2016-05-05 12:54:14 +02:00
Wladimir J. van der Laan 86b800c6a2
Merge #7964: Minor changes for c++11 consistency
07e4edb auto_ptr → unique_ptr (Wladimir J. van der Laan)
073225c chain: define enum used as bit field as uint32_t (Wladimir J. van der Laan)
2016-05-02 13:08:02 +02:00
Wladimir J. van der Laan 07e4edb056 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.
2016-04-28 13:43:32 +02:00
Jonas Schnelli a946bb6b18
[RPC] createrawtransaction: add option to set the sequence number per input 2016-04-27 15:42:14 +02:00
Andrew f90efbfeef Create signmessagewithprivkey rpc
New rpc 'signmessagewithprivkey' which takes a private key to sign a message without using the wallet.
2016-04-27 06:43:39 -04:00
instagibbs 9c0bcb617b push back getaddednodeinfo dead value 2016-04-22 11:20:06 -07:00
Wladimir J. van der Laan 3689ac4634
Merge #7916: Explicitly pass CChainParams& to DisconnectTip()
176869f Explicitly pass CChainParams to ConnectBlock (face)
d0a6353 Pass CChainParams to DisconnectTip() (face)
764d237 Globals: Explicitly pass const CChainParams& to UpdateTip() (Jorge Timón)
2016-04-21 14:54:31 +02:00
face d0a6353dec Pass CChainParams to DisconnectTip() 2016-04-19 20:33:04 +03:00
Wladimir J. van der Laan 4205ad7ca2
Merge #7827: Speed up getchaintips.
87049e8 Speed up getchaintips. (mrbandrews)
2016-04-19 10:44:47 +02:00
mrbandrews 87049e832d Speed up getchaintips. 2016-04-18 12:10:47 -04:00
Chris Moore fc95f6ecb6 fix typo in help text
'in which the transaction is included in'
2016-04-16 13:35:42 -07:00
Wladimir J. van der Laan 76212bbc6a rpc: make sure `gettxoutsetinfo` hash has txids
The key (transaction id for the following outputs) should be serialized
to the HashWriter.

This is a problem as it means different transactions in the same
position with the same outputs will potentially result in the same hash.

Fixes primary concern of #7758.
2016-04-15 18:03:05 +02:00
Wladimir J. van der Laan 9e47fcec17
Merge #7756: Add cursor to iterate over utxo set, use this in `gettxoutsetinfo`
509cb00 txdb: Add Cursor() method to CCoinsView to iterate over UTXO set (Wladimir J. van der Laan)
2016-04-15 16:43:21 +02:00
Wladimir J. van der Laan 509cb006d5 txdb: Add Cursor() method to CCoinsView to iterate over UTXO set
Add a method Cursor() to CCoinsView that returns a cursor which can be
used to iterate over the whole UTXO set.

- rpc: Change gettxoutsetinfo to use new Cursor method

- txdb: Remove GetStats method - Now that GetStats is implemented in
  terms of Cursor, remove it.
2016-04-15 16:33:05 +02:00
João Barbosa 41e835dd50 Add strict flag to RPCTypeCheckObj
Strict flag forces type check on all object keys.
2016-04-15 14:55:52 +02:00
Wladimir J. van der Laan d97101e5a8
Merge #7842: RPC: do not print minping time in getpeerinfo when no ping received yet
62a6486 RPC: do not print ping info in getpeerinfo when no ping received yet, fix help (Pavel Janík)
2016-04-14 16:09:53 +02:00
Rusty Russell 85c807c9ea getblockchaininfo: make bip9_softforks an object, not an array.
We can't change "softforks", but it seems far more logical to use tags
in an object rather than using an "id" field in an array.

For example, to get the csv status before, you need to iterate the
array to find the entry with 'id' field equal to "csv":

   jq '.bip9_softforks | map(select(.id == "csv"))[] | .status'

Now:
   jq '.bip9_softforks.csv.status'

There is no issue with fork names being incompatible with JSON tags,
since we're selecting them ourselves.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2016-04-13 16:53:52 +09:30
Pavel Janík 62a6486058 RPC: do not print ping info in getpeerinfo when no ping received yet, fix help 2016-04-09 09:51:57 +02:00
Wladimir J. van der Laan 1b2460bd58
Merge #7793: [doxygen] Fix member comments
fada0c4 [doc] Fix doxygen comments for members (MarcoFalke)
2016-04-05 17:49:47 +02:00
mruddy 92107d574d RPC: add versionHex in getblock and getblockheader JSON results; expand data in getblockchaininfo bip9_softforks field. 2016-04-04 22:21:00 +00:00
mruddy 60361ca481 RPC: fix generatetoaddress failing to parse address and add unit test 2016-04-03 14:30:00 +00:00
MarcoFalke fada0c422c [doc] Fix doxygen comments for members 2016-04-03 11:58:01 +02:00
Wladimir J. van der Laan 16555b658f
Merge #7766: rpc: Register calls where they are defined
fb8a8cf rpc: Register calls where they are defined (Wladimir J. van der Laan)
2016-03-31 10:55:15 +02:00
Wladimir J. van der Laan fb8a8cf2e6 rpc: Register calls where they are defined
Split out methods to every module, apart from 'help' and 'stop' which
are implemented in rpcserver.cpp itself.

- This makes it easier to add or remove RPC commands - no longer everything that includes
    rpcserver.h has to be rebuilt when there's a change there.
- Cleans up `rpc/server.h` by getting rid of the huge cluttered list of function definitions.
- Removes most of the bitcoin-specific code from rpcserver.cpp and .h.

Continues #7307 for the non-wallet.
2016-03-31 10:48:32 +02:00
Wladimir J. van der Laan e8a8f3d4b2
Merge #7648: BIP9 versionbits softfork for BIP68, BIP112 and BIP113
71527a0 Test of BIP9 fork activation of mtp, csv, sequence_lock (NicolasDorier)
19d73d5 Add RPC test for BIP 68/112/113 soft fork. (Alex Morcos)
12c89c9 Policy: allow transaction version 2 relay policy. (BtcDrak)
02c2435 Soft fork logic for BIP68 (BtcDrak)
478fba6 Soft fork logic for BIP113 (BtcDrak)
65751a3 Add CHECKSEQUENCEVERIFY softfork through BIP9 (Pieter Wuille)
2016-03-30 18:59:39 +02:00
instagibbs 7eb702954e Add importprunedfunds rpc call 2016-03-23 10:40:38 -04:00
Wladimir J. van der Laan e2ebd259fb
Merge #7671: [RPC] Add generatetoaddress rpc to mine to an address
d5c5c71 RPC tests for generatetoaddress (Andrew C)
fe00ca7 Create generatetoaddress rpc (Andrew C)
2016-03-23 13:24:53 +01:00
Alex Morcos 9e072a6e66 Implement "feefilter" P2P message.
The "feefilter" p2p message is used to inform other nodes of your mempool min fee which is the feerate that any new transaction must meet to be accepted to your mempool.  This will allow them to filter invs to you according to this feerate.
2016-03-21 10:46:25 -04:00
Andrew C fe00ca758a Create generatetoaddress rpc
Creates the generatetoaddress rpc which is virtually identical to the generate rpc except that it takes an argument for the address to mine to. It does not rely on wallet functionality.

The mining code shared by generate and generatetoaddress has been moved to another method to reduce duplication.
2016-03-21 09:58:40 -04:00
Pieter Wuille 65751a3cf2 Add CHECKSEQUENCEVERIFY softfork through BIP9 2016-03-18 08:09:06 +00:00
Pieter Wuille d23f6c6a0d Softfork status report in RPC 2016-03-15 16:54:38 +01:00
Wladimir J. van der Laan c9a1265754
Merge #7670: use cached block hash in blockToJSON()
a6ee0ca use cached block hash in blockToJSON() (Pavel Vasin)
2016-03-14 12:22:40 +01:00
Wladimir J. van der Laan c87f51e55b
Merge #7663: Make the generate RPC call function for non-regtest
8a253b3 Make the generate RPC call function for non-regtest (Pieter Wuille)
2016-03-14 11:36:20 +01:00
Wladimir J. van der Laan 11c769966a
Merge #7507: Remove internal miner
8d1de43 Remove internal miner (Leviathn)
2016-03-14 11:35:41 +01:00
Pavel Vasin a6ee0caa4e use cached block hash in blockToJSON() 2016-03-12 17:11:59 +03:00
Luv Khemani ce7413fcb7 Add autocomplete to bitcoin-qt's console window.
Removed externs
Added listCommands() to CRPCTable

Move autocomplete init to RPCConsole::setClientModel()
2016-03-12 13:04:23 +08:00