Skip to content

Conversation

EthanYuan
Copy link
Collaborator

@EthanYuan EthanYuan commented Nov 4, 2024

Converted start_time and end_time to i64 for safe subtraction, avoiding overflow in nActualTimespan. Ensures consistency with Bitcoin Core’s difficulty adjustment logic CalculateNextWorkRequired(..) in Bitcoin source code.

service side log:

[2024-11-04T08:30:10Z INFO  ckb_bitcoin_spv_service::cli::serve] Try to update SPV instance
thread 'main' panicked at /usr/local/cargo/git/checkouts/ckb-bitcoin-spv-984d49c27aa7958d/bfc71d7/verifier/src/utilities/bitcoin.rs:25:26:
attempt to subtract with overflow
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

@EthanYuan EthanYuan requested review from Flouse and jjyr November 4, 2024 17:17
@EthanYuan EthanYuan added this pull request to the merge queue Nov 5, 2024
Merged via the queue into utxostack:master with commit 6c3f3d1 Nov 5, 2024
5 checks passed
@EthanYuan EthanYuan deleted the fix-calculate-next-target branch November 5, 2024 03:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants