mit-dci / lit

Lightning Network node software
MIT License
551 stars 119 forks source link

Fix bug where any remote RPC call crashes lit #423

Closed Varunram closed 5 years ago

Varunram commented 6 years ago

Still investigating why peerIds start from 0

ref: #414

delbonis commented 6 years ago

I tried to make them start at 0 when I was writing lnp2p code, but it turns out there's some behavior dependent on that (interprets 0 as "no peer") so there's still some work that needs to be done on that.

#

pls

struct PeerId(u32, Rc<PeerMan>);

impl Deref for PeerId {
    type Target = Option<Peer>;
    fn deref(&self) -> Self::Target {
        self.1.peer_by_id(self.0)
    }
}

And then have the actual integer IDs be unique but non-serial, and everything would just work out ok.

delbonis commented 5 years ago

What's the status of this?

Varunram commented 5 years ago

the proposed fix works.