Bitcoin Forum
March 18, 2018, 09:57:57 PM *
News: Latest stable version of Bitcoin Core: 0.16.0  [Torrent]. (New!)
   Home   Help Search Donate Login Register  
Pages: [1]
Author Topic: Relative locktime / CSV enforcement  (Read 380 times)
Hero Member
Offline Offline

Activity: 576
Merit: 500

View Profile
May 03, 2017, 09:12:00 PM

I don't fully understand how bitcoin prevents relative locktime (rl) /csv transactions from being mined early.

1. Tx A with csv = 10 blocks  -> The output is spendable 10 blocks after Tx A has been mined
2. Tx A gets mined at height x
3. Tx B spends the output of Tx A, sets rl (sequence) = 12, pushed to the network at height x+1

I am not sure what happens now. The csv of Tx A is checked against the sequence of Tx B and the validation fails if larger?

if (nSequenceMasked > txToSequenceMasked)
return false;

Doesn't this mean that Tx B would be mined before x+10? Why do we compare the locktime to the locktime of the spending TX? Wouldn't it be easier to simply compare it to the current block height or time?

Question 2:
Let's say I set the sequence to +10 blocks and csv +20, which one is valid?
With relative locktime + CSV you could create an address such that any BTC sent there can only be spent after sitting unspent for 6 months.

I could do the same thing with either relative locktime or csv?

Question 3:
Which sequence gets chosen if we have multiple inputs with different sequences?
Pages: [1]
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!