-
Notifications
You must be signed in to change notification settings - Fork 406
Remove genesis block hash from public API #2025
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove genesis block hash from public API #2025
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CI is unhappy with benchmarking ChannelMananger
.
Relatedly, I wonder if BestBlock::from_genesis
should really be called BestBlock::from_network
?
e24cb62
to
462d899
Compare
Rebased and renamed |
462d899
to
d42b9b8
Compare
Codecov ReportBase: 87.34% // Head: 87.22% // Decreases project coverage by
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more Additional details and impacted files@@ Coverage Diff @@
## main #2025 +/- ##
==========================================
- Coverage 87.34% 87.22% -0.12%
==========================================
Files 101 100 -1
Lines 44296 44093 -203
Branches 44296 44093 -203
==========================================
- Hits 38691 38461 -230
- Misses 5605 5632 +27
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM after rebase
c1f4738
d42b9b8
to
c1f4738
Compare
Rebased. |
Seems the rebase broke CI. |
Forcing users to pass a genesis block hash has ended up being error-prone largely due to byte-swapping questions for bindings users. Further, our API is currently inconsistent - in `ChannelManager` we take a `Bitcoin::Network` but in `NetworkGraph` we take the genesis block hash. Luckily `NetworkGraph` is the only remaining place where we require users pass the genesis block hash, so swapping it for a `Network` is a simple change.
c1f4738
to
d7c818a
Compare
Oops, sorry about that, amended: $ git diff-tree -U1 c1f47380d d7c818a3a
diff --git a/lightning-rapid-gossip-sync/src/processing.rs b/lightning-rapid-gossip-sync/src/processing.rs
index 2ee3dcbaa..4b6de04c6 100644
--- a/lightning-rapid-gossip-sync/src/processing.rs
+++ b/lightning-rapid-gossip-sync/src/processing.rs
@@ -554,5 +554,4 @@ mod tests {
fn full_update_succeeds_at_the_beginning_of_the_unix_era() {
- let block_hash = genesis_block(Network::Bitcoin).block_hash();
let logger = TestLogger::new();
- let network_graph = NetworkGraph::new(block_hash, &logger);
+ let network_graph = NetworkGraph::new(Network::Bitcoin, &logger);
@@ -570,3 +569,2 @@ mod tests {
// this is the timestamp encoded in the binary data of valid_input below
- let block_hash = genesis_block(Network::Bitcoin).block_hash();
let logger = TestLogger::new();
@@ -577,3 +575,3 @@ mod tests {
{
- let network_graph = NetworkGraph::new(block_hash, &logger);
+ let network_graph = NetworkGraph::new(Network::Bitcoin, &logger);
assert_eq!(network_graph.read_only().channels().len(), 0);
@@ -587,3 +585,3 @@ mod tests {
{
- let network_graph = NetworkGraph::new(block_hash, &logger);
+ let network_graph = NetworkGraph::new(Network::Bitcoin, &logger);
assert_eq!(network_graph.read_only().channels().len(), 0); |
Forcing users to pass a genesis block hash has ended up being
error-prone largely due to byte-swapping questions for bindings
users. Further, our API is currently inconsistent - in
ChannelManager
we take aBitcoin::Network
but inNetworkGraph
we take the genesis block hash.
Luckily
NetworkGraph
is the only remaining place where we requireusers pass the genesis block hash, so swapping it for a
Network
is a simple change.
Based on #1980