• About
  • FAQ
  • Earn Bitcoin while Surfing the net
  • Buy & Sell Crypto on Paxful
Newsletter
Approx Foundation
  • Home
    • Home – Layout 1
  • Bitcoin
  • Ethereum
  • Regulation
  • Market
  • Blockchain
  • Business
  • Guide
  • Contact Us
No Result
View All Result
  • Home
    • Home – Layout 1
  • Bitcoin
  • Ethereum
  • Regulation
  • Market
  • Blockchain
  • Business
  • Guide
  • Contact Us
No Result
View All Result
Approx Foundation
No Result
View All Result
Home Bitcoin

c++ – What is the difference between chain and chainman in the NodeContext in the Bitcoin Core?

Moussa by Moussa
February 13, 2026
in Bitcoin
0
How do Bitcoin mining pools typically handle payout frequency versus thresholds?
189
SHARES
1.5k
VIEWS
Share on FacebookShare on Twitter


In the NodeContext structure there are two members named chainman and chain. chainman
is instance of ChainstateManager and chain is instance of interfaces::Chain. What is the differences between these two? What is the differences and why do we need both?

//! NodeContext struct containing references to chain state and connection
//! state.
//!
//! This is used by init, rpc, and test code to pass object references around
//! without needing to declare the same variables and parameters repeatedly, or
//! to use globals. More variables could be added to this struct (particularly
//! references to validation objects) to eliminate use of globals
//! and make code more modular and testable. The struct isn't intended to have
//! any member functions. It should just be a collection of references that can
//! be used without pulling in unwanted dependencies or functionality.
struct NodeContext {
    //! libbitcoin_kernel context
    std::unique_ptr<:context> kernel;
    //! Init interface for initializing current process and connecting to other processes.
    interfaces::Init* init{nullptr};
    std::unique_ptr addrman;
    std::unique_ptr connman;
    std::unique_ptr mempool;
    std::unique_ptr netgroupman;
    std::unique_ptr fee_estimator;
    std::unique_ptr peerman;
    std::unique_ptr chainman;
    std::unique_ptr banman;
    ArgsManager* args{nullptr}; // Currently a raw pointer because the memory is not managed by this struct
    std::unique_ptr<:chain> chain;
    //! List of all chain clients (wallet processes or other client) connected to node.
    std::vector<:unique_ptr>> chain_clients;
    //! Reference to chain client that should used to load or create wallets
    //! opened by the gui.
    interfaces::WalletLoader* wallet_loader{nullptr};
    std::unique_ptr scheduler;
    std::function rpc_interruption_point = [] {};

    //! Declare default constructor and destructor that are not inline, so code
    //! instantiating the NodeContext struct doesn't need to #include class
    //! definitions for all the unique_ptr members.
    NodeContext();
    ~NodeContext();
};

My assumptions are:

  • ChainstateManager manages Chainstates which are m_ibd_chainstate and m_snapshot_chainstate.
  • Chainstate has all data of a chain.

While interfaces::Chain is used for external components such as wallet, the only possible reason that comes to my mind is that the chain member is for external users of bitcoind. And by this fact, the implementation of interface::chain must be only a simple wrapper over the ChainstateManager, because I think all logic is implemented there.



Source link

Related articles

Strategy ($MSTR) To Lead Bitcoin Quantum Defense, Says Saylor

Strategy Accounted For 97.5% Of January’s Corporate Bitcoin Buying

February 13, 2026
Stablecoins Expected to Lead Crypto Casino and Prediction Market Payments This Year

Stablecoins Expected to Lead Crypto Casino and Prediction Market Payments This Year

February 13, 2026
Share76Tweet47

Related Posts

Strategy ($MSTR) To Lead Bitcoin Quantum Defense, Says Saylor

Strategy Accounted For 97.5% Of January’s Corporate Bitcoin Buying

by Moussa
February 13, 2026
0

The bitcoin corporate adoption world is increasingly dominated by a single player — Strategy — even as adoption among smaller...

Stablecoins Expected to Lead Crypto Casino and Prediction Market Payments This Year

Stablecoins Expected to Lead Crypto Casino and Prediction Market Payments This Year

by Moussa
February 13, 2026
0

Stablecoins tightened their grip on crypto casinos and prediction markets in 2025, with dollar-pegged tokens like USDT and USDC emerging...

U.S. Senators File Amendments on Crypto Bill

Polymarket Puts January US Government Shutdown Odds At 79%

by Moussa
February 13, 2026
0

Join Our Telegram channel to stay up to date on breaking news coverage Polymarket investors are now placing a 79%...

White House Stablecoin Talks Stall, But BlackRock Deepens On-Chain Push With Uniswap

White House Stablecoin Talks Stall, But BlackRock Deepens On-Chain Push With Uniswap

by Moussa
February 13, 2026
0

In a setback to the CLARITY ACT, White House-mediated negotiations between major US banks and crypto firms have stalled yet...

Bitcoin Weakness Persists: Stablecoin Supply Signals Risk-Off Environment

Bitcoin Weakness Persists: Stablecoin Supply Signals Risk-Off Environment

by Moussa
February 13, 2026
0

Trusted Editorial content, reviewed by leading industry experts and seasoned editors. Ad Disclosure Bitcoin remains under selling pressure below the...

Load More

youssufi.com

sephina.com

[vc_row full_width="stretch_row" parallax="content-moving" vc_row_background="" background_repeat="no-repeat" background_position="center center" footer_scheme="dark" css=".vc_custom_1517813231908{padding-top: 60px !important;padding-bottom: 30px !important;background-color: #191818 !important;background-position: center;background-repeat: no-repeat !important;background-size: cover !important;}" footer_widget_title_color="#fcbf46" footer_button_bg="#fcb11e"][vc_column width="1/4"]

We bring you the latest in Crypto News

[/vc_column][vc_column width="1/4"][vc_wp_categories]
[/vc_column][vc_column width="1/4"][vc_wp_tagcloud taxonomy="post_tag"][/vc_column][vc_column width="1/4"]

Newsletter

[vc_raw_html]JTNDcCUzRSUzQ2RpdiUyMGNsYXNzJTNEJTIydG5wJTIwdG5wLXN1YnNjcmlwdGlvbiUyMiUzRSUwQSUzQ2Zvcm0lMjBtZXRob2QlM0QlMjJwb3N0JTIyJTIwYWN0aW9uJTNEJTIyaHR0cHMlM0ElMkYlMkZhcHByb3gub3JnJTJGJTNGbmElM0RzJTIyJTNFJTBBJTBBJTNDaW5wdXQlMjB0eXBlJTNEJTIyaGlkZGVuJTIyJTIwbmFtZSUzRCUyMm5sYW5nJTIyJTIwdmFsdWUlM0QlMjIlMjIlM0UlM0NkaXYlMjBjbGFzcyUzRCUyMnRucC1maWVsZCUyMHRucC1maWVsZC1maXJzdG5hbWUlMjIlM0UlM0NsYWJlbCUyMGZvciUzRCUyMnRucC0xJTIyJTNFRmlyc3QlMjBuYW1lJTIwb3IlMjBmdWxsJTIwbmFtZSUzQyUyRmxhYmVsJTNFJTBBJTNDaW5wdXQlMjBjbGFzcyUzRCUyMnRucC1uYW1lJTIyJTIwdHlwZSUzRCUyMnRleHQlMjIlMjBuYW1lJTNEJTIybm4lMjIlMjBpZCUzRCUyMnRucC0xJTIyJTIwdmFsdWUlM0QlMjIlMjIlM0UlM0MlMkZkaXYlM0UlMEElM0NkaXYlMjBjbGFzcyUzRCUyMnRucC1maWVsZCUyMHRucC1maWVsZC1lbWFpbCUyMiUzRSUzQ2xhYmVsJTIwZm9yJTNEJTIydG5wLTIlMjIlM0VFbWFpbCUzQyUyRmxhYmVsJTNFJTBBJTNDaW5wdXQlMjBjbGFzcyUzRCUyMnRucC1lbWFpbCUyMiUyMHR5cGUlM0QlMjJlbWFpbCUyMiUyMG5hbWUlM0QlMjJuZSUyMiUyMGlkJTNEJTIydG5wLTIlMjIlMjB2YWx1ZSUzRCUyMiUyMiUyMHJlcXVpcmVkJTNFJTNDJTJGZGl2JTNFJTBBJTNDZGl2JTIwY2xhc3MlM0QlMjJ0bnAtZmllbGQlMjB0bnAtcHJpdmFjeS1maWVsZCUyMiUzRSUzQ2xhYmVsJTNFJTNDaW5wdXQlMjB0eXBlJTNEJTIyY2hlY2tib3glMjIlMjBuYW1lJTNEJTIybnklMjIlMjByZXF1aXJlZCUyMGNsYXNzJTNEJTIydG5wLXByaXZhY3klMjIlM0UlQzIlQTBCeSUyMGNvbnRpbnVpbmclMkMlMjB5b3UlMjBhY2NlcHQlMjB0aGUlMjBwcml2YWN5JTIwcG9saWN5JTNDJTJGbGFiZWwlM0UlM0MlMkZkaXYlM0UlM0NkaXYlMjBjbGFzcyUzRCUyMnRucC1maWVsZCUyMHRucC1maWVsZC1idXR0b24lMjIlM0UlM0NpbnB1dCUyMGNsYXNzJTNEJTIydG5wLXN1Ym1pdCUyMiUyMHR5cGUlM0QlMjJzdWJtaXQlMjIlMjB2YWx1ZSUzRCUyMlN1YnNjcmliZSUyMiUyMCUzRSUwQSUzQyUyRmRpdiUzRSUwQSUzQyUyRmZvcm0lM0UlMEElM0MlMkZkaXYlM0UlM0NiciUyRiUzRSUzQyUyRnAlM0U=[/vc_raw_html][/vc_column][/vc_row]
No Result
View All Result
  • Contact Us
  • Homepages
  • Business
  • Guide

© 2024 APPROX FOUNDATION - The Crypto Currency News