go-perun
go-perun copied to clipboard
Simplify channel proposal acceptance
The current way of accepting a ledger channel proposal lcp is as follows.
acceptance := lcp.Accept(part, nonce)
r.Accept(h.conn.Context(), acceptance)
- It is confusing that accept needs to be called on the proposal and the proposal responder.
- In most cases we provide a nonce via
client.WithRandomNonce(), which does not depend on any parameters.
Regarding 2.: We can make the nonce parameter optional and let the default behavior be that the nonce is chosen as client.WithRandomNonce().
Regarding 1.: We should consider combining lcp.Accept and r.Accept into one function. We might even consider combining lcp and r into one object. Alternatively, we should at least rename lcp.Accept to make it clear, that it does not accept the proposal, but only generates the acceptance message.