Target confirmations not intuitive in listsinceblock #14338

issue kallewoof opened this issue on September 27, 2018
  1. kallewoof commented at 6:28 AM on September 27, 2018: member

    The listsinceblock command's second argument

    2. target_confirmations:    (numeric, optional, default=1) Return the nth block hash from the main chain. e.g. 1 would mean the best block hash. Note: this is not used as a filter, but only affects [lastblock] in the return value
    

    does not seem to be very useful in its current form. What are the actual use cases here? (Harding pointed out the below on IRC)

    Oh, maybe its just for parsing history backwards.  E.g. you're looking an the transactions
    since block x and you want to get the block hash for x-1?
    Doing that in a single RPC call over calling getblockhash keeps it atomic so that you don't
    have to worry about a reorg between the listsinceblock call and the getblockhash call, I
    guess.
    

    It feels like it would make sense if this

    1. did filter out txs that were below the target
    2. did show txs that were below the target for arg 1 (blockhash), but were above the target for current block.

    The above two changes would let someone create a simple starting point for only dealing with e.g. 6 confirmation transactions and not even have to bother with confirmation count since they'd never even see any transactions < target confs.

    If not, the documentation is not very descriptive right now, and (despite having worked on the code for listsinceblock personally) I assumed things that weren't true about it, so it definitely needs a fix-up.

  2. fanquake added the label RPC/REST/ZMQ on Sep 27, 2018
  3. RHavar commented at 4:35 PM on October 3, 2018: contributor

    It's actually a great API, it's just poorly understood.

    Let's say you consider 100 confirmations to be set-in-stone (probably pretty reasonable). So really what you want to do is ask core "Tell me everything that's happened in the last 100 blocks".

    But that makes for a terrible API, because if your software goes down for a while -- you'll miss shit. So what you really want to do is say:

    "Give me all transactions that have happened since $SET_IN_STONE" and then after you process that, you want to update $SET_IN_STONE, which should be 100 confirmations before the current best block.

    From an application point of view, it's much nicer to do that atomically. And that's exactly what listsinceblock does.

    We can write some psuedo code:

    set_in_stone :=  "genesis block hash"
    while true {
           transactions, new_set_in_stone :=  listsinceblock(set_in_stone, 100)
           process(transactions)
           set_in_stone = new_set_in_stone
    }
    

    Now the actual problem with listsinceblock is just how badly tested and undefined it is (especially around things like unconfirmed/double-spends). I forgot the exact details but I once had a processing system (including double-spend detection) with it working perfectly, then the behaviors silently broke, and then I fixed that and then it irreparably broke etc. I couldn't rely on something so unstable, so I had to just implement the exact same feature myself -- so I can't tell you ow usable it is or not.

  4. kallewoof commented at 2:43 AM on October 7, 2018: member

    I'm not sure if you're commending the RPC or condemning it. You seem to like the idea but you then say you rewrote what you needed separately as the current system is not working.

    I think we need to fix the docs for this (at least) and perhaps even change it to be sensible. What you describe sounds sensible, I think.

  5. kallewoof commented at 8:33 AM on January 21, 2020: member

    Closing this stale issue. If someone else finds the wording offensive they will surely open an issue/PR and/or comment here.

  6. kallewoof closed this on Jan 21, 2020

  7. ryanofsky referenced this in commit d4f664cd7b on Jan 21, 2020
  8. ryanofsky referenced this in commit 0c9a20e647 on Jan 28, 2020
  9. ryanofsky referenced this in commit b7dcff2f2f on Jan 31, 2020
  10. ryanofsky referenced this in commit 6d4444ce1b on Feb 6, 2020
  11. ryanofsky referenced this in commit e276b68214 on Feb 7, 2020
  12. ryanofsky referenced this in commit 9da0e4121b on Feb 24, 2020
  13. ryanofsky referenced this in commit fda2caea40 on Mar 2, 2020
  14. ryanofsky referenced this in commit 7e870974e6 on Mar 20, 2020
  15. ryanofsky referenced this in commit c4100c088c on Mar 20, 2020
  16. ryanofsky referenced this in commit 24513029bb on Mar 20, 2020
  17. ryanofsky referenced this in commit 2e2a8fdf6b on Mar 24, 2020
  18. ryanofsky referenced this in commit 47ae2bf9dc on Mar 24, 2020
  19. ryanofsky referenced this in commit 6c5ccb32f8 on Mar 31, 2020
  20. ryanofsky referenced this in commit 08211e640f on Mar 31, 2020
  21. ryanofsky referenced this in commit ce5686231c on Mar 31, 2020
  22. ryanofsky referenced this in commit f7ba881bc6 on Apr 13, 2020
  23. jasonbcox referenced this in commit 85c542618a on Oct 11, 2020
  24. van-orton referenced this in commit fc17c9d832 on Oct 30, 2020
  25. DrahtBot locked this on Feb 15, 2022
Contributors

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-13 15:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me