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

239 lines
12 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/policy.cpp File Reference</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('policy_8cpp.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="summary">
<a href="#func-members">Functions</a> </div>
<div class="headertitle">
<div class="title">policy.cpp File Reference</div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><code>#include &quot;<a class="el" href="policy_8h_source.html">policy/policy.h</a>&quot;</code><br />
<code>#include &quot;validation.h&quot;</code><br />
<code>#include &quot;<a class="el" href="tinyformat_8h_source.html">tinyformat.h</a>&quot;</code><br />
<code>#include &quot;util.h&quot;</code><br />
<code>#include &quot;<a class="el" href="utilstrencodings_8h_source.html">utilstrencodings.h</a>&quot;</code><br />
<code>#include &lt;boost/foreach.hpp&gt;</code><br />
</div>
<p><a href="policy_8cpp_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:abb2b48ecfd43dcb01e25d9d4c333a340"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="policy_8cpp.html#abb2b48ecfd43dcb01e25d9d4c333a340">IsStandard</a> (const <a class="el" href="classCScript.html">CScript</a> &amp;scriptPubKey, <a class="el" href="standard_8h.html#a750f89f617f934820d5371be790e09ad">txnouttype</a> &amp;whichType)</td></tr>
<tr class="separator:abb2b48ecfd43dcb01e25d9d4c333a340"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a74832d5d658916e73adb139fd60e2354"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="policy_8cpp.html#a74832d5d658916e73adb139fd60e2354">IsStandardTx</a> (const <a class="el" href="classCTransaction.html">CTransaction</a> &amp;tx, std::string &amp;reason)</td></tr>
<tr class="separator:a74832d5d658916e73adb139fd60e2354"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a791e33e18bea9861e449e6ebcfce8890"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="policy_8cpp.html#a791e33e18bea9861e449e6ebcfce8890">AreInputsStandard</a> (const <a class="el" href="classCTransaction.html">CTransaction</a> &amp;tx, const <a class="el" href="classCCoinsViewCache.html">CCoinsViewCache</a> &amp;mapInputs)</td></tr>
<tr class="separator:a791e33e18bea9861e449e6ebcfce8890"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Function Documentation</h2>
<a id="a791e33e18bea9861e449e6ebcfce8890"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a791e33e18bea9861e449e6ebcfce8890">&#9670;&nbsp;</a></span>AreInputsStandard()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool AreInputsStandard </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="classCTransaction.html">CTransaction</a> &amp;&#160;</td>
<td class="paramname"><em>tx</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const <a class="el" href="classCCoinsViewCache.html">CCoinsViewCache</a> &amp;&#160;</td>
<td class="paramname"><em>mapInputs</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Check for standard transaction types </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">mapInputs</td><td>Map of previous transactions that have outputs we're spending </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>True if all inputs (scriptSigs) use only standard transaction forms </dd></dl>
<p class="definition">Definition at line <a class="el" href="policy_8cpp_source.html#l00123">123</a> of file <a class="el" href="policy_8cpp_source.html">policy.cpp</a>.</p>
<p class="reference">Referenced by <a class="el" href="validation_8cpp_source.html#l00549">AcceptToMemoryPoolWorker()</a>.</p>
</div>
</div>
<a id="abb2b48ecfd43dcb01e25d9d4c333a340"></a>
<h2 class="memtitle"><span class="permalink"><a href="#abb2b48ecfd43dcb01e25d9d4c333a340">&#9670;&nbsp;</a></span>IsStandard()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool IsStandard </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="classCScript.html">CScript</a> &amp;&#160;</td>
<td class="paramname"><em>scriptPubKey</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="standard_8h.html#a750f89f617f934820d5371be790e09ad">txnouttype</a> &amp;&#160;</td>
<td class="paramname"><em>whichType</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Check transaction inputs to mitigate two potential denial-of-service attacks:</p>
<ol type="1">
<li>scriptSigs with extra data stuffed into them, not consumed by scriptPubKey (or P2SH script)</li>
<li>P2SH scripts with a crazy number of expensive CHECKSIG/CHECKMULTISIG operations</li>
</ol>
<p>Check transaction inputs, and make sure any pay-to-script-hash transactions are evaluating IsStandard scripts</p>
<p>Why bother? To avoid denial-of-service attacks; an attacker can submit a standard HASH... OP_EQUAL transaction, which will get accepted into blocks. The redemption script can be anything; an attacker could use a very expensive-to-check-upon-redemption script like: DUP CHECKSIG DROP ... repeated 100 times... OP_1 </p>
<p class="definition">Definition at line <a class="el" href="policy_8cpp_source.html#l00037">37</a> of file <a class="el" href="policy_8cpp_source.html">policy.cpp</a>.</p>
<p class="reference">Referenced by <a class="el" href="policy_8cpp_source.html#l00059">IsStandardTx()</a>.</p>
</div>
</div>
<a id="a74832d5d658916e73adb139fd60e2354"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a74832d5d658916e73adb139fd60e2354">&#9670;&nbsp;</a></span>IsStandardTx()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool IsStandardTx </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="classCTransaction.html">CTransaction</a> &amp;&#160;</td>
<td class="paramname"><em>tx</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">std::string &amp;&#160;</td>
<td class="paramname"><em>reason</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Check for standard transaction types </p><dl class="section return"><dt>Returns</dt><dd>True if all outputs (scriptPubKeys) use only standard transaction forms </dd></dl>
<p class="definition">Definition at line <a class="el" href="policy_8cpp_source.html#l00059">59</a> of file <a class="el" href="policy_8cpp_source.html">policy.cpp</a>.</p>
<p class="reference">Referenced by <a class="el" href="validation_8cpp_source.html#l00549">AcceptToMemoryPoolWorker()</a>.</p>
</div>
</div>
</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="policy_8cpp.html">policy.cpp</a></li>
<li class="footer">Generated on Thu Dec 14 2017 13:15:10 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>