Allow Arbitrary Data in Transaction Extra Nonce via Wallet-API #931
Allow Arbitrary Data in Transaction Extra Nonce via Wallet-API #931
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This parsing code looks pretty good to me, but have you tested it with slightly too short/too long lengths? It's very easy to get off by one errors in code like this.
Extra data supplied must be in hexadecimal form.
I've ran it through as many tests as I possibly can of long/short values and while it does not throw an error -- improperly constructed fields will lead to unexpected behavior. Example: If you put the public key behind the nonce field, and you say the nonce field is 25-bytes long but only supply 24-bytes, the public key will not be read as the identifier
|
Removed WIP tag. Storing and retrieving the data in wallets, as an option, will be addressed in another PR. |
This allows for the addition of arbitrary hexadecimal data to be added to a transaction nonce via wallet-api.
The additional body parameter
extra
has been added to support this.Once supplied, the data is encoded behind a special nonce tag (
127
) and appended to the nonce such that:Example: https://explorer.turtlecoin.lol/transaction.html?hash=5591fc3bb7384d304341066b214635687c615c860b17024d8cdb593e23aae017
Note: This does not remove the 1,024 byte limit for the TX_EXTRA so that limit still applies.
This matches how I handled this in turtlecoin-utils