Sending multiple transactions quickly doesn't work

If I send multiple transactions within small period (seconds or minutes) then only some of them or no one at all are included in blocks.

My case:

  • testnet
  • all transactions are transfers
  • minimal fee depending on transfer amount and message is calculated and included
  • all transactions are successfully announced, but only some of them or no one are included in blockchain, others expire later
  • that’s true for even a couple of consequent transactions
  • transactions of v2 are used

What am I doing wrong? Could min fee be too low for such scenario?

That’s rather common case for exchanges, I guess, so it definitely should work.

So you are verifying the announce result and you are getting hashes returned from all announced transactions?
To which node did you announce?

So you are verifying the announce result and you are getting hashes returned from all announced transactions?

Yes, exactly.

To which node did you announce?

I’ve tried my own node and a public one. No difference.

Can you retry using HugeTestAlice2.nem.ninja?

Can you retry using HugeTestAlice2.nem.ninja?

The same result.

But I think I’ve just figured out the reason. I use C# SDK, which creates transactions using local time to calculate timestamp. But testnet time is delayed actually. If I make a delay on 30 seconds between signing and announcing then transactions are applied properly.

Ok, it seems like I need to rewrite my code a bit. But bad thing is that nodes silently accept such a transaction and then never apply it.

Anyway - thanks for trying to help!

That seems unlikely to me. What exactly does the returned json object look like?

I see in the log:

2019-01-10 15:01:38.435 WARNING Transaction from TDR5GJVTJT7TDGKKAUNXWY7JAEBFFQDRLH24DVFW rejected (FAILURE_TIMESTAMP_TOO_FAR_IN_FUTURE)

So you should get an error code in the response from announce.

1 Like

Hmm, you are right, error message actually is there:

{
    "Type":1,
    "Code":1,
    "Status":"10",
    "Message":"FAILURE_TIMESTAMP_TOO_FAR_IN_FUTURE",
    "Hash":"d8bb2409ffc902e739c382ae8b82cb7a4353b9063deb449bb19736a217672685",
    "InnerHash":null
}

Actually I checked only the Code field which equals 1 and means Success according to https://nemproject.github.io/#nemRequestResult. Should I check the Status field value instead of Code? There is nothing about it in the docs.

Type 1 means that it has to be interpreted as validation result.
Thus the message should contain a validation result. The list of validation results can be found here:

So, successful result looks like

{
    "Type":1,
    "Code":1,
    "Status":"1",
    "Message":"SUCCESS",
    "Hash":"28e989f679d42aa75a11b657418b042bf0c5e96a6cc0703924f8560dc85c199c",
    "InnerHash":null
}

As I see documentation is wrong:

  1. https://nemproject.github.io/#sending-the-data-to-NIS
  2. https://nemproject.github.io/#nemAnnounceResult
  3. https://nemproject.github.io/#nemRequestResult
  4. https://nemproject.github.io/#appendix-B:-NIS-errors

Third link says that Code field contains success/error code. But actually it always equals 1 and real result is returned as Message and Status pair.

@BloodyRookie, thanks for helping!

UPDATE

Documentation is correct. Code field contains correct value. The error is in C# SDK, which parses result wrongly - https://github.com/NemProject/nem1-sdk-csharp/blob/8233bd3d2ca90e4ac0396afa546dc2ef1beef8e5/src/nem1-sdk/src/Infrastructure/Imported/Api/TransactionRoutesApi.cs#L158

Sorry about that. Fix pushed to master. Thanks for spotting this.