dash-docs/en/doxygen/html/rbf_8cpp_source.html

124 lines
18 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.14"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Dash Core: src/policy/rbf.cpp Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(initResizable);
/* @license-end */</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><img alt="Logo" src="bitcoin_logo_doxygen.png"/></td>
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">Dash Core
&#160;<span id="projectnumber">0.12.2.1</span>
</div>
<div id="projectbrief">P2P Digital Currency</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.14 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('rbf_8cpp_source.html','');});
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="headertitle">
<div class="title">rbf.cpp</div> </div>
</div><!--header-->
<div class="contents">
<a href="rbf_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span>&#160;<span class="comment">// Copyright (c) 2016 The Bitcoin developers</span></div><div class="line"><a name="l00002"></a><span class="lineno"> 2</span>&#160;<span class="comment">// Distributed under the MIT software license, see the accompanying</span></div><div class="line"><a name="l00003"></a><span class="lineno"> 3</span>&#160;<span class="comment">// file COPYING or http://www.opensource.org/licenses/mit-license.php.</span></div><div class="line"><a name="l00004"></a><span class="lineno"> 4</span>&#160;</div><div class="line"><a name="l00005"></a><span class="lineno"> 5</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="rbf_8h.html">policy/rbf.h</a>&quot;</span></div><div class="line"><a name="l00006"></a><span class="lineno"> 6</span>&#160;</div><div class="line"><a name="l00007"></a><span class="lineno"><a class="line" href="rbf_8h.html#a65695ad9c85ce6b262f53aa40e254fd0"> 7</a></span>&#160;<span class="keywordtype">bool</span> <a class="code" href="rbf_8cpp.html#a65695ad9c85ce6b262f53aa40e254fd0">SignalsOptInRBF</a>(<span class="keyword">const</span> <a class="code" href="classCTransaction.html">CTransaction</a> &amp;tx)</div><div class="line"><a name="l00008"></a><span class="lineno"> 8</span>&#160;{</div><div class="line"><a name="l00009"></a><span class="lineno"> 9</span>&#160; BOOST_FOREACH(<span class="keyword">const</span> <a class="code" href="classCTxIn.html">CTxIn</a> &amp;txin, tx.<a class="code" href="classCTransaction.html#ad64447ea044ec850313696fc99412d95">vin</a>) {</div><div class="line"><a name="l00010"></a><span class="lineno"> 10</span>&#160; <span class="keywordflow">if</span> (txin.<a class="code" href="classCTxIn.html#a635deeaf3ca4e8b3e1a97054607211b9">nSequence</a> &lt; std::numeric_limits&lt;unsigned int&gt;::max()-1) {</div><div class="line"><a name="l00011"></a><span class="lineno"> 11</span>&#160; <span class="keywordflow">return</span> <span class="keyword">true</span>;</div><div class="line"><a name="l00012"></a><span class="lineno"> 12</span>&#160; }</div><div class="line"><a name="l00013"></a><span class="lineno"> 13</span>&#160; }</div><div class="line"><a name="l00014"></a><span class="lineno"> 14</span>&#160; <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00015"></a><span class="lineno"> 15</span>&#160;}</div><div class="line"><a name="l00016"></a><span class="lineno"> 16</span>&#160;</div><div class="line"><a name="l00017"></a><span class="lineno"><a class="line" href="rbf_8h.html#ad58f52df4182b1368d277a98838d74e3"> 17</a></span>&#160;<span class="keywordtype">bool</span> <a class="code" href="rbf_8cpp.html#ad58f52df4182b1368d277a98838d74e3">IsRBFOptIn</a>(<span class="keyword">const</span> <a class="code" href="classCTxMemPoolEntry.html">CTxMemPoolEntry</a> &amp;entry, <a class="code" href="classCTxMemPool.html">CTxMemPool</a> &amp;pool)</div><div class="line"><a name="l00018"></a><span class="lineno"> 18</span>&#160;{</div><div class="line"><a name="l00019"></a><span class="lineno"> 19</span>&#160; <a class="code" href="sync_8h.html#acd61d0cb3b49f367728193720014aed0">AssertLockHeld</a>(pool.<a class="code" href="classCTxMemPool.html#ac7ee8c06837c7d2688e2d7e3d071bdbb">cs</a>);</div><div class="line"><a name="l00020"></a><span class="lineno"> 20</span>&#160;</div><div class="line"><a name="l00021"></a><span class="lineno"> 21</span>&#160; <a class="code" href="classCTxMemPool.html#a8da3f55d23d335261338753b22e0171d">CTxMemPool::setEntries</a> setAncestors;</div><div class="line"><a name="l00022"></a><span class="lineno"> 22</span>&#160;</div><div class="line"><a name="l00023"></a><span class="lineno"> 23</span>&#160; <span class="comment">// First check the transaction itself.</span></div><div class="line"><a name="l00024"></a><span class="lineno"> 24</span>&#160; <span class="keywordflow">if</span> (<a class="code" href="rbf_8cpp.html#a65695ad9c85ce6b262f53aa40e254fd0">SignalsOptInRBF</a>(entry.<a class="code" href="classCTxMemPoolEntry.html#a2deed4202061edf8b040a3f554417c20">GetTx</a>())) {</div><div class="line"><a name="l00025"></a><span class="lineno"> 25</span>&#160; <span class="keywordflow">return</span> <span class="keyword">true</span>;</div><div class="line"><a name="l00026"></a><span class="lineno"> 26</span>&#160; }</div><div class="line"><a name="l00027"></a><span class="lineno"> 27</span>&#160;</div><div class="line"><a name="l00028"></a><span class="lineno"> 28</span>&#160; <span class="comment">// If this transaction is not in our mempool, then we can&#39;t be sure</span></div><div class="line"><a name="l00029"></a><span class="lineno"> 29</span>&#160; <span class="comment">// we will know about all its inputs.</span></div><div class="line"><a name="l00030"></a><span class="lineno"> 30</span>&#160; <span class="keywordflow">if</span> (!pool.<a class="code" href="classCTxMemPool.html#a8b7a13b5289ab839d4460f41a7da9789">exists</a>(entry.<a class="code" href="classCTxMemPoolEntry.html#a2deed4202061edf8b040a3f554417c20">GetTx</a>().<a class="code" href="classCTransaction.html#a7efd1379de830341417c0bfa23a149aa">GetHash</a>())) {</div><div class="line"><a name="l00031"></a><span class="lineno"> 31</span>&#160; <span class="keywordflow">throw</span> std::runtime_error(<span class="stringliteral">&quot;Cannot determine RBF opt-in signal for non-mempool transaction\n&quot;</span>);</div><div class="line"><a name="l00032"></a><span class="lineno"> 32</span>&#160; }</div><div class="line"><a name="l00033"></a><span class="lineno"> 33</span>&#160;</div><div class="line"><a name="l00034"></a><span class="lineno"> 34</span>&#160; <span class="comment">// If all the inputs have nSequence &gt;= maxint-1, it still might be</span></div><div class="line"><a name="l00035"></a><span class="lineno"> 35</span>&#160; <span class="comment">// signaled for RBF if any unconfirmed parents have signaled.</span></div><div class="line"><a name="l00036"></a><span class="lineno"> 36</span>&#160; uint64_t noLimit = std::numeric_limits&lt;uint64_t&gt;::max();</div><div class="line"><a name="l00037"></a><span class="lineno"> 37</span>&#160; std::string dummy;</div><div class="line"><a name="l00038"></a><span class="lineno"> 38</span>&#160; pool.<a class="code" href="classCTxMemPool.html#ae755bb5ccada190327c26d09388b4139">CalculateMemPoolAncestors</a>(entry, setAncestors, noLimit, noLimit, noLimit, noLimit, dummy, <span class="keyword">false</span>);</div><div class="line"><a name="l00039"></a><span class="lineno"> 39</span>&#160;</div><div class="line"><a name="l00040"></a><span class="lineno"> 40</span>&#160; BOOST_FOREACH(<a class="code" href="classCTxMemPool.html#aa3b42beec827c813a0c4b42e50615f5a">CTxMemPool::txiter</a> it, setAncestors) {</div><div class="line"><a name="l00041"></a><span class="lineno"> 41</span>&#160; <span class="keywordflow">if</span> (<a class="code" href="rbf_8cpp.html#a65695ad9c85ce6b262f53aa40e254fd0">SignalsOptInRBF</a>(it-&gt;GetTx())) {</div><div class="line"><a name="l00042"></a><span class="lineno"> 42</span>&#160; <span class="keywordflow">return</span> <span class="keyword">true</span>;</div><div class="line"><a name="l00043"></a><span class="lineno"> 43</span>&#160; }</div><div class="line"><a name="l00044"></a><span class="lineno"> 44</span>&#160; }</div><div class="line"><a name="l00045"></a><span class="lineno"> 45</span>&#160; <span class="keywordflow">return</span> <span class="keyword">false</span>;</div><div class="line"><a name="l00046"></a><span class="lineno"> 46</span>&#160;}</div><div class="ttc" id="classCTxIn_html"><div class="ttname"><a href="classCTxIn.html">CTxIn</a></div><div class="ttdef"><b>Definition:</b> <a href="transaction_8h_source.html#l00058">transaction.h:58</a></div></div>
<div class="ttc" id="classCTxIn_html_a635deeaf3ca4e8b3e1a97054607211b9"><div class="ttname"><a href="classCTxIn.html#a635deeaf3ca4e8b3e1a97054607211b9">CTxIn::nSequence</a></div><div class="ttdeci">uint32_t nSequence</div><div class="ttdef"><b>Definition:</b> <a href="transaction_8h_source.html#l00063">transaction.h:63</a></div></div>
<div class="ttc" id="classCTxMemPoolEntry_html"><div class="ttname"><a href="classCTxMemPoolEntry.html">CTxMemPoolEntry</a></div><div class="ttdef"><b>Definition:</b> <a href="txmempool_8h_source.html#l00076">txmempool.h:76</a></div></div>
<div class="ttc" id="classCTxMemPool_html_ae755bb5ccada190327c26d09388b4139"><div class="ttname"><a href="classCTxMemPool.html#ae755bb5ccada190327c26d09388b4139">CTxMemPool::CalculateMemPoolAncestors</a></div><div class="ttdeci">bool CalculateMemPoolAncestors(const CTxMemPoolEntry &amp;entry, setEntries &amp;setAncestors, uint64_t limitAncestorCount, uint64_t limitAncestorSize, uint64_t limitDescendantCount, uint64_t limitDescendantSize, std::string &amp;errString, bool fSearchForParents=true)</div><div class="ttdef"><b>Definition:</b> <a href="txmempool_8cpp_source.html#l00183">txmempool.cpp:183</a></div></div>
<div class="ttc" id="classCTxMemPool_html_a8b7a13b5289ab839d4460f41a7da9789"><div class="ttname"><a href="classCTxMemPool.html#a8b7a13b5289ab839d4460f41a7da9789">CTxMemPool::exists</a></div><div class="ttdeci">bool exists(uint256 hash) const</div><div class="ttdef"><b>Definition:</b> <a href="txmempool_8h_source.html#l00563">txmempool.h:563</a></div></div>
<div class="ttc" id="sync_8h_html_acd61d0cb3b49f367728193720014aed0"><div class="ttname"><a href="sync_8h.html#acd61d0cb3b49f367728193720014aed0">AssertLockHeld</a></div><div class="ttdeci">#define AssertLockHeld(cs)</div><div class="ttdef"><b>Definition:</b> <a href="sync_8h_source.html#l00096">sync.h:96</a></div></div>
<div class="ttc" id="classCTxMemPool_html_ac7ee8c06837c7d2688e2d7e3d071bdbb"><div class="ttname"><a href="classCTxMemPool.html#ac7ee8c06837c7d2688e2d7e3d071bdbb">CTxMemPool::cs</a></div><div class="ttdeci">CCriticalSection cs</div><div class="ttdef"><b>Definition:</b> <a href="txmempool_8h_source.html#l00402">txmempool.h:402</a></div></div>
<div class="ttc" id="classCTxMemPool_html_aa3b42beec827c813a0c4b42e50615f5a"><div class="ttname"><a href="classCTxMemPool.html#aa3b42beec827c813a0c4b42e50615f5a">CTxMemPool::txiter</a></div><div class="ttdeci">indexed_transaction_set::nth_index&lt; 0 &gt;::type::iterator txiter</div><div class="ttdef"><b>Definition:</b> <a href="txmempool_8h_source.html#l00404">txmempool.h:404</a></div></div>
<div class="ttc" id="classCTransaction_html"><div class="ttname"><a href="classCTransaction.html">CTransaction</a></div><div class="ttdef"><b>Definition:</b> <a href="transaction_8h_source.html#l00210">transaction.h:210</a></div></div>
<div class="ttc" id="rbf_8h_html"><div class="ttname"><a href="rbf_8h.html">rbf.h</a></div></div>
<div class="ttc" id="classCTxMemPoolEntry_html_a2deed4202061edf8b040a3f554417c20"><div class="ttname"><a href="classCTxMemPoolEntry.html#a2deed4202061edf8b040a3f554417c20">CTxMemPoolEntry::GetTx</a></div><div class="ttdeci">const CTransaction &amp; GetTx() const</div><div class="ttdef"><b>Definition:</b> <a href="txmempool_8h_source.html#l00110">txmempool.h:110</a></div></div>
<div class="ttc" id="rbf_8cpp_html_ad58f52df4182b1368d277a98838d74e3"><div class="ttname"><a href="rbf_8cpp.html#ad58f52df4182b1368d277a98838d74e3">IsRBFOptIn</a></div><div class="ttdeci">bool IsRBFOptIn(const CTxMemPoolEntry &amp;entry, CTxMemPool &amp;pool)</div><div class="ttdef"><b>Definition:</b> <a href="rbf_8cpp_source.html#l00017">rbf.cpp:17</a></div></div>
<div class="ttc" id="classCTxMemPool_html_a8da3f55d23d335261338753b22e0171d"><div class="ttname"><a href="classCTxMemPool.html#a8da3f55d23d335261338753b22e0171d">CTxMemPool::setEntries</a></div><div class="ttdeci">std::set&lt; txiter, CompareIteratorByHash &gt; setEntries</div><div class="ttdef"><b>Definition:</b> <a href="txmempool_8h_source.html#l00410">txmempool.h:410</a></div></div>
<div class="ttc" id="classCTransaction_html_ad64447ea044ec850313696fc99412d95"><div class="ttname"><a href="classCTransaction.html#ad64447ea044ec850313696fc99412d95">CTransaction::vin</a></div><div class="ttdeci">const std::vector&lt; CTxIn &gt; vin</div><div class="ttdef"><b>Definition:</b> <a href="transaction_8h_source.html#l00233">transaction.h:233</a></div></div>
<div class="ttc" id="classCTxMemPool_html"><div class="ttname"><a href="classCTxMemPool.html">CTxMemPool</a></div><div class="ttdef"><b>Definition:</b> <a href="txmempool_8h_source.html#l00357">txmempool.h:357</a></div></div>
<div class="ttc" id="rbf_8cpp_html_a65695ad9c85ce6b262f53aa40e254fd0"><div class="ttname"><a href="rbf_8cpp.html#a65695ad9c85ce6b262f53aa40e254fd0">SignalsOptInRBF</a></div><div class="ttdeci">bool SignalsOptInRBF(const CTransaction &amp;tx)</div><div class="ttdef"><b>Definition:</b> <a href="rbf_8cpp_source.html#l00007">rbf.cpp:7</a></div></div>
<div class="ttc" id="classCTransaction_html_a7efd1379de830341417c0bfa23a149aa"><div class="ttname"><a href="classCTransaction.html#a7efd1379de830341417c0bfa23a149aa">CTransaction::GetHash</a></div><div class="ttdeci">const uint256 &amp; GetHash() const</div><div class="ttdef"><b>Definition:</b> <a href="transaction_8h_source.html#l00262">transaction.h:262</a></div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_f9a362818448b8ef6661813ae65d7e79.html">policy</a></li><li class="navelem"><a class="el" href="rbf_8cpp.html">rbf.cpp</a></li>
<li class="footer">Generated on Thu Dec 14 2017 13:15:04 for Dash Core by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.14 </li>
</ul>
</div>
</body>
</html>