Using eosio::print changes the behaviour of my contract.

    uint64_t generateID(std::string str)
        uint64_t ret_val = 0;

        eosio::checksum256 digest = eosio::sha256(str.c_str(), str.size());

        auto checksumBytes = digest.extract_as_byte_array().data();

        memcpy(&ret_val, &checksumBytes[1], 8);

        return ret_val;

When I remove the print line, the ret_val always has value of 0, and when the print is there the value is the correct one.

Can someone tell me what the problem is? Thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.