github.com/BlockABC/godash@v0.0.0-20191112120524-f4aa3a32c566/mining/mining.go (about)

     1  // Copyright (c) 2014-2015 The btcsuite developers
     2  // Copyright (c) 2016 The Dash developers
     3  // Use of this source code is governed by an ISC
     4  // license that can be found in the LICENSE file.
     5  
     6  package mining
     7  
     8  import (
     9  	"time"
    10  
    11  	"github.com/BlockABC/godash/wire"
    12  	"github.com/BlockABC/godashutil"
    13  )
    14  
    15  // TxDesc is a descriptor about a transaction in a transaction source along with
    16  // additional metadata.
    17  type TxDesc struct {
    18  	// Tx is the transaction associated with the entry.
    19  	Tx *godashutil.Tx
    20  
    21  	// Added is the time when the entry was added to the source pool.
    22  	Added time.Time
    23  
    24  	// Height is the block height when the entry was added to the the source
    25  	// pool.
    26  	Height int32
    27  
    28  	// Fee is the total fee the transaction associated with the entry pays.
    29  	Fee int64
    30  }
    31  
    32  // TxSource represents a source of transactions to consider for inclusion in
    33  // new blocks.
    34  //
    35  // The interface contract requires that all of these methods are safe for
    36  // concurrent access with respect to the source.
    37  type TxSource interface {
    38  	// LastUpdated returns the last time a transaction was added to or
    39  	// removed from the source pool.
    40  	LastUpdated() time.Time
    41  
    42  	// MiningDescs returns a slice of mining descriptors for all the
    43  	// transactions in the source pool.
    44  	MiningDescs() []*TxDesc
    45  
    46  	// HaveTransaction returns whether or not the passed transaction hash
    47  	// exists in the source pool.
    48  	HaveTransaction(hash *wire.ShaHash) bool
    49  }