New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LockTime::from_height
could use a clarification for the meaning of height
#2697
Comments
I think both options you mention are the same? The
I agree it would be nice to clarify this in |
I was thinking of it as "height X means you can enter the mempool at X and get confirmed in X+1" vs "height X means you can enter the block at X and the mempool at X-1". I always confuse the two so would be nice to have it in the docs :) |
Agreed, would be nice to have this in the docs! But also agree that the description in the OP is still pretty confusing. I like Matt's "is allowed in block X, meaning that the mempool will allow it at block X-1" (or X+1/X if that's the correct thing -- I also don't remember offhand). |
I've never heard of this so I went digging in Core to see if I could learn something, I've come up with a counter view to both @TheBlueMatt and @apoelstra so in a shameless call to authority I'm guessing I'm missing something. In
Then we call And over in CBlockIndex* pindexPrev = m_chainstate.m_chain.Tip();
assert(pindexPrev != nullptr);
nHeight = pindexPrev->nHeight + 1; Then we call So to me it seems that both the mempool and the next block will accept a tx with locktime upto and including the value of the current chain tip. For completeness, in bool IsFinalTx(const CTransaction &tx, int nBlockHeight, int64_t nBlockTime)
{
if (tx.nLockTime == 0)
return true;
if ((int64_t)tx.nLockTime < ((int64_t)tx.nLockTime < LOCKTIME_THRESHOLD ? (int64_t)nBlockHeight : nBlockTime))
return true; |
Yes, and the next block's height will be this value +1 :). Or are you just arguing that X/X-1 should be X+1/X in our comments? In that case you're probably right, given that you read the source and I didn't. |
I'm always confused about this, so I trust Tobin for reading the source and tnull because he quoted Murch who is the authority on how bitcoin works. |
My point is that there is no X+1 (or X-1), only X Both the check for inclusion in the mempool and inclusion in the next block (the one being mined) both add 1 to the locktime height then use |
One person's >= X is another's > X + 1 🤷♂️ |
@tcharding, I believe adding a adding comment roughly stating the transaction is safe to broadcast when the current chain tip is at Height h should resolve the issue. |
@tcharding you say "there is no +1" but then use the word "next" twice :P. "next" means plus one. |
Lol, so it does. |
Is the height the height at which the transaction can be included? Or the height at which the transactions can be included in the mempool?
The text was updated successfully, but these errors were encountered: