Commit graph

164 commits

Author SHA1 Message Date
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