aboutsummaryrefslogtreecommitdiff
path: root/src/rpc/blockchain.h
AgeCommit message (Collapse)Author
2022-09-09scripted-diff: rename CChainState -> ChainstateJames O'Beirne
-BEGIN VERIFY SCRIPT- sed -i 's/CChainState/Chainstate/g' $(git grep -l CChainState ':(exclude)doc/release-notes*') -END VERIFY SCRIPT- Co-authored-by: MacroFake <falke.marco@gmail.com>
2022-06-29Use AutoFile where possibleMacroFake
2022-04-19move-mostly: Make fHavePruned a BlockMan memberCarl Dong
[META] In the next commit, we move the clearing of fHavePruned to BlockManager::Unload()
2022-03-11rpc: Move mempool RPCs to new fileMarcoFalke
Can be reviewed with: --color-moved=dimmed-zebra --color-moved-ws=ignore-all-space
2022-01-06Add src/node/* code to node:: namespaceRussell Yanofsky
2022-01-02rpc: Add EnsureArgsman helperMarcoFalke
2021-12-30scripted-diff: Bump copyright headersHennadii Stepanov
-BEGIN VERIFY SCRIPT- ./contrib/devtools/copyright_header.py update ./ -END VERIFY SCRIPT- Commits of previous years: * 2020: fa0074e2d82928016a43ca408717154a1c70a4db * 2019: aaaaad6ac95b402fe18d019d67897ced6b316ee0
2021-12-08Merge bitcoin/bitcoin#20295: rpc: getblockfrompeerMarcoFalke
dce8c4c38111556ca480aa0e63c46b71f66b508f rpc: getblockfrompeer (Sjors Provoost) b884ababc29ce963826d8a4327ed6a5e629ff175 rpc: move Ensure* helpers to server_util.h (Sjors Provoost) Pull request description: This adds an RPC method to fetch a block directly from a peer. This can used to fetch stale blocks with lower proof of work that are normally ignored by the node (`headers-only` in `getchaintips`). Usage: ``` bitcoin-cli getblockfrompeer HASH peer_n ``` Closes #20155 Limitations: * you have to specify which peer to fetch the block from * the node must already have the header ACKs for top commit: jnewbery: ACK dce8c4c38111556ca480aa0e63c46b71f66b508f fjahr: re-ACK dce8c4c38111556ca480aa0e63c46b71f66b508f Tree-SHA512: 843ba2b7a308f640770d624d0aa3265fdc5c6ea48e8db32269b96a082b7420f7953d1d8d1ef2e6529392c7172dded9d15639fbc9c24e7bfa5cfb79e13a5498c8
2021-12-02Merge bitcoin/bitcoin#23155: rpc: various fixups for dumptxoutsetW. J. van der Laan
ffd09281fe26446fcefa0627c220a52706e35227 rpc: various fixups for dumptxoutset (James O'Beirne) Pull request description: This is part of the [assumeutxo project](https://github.com/bitcoin/bitcoin/projects/11) (parent PR: #15606) --- A few fixes to make this RPC actually useful when generating snapshots. - Generate an assumeutxo hash and display it (sort of a bugfix) - Add nchaintx to output (necessary for use in chainparams entry) - Add path of serialized UTXO file to output ACKs for top commit: laanwj: Code review ACK ffd09281fe26446fcefa0627c220a52706e35227 Tree-SHA512: b0b5fd5138dea0e21258b1b18ab75bf3fd1628522cc1dbafa81af9cb9fa96562a1c39124fdb31057f256bfc560f462f907e9fe5e209b577b3f57afae2b7be826
2021-12-02rpc: move Ensure* helpers to server_util.hSjors Provoost
2021-11-30rpc: various fixups for dumptxoutsetJames O'Beirne
- Actually generate an assumeutxo hash and display it - Add nchaintx to output (necessary for use in chainparams entry) - Add path of serialized UTXO file to output
2021-11-16doc: Fix typos in endif header commentsMarcoFalke
2021-10-05rpc: Add level 3 verbosity to getblock RPC call.fyquah
Display the prevout in transaction inputs when calling getblock level 3 verbosity. Co-authored-by: Luke Dashjr <luke_github1@dashjr.org> Co-authored-by: 0xB10C <19157360+0xB10C@users.noreply.github.com>
2021-10-05rpc: Replace boolean argument for tx details with enum class.fyquah
Co-authored-by: Luke Dashjr <luke_github1@dashjr.org> Co-authored-by: 0xB10C <19157360+0xB10C@users.noreply.github.com>
2021-09-30[MOVEONLY] consensus: move amount.h into consensusfanquake
Move amount.h to consensus/amount.h. Renames, adds missing and removes uneeded includes.
2021-09-24rpc: remove deprecated addresses and reqSigs from rpc outputsMichael Dietz
2021-04-14rest/rpc: Remove now-unused old Ensure functionsCarl Dong
The scripted-diff in the previous commit should have removed all calls to functions like: Ensure(?!Any)\(const std::any& (context|ctx)\), so we can remove them now.
2021-04-14rpc: Add renamed EnsureAny*() functionsCarl Dong
- The original Ensure*(const std::any& context) functions are kept and the parameter renamed to ctx so that the scripted-diff in the subsequent commit will work as expected - The renaming avoids overloading mistakes arising out of the untyped std::any argument.
2021-04-12rpc: Add alt Ensure* functions acepting NodeContextCarl Dong
2021-03-29refactor: replace util::Ref by std::any (C++17)Sebastian Falbesoner
2021-03-23rpc: deprecate `addresses` and `reqSigs` from rpc outputsMichael Dietz
1) add a new sane "address" field (for outputs that have an identifiable address, which doesn't include bare multisig) 2) with -deprecatedrpc: leave "reqSigs" and "addresses" intact (with all weird/wrong behavior they have now) 3) without -deprecatedrpc: drop "reqSigs" and "addresses" entirely, always.
2021-02-12move-onlyish: break out CreateUTXOSnapshot from dumptxoutsetJames O'Beirne
This move/refactor is needed to set up a decent unittest for UTXO snapshot activation.
2020-12-31scripted-diff: Bump copyright headersMarcoFalke
-BEGIN VERIFY SCRIPT- ./contrib/devtools/copyright_header.py update ./ -END VERIFY SCRIPT-
2020-12-03Remove the remaining fee estimation globalsAntoine Poinsot
This moves the CBlockPolicyEstimator to the NodeContext, which get rids of two globals and allows us to conditionally create the CBlockPolicyEstimator (and to remove a circular dep). Signed-off-by: Antoine Poinsot <darosior@protonmail.com>
2020-09-22Add 'sequence' zmq publisher to track all block (dis)connects, mempool deltasGregory Sanders
Using the zmq notifications to avoid excessive mempool polling can be difficult given the current notifications available. It announces all transactions being added to mempool or included in blocks, but announces no evictions and gives no indication if the transaction is in the mempool or a block. Block notifications for zmq are also substandard, in that it only announces block tips, while all block transactions are still announced. This commit adds a unified stream which can be used to closely track mempool: 1) getrawmempool to fill out mempool knowledge 2) if txhash is announced, add or remove from set based on add/remove flag 3) if blockhash is announced, get block txn list, remove from those transactions local view of mempool 4) if we drop a sequence number, go to (1) The mempool sequence number starts at the value 1, and increments each time a transaction enters the mempool, or is evicted from the mempool for any reason, including block inclusion. The mempool sequence number is published via ZMQ for any transaction-related notification. These features allow for ZMQ/RPC consumer to track mempool state in a more exacting way, without unnecesarily polling getrawmempool. See interface_zmq.py::test_mempool_sync for example usage.
2020-05-21validation: Make ProcessNewBlock*() members of ChainstateManagerMarcoFalke
2020-05-21Merge #18740: Remove g_rpc_node globalMarcoFalke
b3f7f375efb9a9ca9a7a4f2caf41fe3df2262520 refactor: Remove g_rpc_node global (Russell Yanofsky) ccb5059ee89f6e8dc31ba5b82830b384890bb65e scripted-diff: Remove g_rpc_node references (Russell Yanofsky) 6fca33b2edc09ed62dab2323c780b31585de1750 refactor: Pass NodeContext to RPC and REST methods through util::Ref (Russell Yanofsky) 691c817b340d10e806dc3b1834d2a8fcc5e681fd Add util::Ref class as temporary alternative for c++17 std::any (Russell Yanofsky) Pull request description: This PR removes the `g_rpc_node` global, to get same benefits we see removing other globals and make RPC code more testable, modular, and reusable. This uses a hybrid of the approaches suggested in #17548. Instead of using `std::any`, which isn't available in c++11, or `void*`, which isn't type safe, it uses a small new `util::Ref` helper class, which acts like a simplified `std::any` that only holds references, not values. Motivation for writing this was to provide an simpler alternative to #18647 by Harris Brakmić (brakmic) which avoids some shortcomings of that PR (https://github.com/bitcoin/bitcoin/pull/18647#issuecomment-617878826) ACKs for top commit: MarcoFalke: re-ACK b3f7f375ef, only change is adding back const and more tests 🚾 ajtowns: ACK b3f7f375efb9a9ca9a7a4f2caf41fe3df2262520 Tree-SHA512: 56292268a001bdbe34d641db1180c215351503966ff451e55cc96c9137f1d262225d7d7733de9c9da7ce7d7a4b34213a98c2476266b58c89dbbb0f3cb5aa5d70
2020-05-19refactor: Remove unused bool parameter in RPCNotifyBlockChange()Hennadii Stepanov
2020-05-13refactor: Remove g_rpc_node globalRussell Yanofsky
This commit does not change behavior
2020-05-13refactor: Pass NodeContext to RPC and REST methods through util::RefRussell Yanofsky
This commit does not change behavior
2019-12-30scripted-diff: Bump copyright of files changed in 2019MarcoFalke
-BEGIN VERIFY SCRIPT- ./contrib/devtools/copyright_header.py update ./ -END VERIFY SCRIPT-
2019-11-15node: Add reference to mempool in NodeContextMarcoFalke
Currently it is an alias to the global ::mempool and should be used as follows. * Node code (validation and transaction relay) can use either ::mempool or node.mempool, whichever seems a better fit. * RPC code should use the added convenience getter EnsureMempool, which makes sure the mempool exists before use. This prepares the RPC code to a future where the mempool might be disabled at runtime or compile time. * Test code should use m_node.mempool directly, as the mempool is always initialized for tests.
2019-10-28Avoid using g_rpc_node global in wallet codeRussell Yanofsky
Wallet code should use interfaces::Chain and not directly access to node state. Add a g_rpc_chain replacement global for wallet code to use, and move g_rpc_node definition to a libbitcoin_server source file so there are link errors if wallet code tries to access it.
2019-05-02rpc: Add lock annotations to block{,header}ToJSONMarcoFalke
2019-02-25rpc: Pass mempool into MempoolToJSONMarcoFalke
2018-09-09rpc: Remove cs_main lock from blockToJSON and blockHeaderToJSONJoão Barbosa
2018-09-03doc: correct GetDifficulty doc after #13288fanquake
2018-08-11Replace median fee rate with feerate percentilesMarcin Jachymiak
Removes medianfeerate result from getblockstats. Adds feerate_percentiles which give the feerate of the 10th, 25th, 50th, 75th, and 90th percentile weight unit in the block.
2018-07-27Update copyright headers to 2018DrahtBot
2018-05-20Drop the chain argument to GetDifficultyBen Woosley
This removes the need to include rpc/blockchain.cpp in order to put GetDifficulty under test. GetDifficulty was called in two ways: * with a guaranteed non-null blockindex * with no argument Change the latter case to be provided chainActive.Tip() explicitly.
2017-06-12Remove unnecessary forward class declarations in header filespracticalswift
2017-03-29refactor: Make rest.cpp dependency on `*toJSON` in `blockchain.cpp` explicitWladimir J. van der Laan
2017-03-27refactor: Move RPCNotifyBlockChange out of `rpc/server.h`Wladimir J. van der Laan
2017-03-27refactor: Move GetDifficulty out of `rpc/server.h`Wladimir J. van der Laan
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`)