feat(chain): add ChainPosition::blocks_since_conf - #2263
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2263 +/- ##
==========================================
+ Coverage 78.36% 78.41% +0.04%
==========================================
Files 30 30
Lines 5945 5952 +7
Branches 281 282 +1
==========================================
+ Hits 4659 4667 +8
+ Misses 1210 1209 -1
Partials 76 76
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
The concept that is more common is "confirmations". Would it be better to just have Edit: Note that it would be |
Agree, it is more familiar. Something I should have asked before suggesting this is, is it interesting from an API user perspective? Because I came up with this in the context of a test, but seems to be useful in other contexts. |
|
@nymius I think getting confirmations from chain position is definitely useful. It's what a wallet would want to show to the user. |
Suggested by @nymius in #2246 (comment).
Description
Adds
ChainPosition::blocks_since_conf(tip), which returns the number of blocks mined on top of a confirmed position's block, given the chaintip. ReturnsNoneif the position is unconfirmed, or if the confirmation height is abovetip.Changelog notice
ChainPosition::blocks_since_conf, returning the number of blocks mined on top of a confirmed position's block given the chain tip.Checklists
All Submissions:
just pbefore committingNew Features: