LearnBitcoin

Bitcoin Dev Archive 2019

Contribution

2 messages, 30 Jan 2019. Started by Antoniy Shumanov.

Antoniy Shumanov, Marco Falke

Permalink Original thread on gnusha.org

Antoniy Shumanov permalink original
Hi, bitcoin devs. I'm working at lbry.io and we stay closely to your core,
i want to discuss what you think about a contribution like:
base_blob and/or base_uint to be derived from std::array to be enabled move
semantics, as well on uint160, uint256, COutPoint.
Another approach that bother me is acquiring / releasing recursive mutex in
a loop, snippet from minig.cpp
while (nHeight < nHeightEnd && !ShutdownRequested())
{
    std::unique_ptr<CBlockTemplate>
pblocktemplate(BlockAssembler(Params()).CreateNewBlock(coinbaseScript->reserveScript));
    CBlock *pblock = &pblocktemplate->block;
    {
        LOCK(cs_main); // <--------- acquiring
        IncrementExtraNonce(pblock, chainActive.Tip(), nExtraNonce);
    } // <-------- release
    std::shared_ptr<const CBlock> shared_pblock =
    std::make_shared<const CBlock>(*pblock);
    if (!ProcessNewBlock(Params(), shared_pblock, true, nullptr)) // <----
acquiring / release again inside
}
Doing it in a loop makes things to be slow down even more, what's idea
behind?
Also consider using of atomic global variable rather than acquiring mutex
again, no?
Did you interested in contribution in these approaches?

Regards Antoniy Shumanov

Marco Falke in reply to Antoniy Shumanov permalink original

This mailing list is for the development of the Bitcoin protocol (see https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev). Code changes to Bitcoin Core can be discussed on https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-core-dev or preferably be submitted to https://github.com/bitcoin/bitcoin/ directly.

-- Marco