1

I found, in the code, an example of a function that retrieves a public key from a transaction. The comments say that because of a previous bug, the tx may contain more than one public key.

Do I understand correctly that this bug has been fixed, and in order to look for the key in new transactions, I don’t need to check if there may be several keys?

Could somebody please clarify whether it is guaranteed that the variable two_found here, will always be true in all new transactions?

  • It will not normally happen, but extra is a freeform field, so it's not guaranteed. – user36303 Apr 26 at 19:26
  • It's not "freeform" [ref], and there are a couple of normal scenarios more than one key can be in tx_extra. – jtgrassie Apr 27 at 12:02
2

tx_extra can contain any number of items. The field is documented here: https://cryptonote.org/cns/cns005.txt

Therefore it can contain 0..N public keys. Usually there is just one public key in it (the tx public key), but there could be more. So do not rely on there just being one, you have to parse the field and respond accordingly.

One such example of a case where there can be more than one public key in the tx extra is for multi-destination transfers involving one or more subaddresses. I also seem to recall that multisig transfers add additional keys in the field.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.