Make Halving(height) return 0 (rather than -1) for height < SlowStartShift.

This has no effect on consensus since the Halving function is not used in that case,
but it makes the definition match the intuitive meaning of the function.

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
This commit is contained in:
Daira Hopwood 2020-08-11 13:55:38 +01:00
parent d117273977
commit 7032c07fb8
1 changed files with 20 additions and 11 deletions

View File

@ -9845,20 +9845,26 @@ and $\FoundersFraction$ be as defined in \crossref{constants}.
\item $\SlowStartShift \typecolon \Nat := \hfrac{\SlowStartInterval}{2}$ \item $\SlowStartShift \typecolon \Nat := \hfrac{\SlowStartInterval}{2}$
\item $\SlowStartRate \typecolon \Nat := \hfrac{\MaxBlockSubsidy}{\SlowStartInterval}$ \item $\SlowStartRate \typecolon \Nat := \hfrac{\MaxBlockSubsidy}{\SlowStartInterval}$
\vspace{0.5ex} \vspace{0.5ex}
\item $\Halving(\BlockHeight \typecolon \Nat) := \notblossom{\floor{\hfrac{\BlockHeight - \SlowStartShift}{\PreBlossomHalvingInterval}}} \item $\Halving(\BlockHeight \typecolon \Nat) := \begin{cases}
\notbeforeblossom{\begin{cases} 0,&\caseif \BlockHeight < \SlowStartShift \\
\floor{\hfrac{\BlockHeight - \SlowStartShift}{\PreBlossomHalvingInterval}},\hspace{1em}\blossom{\caseif \text{not } \IsBlossomActivated(\BlockHeight)} \\[1.4ex] \notblossom{
\blossom{\floor{\hfrac{\BlossomActivationHeight - \SlowStartShift}{\PreBlossomHalvingInterval} + \hfrac{\BlockHeight - \BlossomActivationHeight}{\PostBlossomHalvingInterval}},}&\blossom{\caseotherwise} \floor{\hfrac{\BlockHeight - \SlowStartShift}{\PreBlossomHalvingInterval}}\kern-0.25em,&\caseotherwise
\end{cases}}$ } %notblossom
\vspace{0.5ex} \notbeforeblossom{
\floor{\hfrac{\BlockHeight - \SlowStartShift}{\PreBlossomHalvingInterval}}\kern-0.25em,&\blossom{\caseif \text{not } \IsBlossomActivated(\BlockHeight)} \\[1.6ex]
\multicolumn{2}{@{}l}{\blossom{\floor{\hfrac{\BlossomActivationHeight - \SlowStartShift}{\PreBlossomHalvingInterval} +
\hfrac{\BlockHeight - \BlossomActivationHeight}{\PostBlossomHalvingInterval}}\kern-0.3em,\hspace{0.85em}\caseotherwise}}
} %notbeforeblossom
\end{cases}$
\vspace{1ex}
\item $\BlockSubsidy(\BlockHeight \typecolon \Nat) := \begin{cases} \item $\BlockSubsidy(\BlockHeight \typecolon \Nat) := \begin{cases}
\SlowStartRate \mult \BlockHeight,&\caseif \BlockHeight < \hfrac{\SlowStartInterval}{2} \\[1.4ex] \SlowStartRate \mult \BlockHeight,&\caseif \BlockHeight < \SlowStartShift \\[1.4ex]
\SlowStartRate \mult (\BlockHeight + 1),&\caseif \hfrac{\SlowStartInterval}{2} \leq \BlockHeight \\ \SlowStartRate \mult (\BlockHeight + 1),&\caseif \SlowStartShift \leq \BlockHeight \\[-0.8ex]
&\text{ and } \BlockHeight < \SlowStartInterval \\[1.4ex] &\text{ and } \BlockHeight < \SlowStartInterval \\[1.4ex]
\floor{\hfrac{\MaxBlockSubsidy}{2^{\Halving(\BlockHeight)}}}\!\!,&\notblossom{\caseotherwise}\notbeforeblossom{\caseif \SlowStartInterval \leq \BlockHeight} \\[-1ex] \floor{\hfrac{\MaxBlockSubsidy}{2^{\Halving(\BlockHeight)}}}\kern-0.25em,&\notblossom{\caseotherwise}\notbeforeblossom{\caseif \SlowStartInterval \leq \BlockHeight} \\[-1.4ex]
\notbeforeblossom { \notbeforeblossom {
&\blossom{\text{ and not } \IsBlossomActivated(\BlockHeight)} \\[1.4ex] &\blossom{\text{ and not } \IsBlossomActivated(\BlockHeight)}\! \\[1.4ex]
\blossom{\floor{\hfrac{\MaxBlockSubsidy}{\BlossomPoWTargetSpacingRatio \mult 2^{\Halving(\BlockHeight)}}}\!\!,}&\blossom{\caseotherwise} \blossom{\floor{\hfrac{\MaxBlockSubsidy}{\BlossomPoWTargetSpacingRatio \mult 2^{\Halving(\BlockHeight)}}}\kern-0.25em,}&\blossom{\caseotherwise}
} %notbeforeblossom } %notbeforeblossom
\end{cases}$ \end{cases}$
\vspace{0.5ex} \vspace{0.5ex}
@ -10847,6 +10853,9 @@ Peter Newell's illustration of the Jubjub bird, from \cite{Carroll1902}.
\blossom{ \blossom{
\item Refine the domain of $\HeightForHalving$ from $\Nat$ to $\PosInt$. \item Refine the domain of $\HeightForHalving$ from $\Nat$ to $\PosInt$.
} %blossom } %blossom
\item Make $\Halving(\BlockHeight)$ return $0$ (rather than $-1$) for $\BlockHeight < \SlowStartShift$.
This has no effect on consensus since the $\Halving$ function is not used in that case, but
it makes the definition match the intuitive meaning of the function.
\item Rename sections under \crossref{consensusfrombitcoin} to clarify that these sections do not only \item Rename sections under \crossref{consensusfrombitcoin} to clarify that these sections do not only
concern encoding, but also consensus rules. concern encoding, but also consensus rules.
\end{itemize} \end{itemize}