[prev in list] [next in list] [prev in thread] [next in thread] 

List:       btcd-commits
Subject:    [btcsuite/btcd] 2b6a9a: mempool/mining: Introduce TxSource interface.
From:       Dave Collins <davec () conformal ! com>
Date:       2015-11-27 22:59:30
Message-ID: 5658e052e188b_73cb3fdd99feb29c741ab () hookshot-fe4-cp1-prd ! iad ! github ! net ! mail
[Download RAW message or body]


  Branch: refs/heads/master
  Home:   https://github.com/btcsuite/btcd
  Commit: 2b6a9a56e58efb43eeee86f0be4c6d578a4b3662
      https://github.com/btcsuite/btcd/commit/2b6a9a56e58efb43eeee86f0be4c6d578a4b3662
  Author: Dave Collins <davec@conformal.com>
  Date:   2015-11-25 (Wed, 25 Nov 2015)

  Changed paths:
    M cpuminer.go
    M mempool.go
    M mining.go
    M rpcserver.go

  Log Message:
  -----------
  mempool/mining: Introduce TxSource interface.

This introduces the concept of a new interface named TxSource which aims
to generically provide a concurrent safe source of transactions to be
considered for inclusion in a new block.  This is a step towards
decoupling the mining code from the internals of btcd.  Ultimately the
intent is to create a separate mining package.

The new TxSource interface relies on a new struct named miningTxDesc,
which describes each entry in the transaction source.  Once this code is
refactored into a separate mining package, the mining prefix can simply
be dropped leaving the type exported as mining.TxDesc.

To go along with this, the existing TxDesc type in the mempool has been
renamed to mempoolTxDesc and changed to embed the new miningTxDesc type.
This allows the mempool to efficiently implement the MiningTxDescs
method needed to satisfy the TxSource interface.

This approach effectively separates the direct reliance of the mining
code on the mempool and its data structures.  Even though the memory
pool will still be the default concrete implementation of the interface,
making it an interface offers much more flexibility in terms of testing
and even provides the potential to allow more than one source (perhaps
multiple independent relay networks, for example).

Finally, the memory pool and all of the mining code has been updated to
implement and use the new interface.




[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic