• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

rust-bitcoin / rust-bitcoin / 9096791071
83%

Build:
DEFAULT BRANCH: master
Ran 15 May 2024 01:43PM UTC
Jobs 1
Files 92
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

15 May 2024 01:42PM UTC coverage: 83.318% (+0.1%) from 83.191%
9096791071

push

github

apoelstra
Merge rust-bitcoin/rust-bitcoin#2740: Add difficulty adjustment calculation

<a class=hub.com/rust-bitcoin/rust-bitcoin/commit/<a class="double-link" href="https://git"><a class=hub.com/rust-bitcoin/rust-bitcoin/commit/47dc4a318070b73158aa1e9b0f05e0146f46faff">47dc4a318<a href="https://github.com/rust-bitcoin/rust-bitcoin/commit/44a64028757a064de1f97a218fe85b301e95aa8d"> feat(pow): add difficulty adjustment calculation (Rob N)

Pull request description:

  Hi, I hit a roadblock with the current `pow` API. As far as I can tell, the only workaround to calculate the next work required similar to `bitcoin/src/pow.cpp` is to use a general big integer library, convert the `Target` to bytes, do the math, and convert back to `Target` from bytes. I have also been working with [Floresta](https://github.com/Davidson-Souza/Floresta/tree/<a class="double-link" href="https://github.com/rust-bitcoin/rust-bitcoin/commit/&lt;a class=&quot;double-link&quot; href=&quot;https://git">&lt;a class=</a>hub.com/rust-bitcoin/rust-bitcoin/commit/780ea8d0b024eb69ccb723ccce9b4e703b143bfd">780ea8d0b</a>) and their [solution](https://github.com/Davidson-Souza/Floresta/blob/780ea8d0b024eb69ccb723ccce9b4e703b143bfd/crates/floresta-chain/src/pruned_utreexo/consensus.rs#L187) was to fork off and exposed the `U256` struct publicly on their branch. I think these home brewed difficulty adjustment solutions will continually pop up, so I created a `from_next_work_required` method to return a `Target`. My work veers significantly from #2180, as I only provided a single method to do so, without further guidance on when exactly this retarget occurs.

  I am happy to add tests once I get further direction from maintainers if this as a likelihood of being accepted or not. Thanks.

ACKs for top commit:
  tcharding:
    ACK 47dc4a318070b73158aa1e9b0f05e0146f46faff
  apoelstra:
    ACK 47dc4a318070b73158aa1e9b0f05e0146f46faff used range-diff

Tree-SHA512: 6d627ce6918e08a91dc88b7c22f8f02dc41

126 of 127 new or added lines in 1 file covered. (99.21%)

19303 of 23168 relevant lines covered (83.32%)

16691.44 hits per line

Jobs
ID Job ID Ran Files Coverage
1 9096791071.1 15 May 2024 01:43PM UTC 0
83.32
GitHub Action Run
Source Files on build 9096791071
Detailed source file information is not available for this build.
  • Back to Repo
  • Github Actions Build #9096791071
  • 44a64028 on github
  • Prev Build on master (#9088761779)
  • Next Build on master (#9112676334)
  • Delete
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc