Skip to content
This repository has been archived by the owner on Jun 7, 2023. It is now read-only.

Tag is not accurate #98

Open
TimC71 opened this issue Mar 27, 2018 · 2 comments
Open

Tag is not accurate #98

TimC71 opened this issue Mar 27, 2018 · 2 comments
Labels

Comments

@TimC71
Copy link

TimC71 commented Mar 27, 2018

If use IotaAPI.sendTransfer send three meta transaction with three specified diffrent tag, and more with a value transfer transaction, the last one tag will be used in the input transaction and signature output meta transaction and remainder output transaction, which is not match with the expected.
Please see this:
https://github.com/iotaledger/iota.lib.java/blob/42e1eb5fd5a2938ac417449f213c3a1f8e1bd8d6/jota/src/main/java/jota/IotaAPI.java#L422
The tag is not reset to empty when code run out of the for loop, and will effect the following code:
https://github.com/iotaledger/iota.lib.java/blob/42e1eb5fd5a2938ac417449f213c3a1f8e1bd8d6/jota/src/main/java/jota/IotaAPI.java#L447
https://github.com/iotaledger/iota.lib.java/blob/42e1eb5fd5a2938ac417449f213c3a1f8e1bd8d6/jota/src/main/java/jota/IotaAPI.java#L486
https://github.com/iotaledger/iota.lib.java/blob/42e1eb5fd5a2938ac417449f213c3a1f8e1bd8d6/jota/src/main/java/jota/IotaAPI.java#L497

My opinon is to change the tag variable to in-loop local variable, and remove the tag parameter from the addRemainder method. The tag parameter is not passed from the IotaAPI.sendTransfer method after all.
https://github.com/iotaledger/iota.lib.java/blob/42e1eb5fd5a2938ac417449f213c3a1f8e1bd8d6/jota/src/main/java/jota/IotaAPI.java#L1104-L1111
There is no tag parameter in sendTransfer method declaration.
https://github.com/iotaledger/iota.lib.java/blob/42e1eb5fd5a2938ac417449f213c3a1f8e1bd8d6/jota/src/main/java/jota/IotaAPI.java#L815

@kwek20
Copy link
Contributor

kwek20 commented Oct 7, 2018

Hey @TimC71

What would your expected behavior be for the remainder output tag?
If you expect the tag to be supplied in sendTransfer, which tag do you expect to be used in the addEntry to the bundle (For each transfer)

I would suggest adding an optional remainderTag parameter. Does that work for you?

@kwek20 kwek20 added the bug label Nov 14, 2018
@TimC71
Copy link
Author

TimC71 commented Nov 16, 2018

Hi @kwek20
Thanks for your reply.
If add an optional remainderTag parameter, it will solve the remainder issue, but the last output transfer's tag will still apply to all input transfers.
Here is the method declaration:
public List prepareTransfers(

  1. String seed
  2. int security
  3. final List transfers
  4. String remainder
  5. List inputs
  6. boolean validateInputs
    )
    In my opinon the tag should be used to output transfer(final List<Transfer> transfers) but not the input transfer and remainder(List<Input> inputs and String remainder), because the parameter 3, 4, 5 are three independent entities in semantics.
    So i think make tag to be a in-loop variable and left remainder and input be the default 999..9 might be a way.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants