Tag is not accurate
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
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?
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<String> prepareTransfers(
- String seed
- int security
- final List<Transfer> transfers
- String remainder
- List<Input> inputs
- 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> inputsandString 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.