Bitcoin Forum
November 12, 2024, 09:15:42 AM *
News: Check out the artwork 1Dq created to commemorate this forum's 15th anniversary
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: what is the point of using locktime apart from the obvious  (Read 229 times)
RoommateAgreement (OP)
Hero Member
*****
Offline Offline

Activity: 770
Merit: 500


Bazinga!


View Profile
June 06, 2017, 03:10:03 AM
 #1

let me explain tht title a little better:

assume block 470000 was mined right now. i go to a service and make a withdrawal (this has actually happened with my BTC withdrawals from exchanges) the transaction that i receive has a locktime of 470000!

so my question is why include that in a transaction, it will be mined because it is over the time anyways with the next block 470001!

Buying the dip...
kolloh
Legendary
*
Offline Offline

Activity: 1736
Merit: 1023


View Profile
June 06, 2017, 03:23:05 AM
 #2

let me explain tht title a little better:

assume block 470000 was mined right now. i go to a service and make a withdrawal (this has actually happened with my BTC withdrawals from exchanges) the transaction that i receive has a locktime of 470000!

so my question is why include that in a transaction, it will be mined because it is over the time anyways with the next block 470001!

I've seem some services do this before as well and never really understood the purpose for manually including a nlocktime for the current block
achow101
Staff
Legendary
*
Offline Offline

Activity: 3542
Merit: 6886


Just writing some code


View Profile WWW
June 06, 2017, 03:30:52 AM
 #3

It's done to discourage fee sniping. Bitcoin Core does this, and the comment in the source code describes why pretty well:
Quote
    // Discourage fee sniping.
    //
    // For a large miner the value of the transactions in the best block and
    // the mempool can exceed the cost of deliberately attempting to mine two
    // blocks to orphan the current best block. By setting nLockTime such that
    // only the next block can include the transaction, we discourage this
    // practice as the height restricted and limited blocksize gives miners
    // considering fee sniping fewer options for pulling off this attack.
    //
    // A simple way to think about this is from the wallet's point of view we
    // always want the blockchain to move forward. By setting nLockTime this
    // way we're basically making the statement that we only want this
    // transaction to appear in the next block; we don't want to potentially
    // encourage reorgs by allowing transactions to appear at lower heights
    // than the next block in forks of the best chain.
    //
    // Of course, the subsidy is high enough, and transaction volume low
    // enough, that fee sniping isn't a problem yet, but by implementing a fix
    // now we ensure code won't be written that makes assumptions about
    // nLockTime that preclude a fix later.

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!