thibault-martinez / iota.lib.cpp

IOTA C++ Library
MIT License
79 stars 21 forks source link

attachToTangle produces inconsistent bundles when using local POW #326

Closed kuhlmannmarkus closed 1 year ago

kuhlmannmarkus commented 5 years ago

Bug description

attachToTangle produces inconsistent bundles when using local POW. With remote POW, it works.

Hardware Spec

Linux OBSCUREDMACHINENAME 4.15.0-45-generic #48-Ubuntu SMP Tue Jan 29 16:28:13 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

Steps To Reproduce

  1. Have a payload (_PL) built by entangled/mam/v1. (This is my use case)
  2. Send the payload as:
    IOTA::API::Extended api(m_node, m_port, true, m_timeout);
    IOTA::Models::Transfer transfer = {m_address, 0, _PL, m_tag};
    std::vector<IOTA::Models::Transfer> transfers;
    transfers.push_back(transfer);
    auto res = api.sendTransfer(m_seed, 5, 14, transfers);

Expected behaviour

The constructed bundle should be valid.

Actual behavior

The first transaction in the bundle (for bundles consisting of 2 TXs) should reference the last transaction in the bundle as trunk. This is accomplished in the code by referencing tx.getHash(). The result of tx.getHash() is never part of the bundle, so the bundle itself gets inconsistent.

Logs or screenshots

See this bundle for example: CQGBQTSGRILTEIGNCBSZI9ZTZJXPBFQKUYFASFGJYOTONG9DKGHPKCOVXHJCIKLTHKXCEBQIOJYQZRX9X