-
Notifications
You must be signed in to change notification settings - Fork 411
attempt to create API for regular Pings #382
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
Conversation
updating my fork
…structures before i begin hacking
Hmm, our runtime model prevents us from spawning threads. Instead, we should probably try to model this as simply a function that the *user* calls every minute or so. Inside it we should walk the peer list, check if a pending ping didn’t get a response (and disconnect them), and generate new pings for every power.
… On Oct 18, 2019, at 21:08, Aleru ***@***.***> wrote:
You can view, comment on, or merge this pull request online at:
#382
Commit Summary
Merge pull request #1 from rust-bitcoin/master
first add
updateS
add
commit
commit
updates
s
fixed first bug :D
fixed bug for real this time... probably should read docs of related structures before i begin hacking
coming along nicely
need docs and test
updates
commit
x
n
another update
cleaning it up a bit for groupwork
more cleaning :P
add todot
remove no longer relevant comment
fixed issue of disconnecting peer
removed extra comment
probably ready for PR
ready for pr... for real this time!
ready for pr act 3
ready for pr act 4
File Changes
M src/ln/peer_handler.rs (170)
Patch Links:
https://github.com/rust-bitcoin/rust-lightning/pull/382.patch
https://github.com/rust-bitcoin/rust-lightning/pull/382.diff
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Sounds good, If I understand you correctly the final function would look something like this: pub fn check_peers(&mut self) -> Result<(), PeerHandleError> { A couple notes/concerns though If I understand correctly the desired implementation would require the user to generate the very first Ping message (I am assuming this is okay). The disconnect_if_no_pong function (at least the way it is currently written) does not really have any knowledge of specific ping messages it just scans a copy of the pending_read_buffer looking for anything that resembles a pong message, if there is no pong-like message it removes the Peer from PeerHolder. It seems really sketchy that I manually removed (calling the remove method on the hashmap) the Peer from Peerholder.peers as opposed to using some prewritten functionality (I could not find anything that worked so i just manually removed the Peer). The disconnect_if_no_pong function also does not clear the Pong messages from the pending_read_buffer either, should i be concerned that they will build up and never be removed? |
This carries a surprising amount of complexity despite only being possible in the case where monitor updating failed during the processing of funding_generated. Specifically, this requires handling rebroadcasting funding_locked once we successfully persist our monitor again. As an alternative we could never send funding_signed when the monitor failed to persist, but this approach avoids needless delays during funding.
This avoids a crash where a channel with a duplicate id is created immediately after another is closed, where the other still has a pending funding generation event. Resulting in funding generation being passed to the wrong channel (which isn't in an appropriate state).
max_htlc_value_in_flight_msat is applied per-direction
In case of sending channel_reestablish message, we join our current per_commitment_point and their highest revocation secret we know about We set data_loss_protect by default and adjust encoding_init test in consequence
If we remote peer provide us a revocation secret which doesn't match with next_remote_revocation_number we close the channel If we learn that we are fallen-behind, we send back a CloseDelayBroadcast error, special take care will be take to log error and channel should stale, i.e we expect our honest peer to unilateral close to claim on it our balance Add ChannelError::CloseDelayBroadcast to signal that you need to close the channel but not to broadcast it while however update ChannelMonitor with remote per_commitment_point thanks to our peer being a gentleman
You may use it to get a broadcastable local toxic tx in case of fallen-behind, i.e when receiving a channel_reestablish with a proof that our remote side knows a higher revocation secret than the local commitment number we are aware of. Broadcasting these transactions are UNSAFE, as they allow remote side to punish you. Nevertheless you may want to broadcast them if remote don't close channel with his higher commitment transaction after a substantial amount of time (a month or even a year) to get back funds. Best may be to contact out-of-band the other node operator to coordinate with him if option is available to you. In any-case, choice is up to the user. Also, log toxic commitment tx id in channel_reestablish sending back ChannelError::CloseDelayBroadcast
Also, restrict commitment transaction filters in ChannelMonitor:: block_connected
Update the fuzz and net-tokio crates first add updateS add commit commit updates s fixed first bug :D fixed bug for real this time... probably should read docs of related structures before i begin hacking coming along nicely need docs and test updates commit x n another update cleaning it up a bit for groupwork more cleaning :P add todot remove no longer relevant comment fixed issue of disconnecting peer removed extra comment probably ready for PR ready for pr... for real this time! ready for pr act 3 ready for pr act 4
just sharing work, not ready for review
Ouch, I think i will try using GUI. please go ahead and disregard all the commits I don't really know what is going on. |
Let me know if there are any revisions you would like or things I should do differently next time.