lightningnetwork / lnd

Lightning Network Daemon ⚡️
MIT License
7.72k stars 2.09k forks source link

ChannelAcceptAcceptor: evil twin of ChannelAcceptor #6726

Open Crypt-iQ opened 2 years ago

Crypt-iQ commented 2 years ago

We can currently intercept incoming channel opens to the lnd node. What we cannot do is intercept the accept_channel message if we are the initiator. It is harder to sanity check that their parameters are safe for us to use without turning knobs. The ChannelAcceptAcceptor (we need a new name) would intercept accept_channel messages at the fundingmanager-level and give them to the rpc-layer. The functionality should be essentially identical to the open_channel acceptor. Alternatively, a general message-interceptor could probably take on the role of ChannelAcceptor & ChannelAcceptAcceptor and we could refactor some of the current logic. However, a general message-interceptor is probably a larger code lift in the short term.

dstadulis commented 2 years ago

ChannelAcceptAcceptor (we need a new name)

ChannelAcceptController ChannelFlowController ChannelAcceptApprover

Crypt-iQ commented 2 years ago

The problem is we have the ChannelAcceptor which accepts/denies an open_channel message. Ideally we'd rename the rpc to ChannelOpenPredicate and this one would be ChannelAcceptPredicate. I don't think those names are distinct enough from the name/intent of ChannelAcceptor

alexbosworth commented 2 years ago

Could the existing channel acceptor RPC just handle both cases? Maybe you could pass an argument to it to also catch own opens?

Crypt-iQ commented 2 years ago

Could the existing channel acceptor RPC just handle both cases? Maybe you could pass an argument to it to also catch own opens?

I think so