Skip to content

Prep lightning-persister for export in the C bindings #874

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

Merged

Conversation

TheBlueMatt
Copy link
Collaborator

No description provided.

@codecov
Copy link

codecov bot commented Apr 12, 2021

Codecov Report

Merging #874 (3fdf252) into main (8088e4b) will increase coverage by 0.02%.
The diff coverage is 81.81%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #874      +/-   ##
==========================================
+ Coverage   90.20%   90.22%   +0.02%     
==========================================
  Files          55       55              
  Lines       28913    28912       -1     
==========================================
+ Hits        26080    26086       +6     
+ Misses       2833     2826       -7     
Impacted Files Coverage Δ
lightning-persister/src/lib.rs 94.06% <81.81%> (-0.90%) ⬇️
lightning/src/ln/functional_tests.rs 96.98% <0.00%> (+0.13%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8088e4b...3fdf252. Read the comment docs.

@TheBlueMatt
Copy link
Collaborator Author

Actually, @valentinewallace is there any reason for read_channelmonitors to be a HashMap to begin with? Its guaranteed to be unique because its file-based, and the OutPoint key is available in the ChannelMonitor anyway, plus when we go to read the ChannelManager they need to be in a HashMap, but without the BlockHash in the pair, so we have to move/convert it anyway?

There's little reason for the HashMap - the ChannelMonitors are
already unique (enforced by file names), and the eventual HashMap
that users need when deserializing the `ChannelManager` is a
slightly different form (it requires no BlockHash entry).
@TheBlueMatt TheBlueMatt force-pushed the 2021-04-persister-export branch from 2a37aac to 651f69b Compare April 12, 2021 22:35
@TheBlueMatt
Copy link
Collaborator Author

Completely dropped the second commit and replaced it with one which just exports a Vec instead, which the bindings already handle and which is just as useful for users.

@TheBlueMatt TheBlueMatt force-pushed the 2021-04-persister-export branch from 651f69b to 3fdf252 Compare April 12, 2021 23:28
@TheBlueMatt
Copy link
Collaborator Author

Only trivial style changes, will take after CI:

$ git diff-tree -U2 651f69b8 3fdf252b
diff --git a/lightning-persister/src/lib.rs b/lightning-persister/src/lib.rs
index c930de26..f6fbc635 100644
--- a/lightning-persister/src/lib.rs
+++ b/lightning-persister/src/lib.rs
@@ -58,5 +58,5 @@ where
 	K::Target: KeysInterface<Signer=Signer>,
 	F::Target: FeeEstimator,
-	L::Target: Logger
+	L::Target: Logger,
 {
 	fn write_to_file(&self, writer: &mut fs::File) -> Result<(), std::io::Error> {
@@ -96,5 +96,5 @@ impl FilesystemPersister {
 		K::Target: KeysInterface<Signer=Signer>,
 		F::Target: FeeEstimator,
-		L::Target: Logger
+		L::Target: Logger,
 	{
 		let path = PathBuf::from(data_dir);
@@ -106,5 +106,5 @@ impl FilesystemPersister {
 		&self, keys_manager: K
 	) -> Result<Vec<(BlockHash, ChannelMonitor<Signer>)>, std::io::Error>
-		where K::Target: KeysInterface<Signer=Signer> + Sized
+		where K::Target: KeysInterface<Signer=Signer> + Sized,
 	{
 		let path = self.path_to_monitor_data();
$

@TheBlueMatt TheBlueMatt merged commit bc899dc into lightningdevkit:main Apr 12, 2021
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.

3 participants