Let's explore the following scenario. There is an asymmetrical feature F, with a clear client side and provider side. The client side of the protocol is activated by feature X. The provider side of the protocol is activated by feature Y.
Some nodes want to be a client, but not a provider, and want to connect only to nodes that are providers of this feature. They obviously turn on feature X. Since they are only clients of the feature, they cannot turn on feature Y, so how do they require their peers to support feature Y?
We can't rely on setting X mandatory, because that would only work if providers activate X. But providers may want to only be providers of the feature, and not clients of it.
AFAICT, this is not possible to express today with feature bits.
That's an interesting way to twist it, you're right, with a small clarification on the spec it could work.
Right now the way we've interpreted the spec is that after
init
, each peer compares the twofeatures
arrays, and if there is amandatory
bit for which the corresponding feature isn't set in the otherfeatures
array, they fail the connection. That's probably what limited my thinking here, but for these new features we don't need to restrict ourselves to past behavior!The "trick" is in the term
unknown even feature bits
(instead ofactivated even feature bits
), that means we can implement that behavior with pairs of features.Let's summarize how that would work with your proposal:
option_needs_service_f
(mandatory
)option_provides_service_f
(optional
)node_announcement
node_announcement
that the client peers require this feature and only connect to them if they provide itoption_provides_service_f
is activatedoption_needs_service_f
(optional
)option_provides_service_f
or notoption_provides_service_f
option_provides_service_f
(optional
) andoption_needs_service_f
(optional
ormandatory
depending on whether it requires its peers to provide the service)