rust-lightning icon indicating copy to clipboard operation
rust-lightning copied to clipboard

Provide local balance msat value in `ChannelForceClosed`

Open TheBlueMatt opened this issue 3 years ago • 25 comments

For accounting purposes, its nice to know what your local balance was when a channel was force-closed. This would allow you to see how many msat you lost to rounding.

TheBlueMatt avatar Dec 04 '22 00:12 TheBlueMatt

if i could get some guidance i'd like to do this issue

Cxxshyy avatar Dec 08 '22 22:12 Cxxshyy

Basically add a new field last_local_balance_msat or something like that, to the ChannelClosed event, and then fix all the compile errors where we generate that event by calling Channel::get_available_balances and including the balance_msat field.

TheBlueMatt avatar Dec 12 '22 23:12 TheBlueMatt

@TheBlueMatt ok will have a shot but will ask a lot since i'm still new to rust

Cxxshyy avatar Dec 14 '22 08:12 Cxxshyy

first question is what file handles the channel close event @TheBlueMatt

Cxxshyy avatar Dec 16 '22 09:12 Cxxshyy

first question is what file handles the channel close event @TheBlueMatt

You can find this event type in the documentation: https://docs.rs/lightning/latest/lightning/util/events/enum.Event.html#variant.ChannelClosed

tnull avatar Dec 16 '22 12:12 tnull

Hii, I want to do this issue, and I am new to rust, so I will need some help. I think this file handles channel close event : https://github.com/lightningdevkit/rust-lightning/blob/main/lightning/src/ln/channel.rs Am i correct ?

Sharmalm avatar Dec 27 '22 13:12 Sharmalm

Sorry I think this file handles channel close event: https://github.com/lightningdevkit/rust-lightning/blob/main/lightning/src/ln/channelmanager.rs @tnull Am correct ?

Sharmalm avatar Dec 29 '22 07:12 Sharmalm

You should start by updating the event itself in events.rs and compile, that will give you a list of places that need updating :)

TheBlueMatt avatar Jan 03 '23 03:01 TheBlueMatt

ok thanks

Cxxshyy avatar Jan 03 '23 08:01 Cxxshyy

what should the type be for last_local_balance_msat field @TheBlueMatt

Cxxshyy avatar Jan 03 '23 12:01 Cxxshyy

what should the type be for last_local_balance_msat field @TheBlueMatt

@Cxxshyy should be u64!

valentinewallace avatar Jan 03 '23 17:01 valentinewallace

ok thanks

what should the type be for last_local_balance_msat field @TheBlueMatt

@Cxxshyy should be u64!

Cxxshyy avatar Jan 03 '23 21:01 Cxxshyy

Hey everyone, I'm new opensource, but there are some issues I don't understand and the ones I do are already assigned to someone. i would like to to give a try on this issue ,so @Cxxshyy can i work with you on this issue? :)

Sharmalm avatar Jan 04 '23 10:01 Sharmalm

@Lalitmohansharma1 hey man sorry i dont think this issue is big enough for 2 people to work on.

Cxxshyy avatar Jan 04 '23 21:01 Cxxshyy

also image for this function here would i need to create a new function to obtain the local balance

Cxxshyy avatar Jan 04 '23 21:01 Cxxshyy

@Lalitmohansharma1 hey man sorry i dont think this issue is big enough for 2 people to work on.

Ok :)

Sharmalm avatar Jan 05 '23 09:01 Sharmalm

also image for this function here would i need to create a new function to obtain the local balance

Does this comment answer that: https://github.com/lightningdevkit/rust-lightning/issues/1898#issuecomment-1347474378 so just use Channel::get_available_balances?

valentinewallace avatar Jan 05 '23 17:01 valentinewallace

also image for this function here would i need to create a new function to obtain the local balance

Does this comment answer that: https://github.com/lightningdevkit/rust-lightning/issues/1898#issuecomment-1347474378 so just use Channel::get_available_balances?

on it thanks

Cxxshyy avatar Jan 05 '23 17:01 Cxxshyy

pub fn get_available_balances(&self) -> AvailableBalances this is the function signature where availableBalances is a struct however localBal is an u64 so how can i satisfy this when i call the function image

Cxxshyy avatar Jan 05 '23 22:01 Cxxshyy

Use the relevant (local balance) field from it :)

TheBlueMatt avatar Jan 06 '23 00:01 TheBlueMatt

ok i think i might have completed it now

Cxxshyy avatar Jan 06 '23 23:01 Cxxshyy

nvm but close

Cxxshyy avatar Jan 06 '23 23:01 Cxxshyy

@Cxxshyy / @Bolt-12 either of you actively working on this? Would be interested in picking it up if it's free.

freddiekrugerrand avatar Mar 30 '23 19:03 freddiekrugerrand

Hey @TheBlueMatt I would like to work on this issue, is this up for grabs ?

srikanth-iyengar avatar Apr 23 '24 16:04 srikanth-iyengar

Looks like it, its been a few months since the last comment.

TheBlueMatt avatar Apr 23 '24 21:04 TheBlueMatt

Is this good to close, given that https://github.com/lightningdevkit/rust-lightning/pull/3235 was merged?

Mirebella avatar Oct 13 '24 08:10 Mirebella