Conversation
|
Hi @vincenzopalazzo ! I was wondering if you have been able to make progress with this PR locally. We will need it for BDK's integration with Nakamoto. If not, I'm willing to help if you don't have time to focus on it. |
|
In reality, I was waiting bdk team to do this because I was blocked on my project for the same reason 😄 I did not finish this before because everyone was not upgrading to the new version of rust-bitcoin So now that the bdk team has done it, I will finish the PR |
Thanks |
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
3a67b57 to
7dce803
Compare
vincenzopalazzo
left a comment
There was a problem hiding this comment.
Small self note that I need to look at
common/src/block/tree.rs
Outdated
|
|
||
| target = target.mul_u32(adjusted_timespan); | ||
| target = target / Target::from_u64(params.pow_target_timespan).unwrap(); | ||
| target = target * adjusted_timespan; |
There was a problem hiding this comment.
looks like this is not correct, the target is a u256 so this will overflow.
Maybe rust-bitcoin should make available the same operation?
|
This is blocked by rust-bitcoin/rust-bitcoin#1993 |
| let mut best_work = Uint256::zero(); | ||
| // FIXME: this need to be a Work by network? or the min is equal for | ||
| // every network? | ||
| let mut best_work = Work::MAINNET_MIN; |
There was a problem hiding this comment.
This should be general and not with mainet only
chain/src/block/cache/test.rs
Outdated
|
|
||
| use nakamoto_common::bitcoin; | ||
| use nakamoto_common::bitcoin::blockdata::block::BlockHeader; | ||
| use nakamoto_common::bitcoin::{self, CompactTarget}; |
There was a problem hiding this comment.
split in two line
p2p/src/fsm.rs
Outdated
| return self.disconnect(addr, DisconnectReason::PeerMagic(msg.magic)); | ||
| return self.disconnect( | ||
| addr, | ||
| DisconnectReason::PeerMagic(u32::from_be_bytes(msg.magic.to_bytes())), |
There was a problem hiding this comment.
Mh maybe it is possible to better than this at the API level
| use std::rc::Rc; | ||
|
|
||
| use nakamoto_common::bitcoin::util::bip158; | ||
| use nakamoto_common::bitcoin::{bip158, ScriptBuf}; |
There was a problem hiding this comment.
this need to be splitted
| let fee = received - sent; | ||
| let weight = tx.weight(); | ||
| let rate = fee as f64 / (weight as f64 / WITNESS_SCALE_FACTOR as f64); | ||
| let rate = fee as f64 / (weight.to_wu() as f64 / WITNESS_SCALE_FACTOR as f64); |
There was a problem hiding this comment.
make a double check, what is to_wu
p2p/src/fsm/output.rs
Outdated
| //! with specific capabilities, eg. peer disconnection, message sending etc. to | ||
| //! communicate with the network. | ||
| use log::*; | ||
| use nakamoto_common::bitcoin::network::Magic; |
There was a problem hiding this comment.
fix the import order
| use std::str::FromStr; | ||
| use std::sync::Arc; | ||
|
|
||
| use log::*; |
There was a problem hiding this comment.
fix the import order
| height, | ||
| BlockHeader { | ||
| version: 1, | ||
| version: Version::from_consensus(1), |
There was a problem hiding this comment.
| version: Version::from_consensus(1), | |
| version: Version::ONE, |
vincenzopalazzo
left a comment
There was a problem hiding this comment.
This is my self review to see the blocking step to get this PR merged and also to see if I introduce regression
|
Hi @vincenzopalazzo ! I know you are very busy doing other important work but I just wanted to check if there has been any progress. We are still waiting on it to implement BDK's CBF syncing feature. |
|
Still waiting on rust-bitcoin/rust-bitcoin#2090 afaict |
|
Ok finally this is merged rust-bitcoin/rust-bitcoin#2740 Waiting so see what will be the next release where this will be merged and I will finish this PR or maybe open a new one |
This is a WIP, so this patch will be out just for early review.