Skip to content

Stratum Job Info is so big. #40

@luminousmining

Description

@luminousmining

StratumJobInfo need refacto, this struct will be big will new algorithm and all variable will not used.
The process copy all variable whatever alforithm is computing.

namespace stratum
{
    struct StratumJobInfo
    {
        // Common
        int32_t        epoch{ -1 };
        algo::hash256  jobID{};
        algo::hash256  headerHash{};
        algo::hash256  seedHash{};
        algo::hash256  boundary{};
        uint64_t       nonce{ 0ull };
        uint64_t       startNonce{ 0ull };
        uint64_t       extraNonce{ 0ull };
        uint64_t       gapNonce{ 0x1ull };
        uint64_t       blockNumber{ 0ull };
        uint64_t       period{ 0ull };
        uint64_t       boundaryU64{ 0ull };
        uint32_t       targetBits{ 0u };
        bool           cleanJob{ false };
        std::string    jobIDStr{};

        // SHA256
        algo::hash1024 coinb1{};
        algo::hash2048 coinb2{};
        algo::hash256  merkletree[12]{};

        // ETHASH && PROGPOW
        uint32_t       extraNonceSize{ 0u };
        uint32_t       extraNonce2Size{ 0u };

        StratumJobInfo(StratumJobInfo&& obj) = delete;
        StratumJobInfo& operator=(StratumJobInfo&& obj) = delete;

        StratumJobInfo() = default;
        ~StratumJobInfo() = default;

        StratumJobInfo(StratumJobInfo const& obj);
        StratumJobInfo& operator=(StratumJobInfo const& obj);

        void copy(StratumJobInfo const& obj);
    };
}

variable for sha256 will not use during compute progpow.

We need new pattern for it.

Solutions ?
1)
Add std::optional for all variable expect common variable.

Implemente inheritance, but this I will create a lot of cast.

Using component, example std::unordered_map<uint32_t, Component>.

component[COMPONENT_ID] = ComponentHeader;

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions