Page MenuHomePhabricator

[mining] Fix sorting of transaction metadata
Open, Needs TriagePublic

Description

Currently, CTOR sorts the transactions after constructing the block. To ensure that the associated fees and sigops are sorted with it, they were wrapped into a single object and stored together in a vector. However, this means that the transactions must be then copied into a CBlock->vtx array afterwards.

This task represents fixing that. There are two possible fixed:

Revert the commit associated with the change in D2047, and use std::sort on a zipped container.

Or:

Make CBlockTemplate inherit from CBlockHeader and fix IncrementExtraNonce to properly handle the CBlockTemplate version of the transaction list. This is possible as well, since once mined the RPC accepts a CBlock properly anyways. IncrementExtraNonce is only used in the generate rpc call, and is used to also produce a correct merkle root.