adshares / ads

ADS Blockchain
Other
21 stars 4 forks source link

function get_transaction returns "Failed to create msgl hash tree" error #96

Closed PawelPodkalicki closed 6 years ago

PawelPodkalicki commented 6 years ago

This error is not deterministic, but was observed in following test scenario:

Steps to reproduce:

  1. Send two wires (2x send_one). Store returned tx.id.
  2. Wait for more than one block.
  3. Update blocks data with (get_blocks).
  4. Check transaction (2x get_transaction with parameter tx.id from step 1.).

Sometimes functions responds with Failed to create msgl hash tree error. In that case no information about transaction can be obtained.

PawelPodkalicki commented 6 years ago

Full log is available in 20180621_1736_logs_gettx_fail_tree.zip

PawelPodkalicki commented 6 years ago

Network 20x20. Three get_transaction requests. Two were correct, third ended with error Failed to create msgl hash tree.

In file src/common/helper/servers.cpp, in function getMsglHashTree condition

memcmp(m_header.msgHash, nhash,32)

was true.

Logs of correct responses:

[1530089377] HASHTREE start 1 + 0 [max:4 mlen:313 ttot:565 len:111]
[1530089377] HASHTREE add 1
[9999] getMsglHashTree
msg_number:2)
messageCount:0)
loaded Header
parser loaded and not empty
[1530089378] HASHTREE start 2 + 3 [max:4 mlen:313 ttot:565 len:117]
[1530089378] HASHTREE add 0
[9999] getMsglHashTree
msg_number:2)
messageCount:0)
loaded Header
parser loaded and not empty

Log of invalid response:

[1530089378] HASHTREE start 1 + 0 [max:3 mlen:202 ttot:386 len:117]
[1530089378] HASHTREE add 1
[9999] getMsglHashTree
msg_number:1)
messageCount:0)
loaded Header
parser loaded and not empty
HASHTREE failed (path len:8) to get msghash
PawelPodkalicki commented 6 years ago

Fixed. Checked with fa66c9bed34603160629ffb65fdd06fe38639d29