Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We decided to strengthen the security guarantees that will be provided by the signed affiliate data in CoinJoin. Due to these changes it is becoming a little more complicated to reuse the solution that is based on payment requests, although I think it could still be done if we wanted to. Payment requests are meant for individual outputs or sets of outputs in a transaction, whereas the affiliate data is now working with the entire set of inputs and outputs. I'd call this a "transaction request" and in this particular case a
CoinJoinRequest
. Since there is only one such transaction request per transaction it makes sense to put it intoSignTx
, which is what I did here.In the future we might want to add other types of transaction requests. In that case we should be able to change
to
and maintain binary compatibility, see https://developers.google.com/protocol-buffers/docs/proto3#oneof.
The
CoinJoinRequest
contains two bitfieldsrequired bytes remixed_inputs
andrequired bytes signable_inputs
. The size of each of these fields is proportional to the number of inputs, e.g. 300 inputs implies ceil(300/8) = 38 bytes. In terms of scalability it seems more correct to put this information intoTxInput
as two fieldsoptional bool coinjoin_remix
andoptional bool coinjoin_signable
or merged into a single fieldoptional int coinjoin_flags
with possible values 0, 1, 2, 3. These fields should then be present if and only if aCoinJoinRequest
is present inSignTx
. The current solution on the other hand puts all the information in one place.I'd like to hear opinions about the protobuf design mainly from @matejcik:
SignTx
with too much information by adding this? We could devise a way to send the information in a separate message.CoinJoinRequest.remixed_inputs
andCoinJoinRequest.signable_inputs
TxInput.coinjoin_remix
andTxInput.coinjoin_signable
TxInput.coinjoin_flags
I am still considering implementing this via the existing payment request mechanism, in which case we'd need to use one of the two latter options in Question 2 above and either hard-code
plebs_dont_pay_threshold
or send it inSignTx
. Any opinions on the dedicated CoinJoinRequest mechanism proposed here vs. reusing the payment request mechanism?