比特币通信协议 - 币圈消息

比特币通信协议篇11、二、TURN简介。在典型的情况下,TURN客户端连接到内网中,并且通过一个或者多个NAT到 详细

比特币区块链源码分析 - 币圈消息

[复制链接]
35 0
wangjia 发表于 2022-11-3 11:59:58 | 只看该作者 |阅读模式 打印 上一主题 下一主题
比特币区块链源码分析篇11、voidTransactionAddedToMempool(constCTransactionRef 。
2、/**RegisterwithmempooltocallTransactionRemovedFromMempoolcallbacks*/。
3、CConnman*constconnman;。
4、CScheduler::FunctionserviceLoop=boost::bind( CScheduler::serviceQueue, scheduler);。
5、GetMainSignals().BlockDisconnected(pblock);。
6、voidResendWalletTransactions(int64_tnBestBlockTime,CConnman*connman)override;。
7、classCValidationInterface{。
8、对提交过去的block的验证结果,作为事件通知返回给rpc调用!
9、structMainSignalsInstance{。
10、CCoinsViewCacheview(pcoinsTip.get());。

比特币区块链源码分析篇21、GetMainSignals().Broadcast(nTimeBestReceived,connman);。
2、m_internals- UpdatedBlockTip(pindexNew,pindexFork,fInitialDownload);。
3、CWallet*walletInstance=newCWallet(std::move(dbw));。
4、boolfound;。returnfalse;。
5、m_internals- m_schedulerClient.AddToProcessQueue([locator,this]{。
6、/**Unregisterwithmempool*/。
7、intmain(){。m_internals- m_schedulerClient.AddToProcessQueue([ptx,this]{。
8、上面这个例子,有五个函数订阅sig事件,sig(,)的调用触发事件,参数5,3,相当于事件携带的消息paylaod,传给了五个事件订阅者!
9、submitblock_StateCatchersc(block.GetHash());。
10、assert(trace.pblock trace.pindex);。
比特币区块链源码分析篇31、g_signals.m_internals- UpdatedBlockTip.disconnect(boost::bind( CValidationInterface::UpdatedBlockTip,pwalletIn,_1,_2,_3));。
2、/**UnregisteraCSchedulertogivecallbackswhichshouldruninthebackground-thesecallbackswillnowbedropped!*/。
3、bool*pfMissingInputs,int64_tnAcceptTime,std::list*plTxnReplaced,。
4、voidRegisterValidationInterface(CValidationInterface*pwalletIn){。
5、m_internals- NewPoWValidBlock(pindex,block);。
6、这四个订阅者通过调用RegisterValidationInterface,UnregisterValidationInterface订阅,取消事件通知,函数接受参数是指向订阅者的指针!
7、CValidationInterface有四个子类,CWallet,CZMQNotificationInterface,submitblock_StateCatcher,PeerLogicValidation分别对应四个对MainSignalsInstance中的事件感兴趣的订阅者!
8、boolstaticFlushStateToDisk(constCChainParams chainparams,CValidationState state,FlushStateModemode,intnManualPruneHeight){。
9、{。g_signals.m_internals- Broadcast.disconnect(boost::bind( CValidationInterface::ResendWalletTransactions,pwalletIn,_1,_2));。
10、boost::signals2::signalTransactionRemovedFromMempool;。
比特币区块链源码分析篇41、nLastSetChain=nNow;。
2、});。boolAppInitMain()。
3、voidSetBestChain(constCBlockLocator loc)override;。
4、boost::signals2::signalsig;。
5、staticboolAcceptToMemoryPoolWorker(constCChainParams chainparams,CTxMemPool pool,CValidationState state,constCTransactionRef ptx,。
6、voidUnregisterValidationInterface(CValidationInterface*pwalletIn){。
7、voidCMainSignals::TransactionAddedToMempool(constCTransactionRef ptx){。
8、g_signals.m_internals- BlockConnected.disconnect(boost::bind( CValidationInterface::BlockConnected,pwalletIn,_1,_2,_3));。
9、CChainState的DisconnectTip方法里,constCChainParams chainparams,DisconnectedBlockTransactions*disconnectpool)。
10、voidCMainSignals::Inventory(constuint256 hash){。
比特币区块链源码分析篇51、virtualvoidResendWalletTransactions(int64_tnBestBlockTime,CConnman*connman){}。
2、g_signals.m_internals- SetBestChain.connect(boost::bind( CValidationInterface::SetBestChain,pwalletIn,_1));。
3、std::cout Thedifferenceis x-y std::endl;。
4、g_signals.m_internals- BlockChecked.disconnect(boost::bind( CValidationInterface::BlockChecked,pwalletIn,_1,_2));。
5、boolrv=ConnectBlock(blockConnecting,state,pindexNew,view,chainparams);。
6、virtualvoidTransactionRemovedFromMempool(constCTransactionRef ptx){}。
7、}。std::unique_ptrm_internals;。
8、return0;。sig.connect(print_product);。
9、m_internals- m_schedulerClient.AddToProcessQueue([pblock,this]{。
10、std::cout Theproductis x*y std::endl;。
比特币区块链源码分析篇61、m_internals- Inventory(hash);。
2、virtualvoidUpdatedBlockTip(constCBlockIndex*pindexNew,constCBlockIndex*pindexFork,boolfInitialDownload){}。
3、std::cout Thesumis x+y std::endl;。
4、 ..。
5、virtualvoidBlockDisconnected(conststd::shared_ptr block){}。
6、boost::signals2::signal ) NewPoWValidBlock;。
7、voidRegisterWithMempoolSignals(CTxMemPool pool);。
8、在submitblockrpc调用中,用户提交hex编码的原始block,解析后,调用ProcessNewBlock()检查处理,使用类型submitblock_StateCatcher的对象sc作为MainSignalsInstance的订阅者,。
9、CChainState的ConnectTip方法里,constCChainParams chainparams,CBlockIndex*pindexNew,conststd::shared_ptr pblock,ConnectTrace connectTrace,DisconnectedBlockTransactions disconnectpool)。
10、CChainState的AcceptBlock方法里,CValidationState state,constCChainParams chainparams,CBlockIndex**ppindex,boolfRequested,constCDiskBlockPos*dbp,bool*fNewBlock)。
极客公园 , 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:比特币区块链源码分析
喜欢 (0)

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
收藏
收藏0
转播
转播
分享
分享
分享
淘帖0
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关注0

粉丝0

帖子2930859

发布主题
阅读排行更多+

Powered by 顺水鱼MT4外汇EA网! X3.2© 2001-2017 顺水MT4外汇EA公司.( 陕ICP备17014341号-1