Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stratum Job Info is so big. #40

Open
luminousmining opened this issue Apr 2, 2024 · 0 comments
Open

Stratum Job Info is so big. #40

luminousmining opened this issue Apr 2, 2024 · 0 comments
Labels
enhancement New feature or request help wanted Extra attention is needed v1.x

Comments

@luminousmining
Copy link
Owner

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;
@luminousmining luminousmining added v1.x enhancement New feature or request help wanted Extra attention is needed labels Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed v1.x
Projects
None yet
Development

No branches or pull requests

1 participant