2016-08-08 21:04:33 +02:00
|
|
|
// Copyright (c) 2014-2016 The btcsuite developers
|
2015-11-25 23:27:14 +01:00
|
|
|
// Use of this source code is governed by an ISC
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
package mining
|
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
|
2016-08-08 21:04:33 +02:00
|
|
|
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
2015-11-25 23:27:14 +01:00
|
|
|
"github.com/btcsuite/btcutil"
|
|
|
|
)
|
|
|
|
|
|
|
|
// TxDesc is a descriptor about a transaction in a transaction source along with
|
|
|
|
// additional metadata.
|
|
|
|
type TxDesc struct {
|
|
|
|
// Tx is the transaction associated with the entry.
|
|
|
|
Tx *btcutil.Tx
|
|
|
|
|
|
|
|
// Added is the time when the entry was added to the source pool.
|
|
|
|
Added time.Time
|
|
|
|
|
|
|
|
// Height is the block height when the entry was added to the the source
|
|
|
|
// pool.
|
|
|
|
Height int32
|
|
|
|
|
|
|
|
// Fee is the total fee the transaction associated with the entry pays.
|
|
|
|
Fee int64
|
|
|
|
}
|
|
|
|
|
|
|
|
// TxSource represents a source of transactions to consider for inclusion in
|
|
|
|
// new blocks.
|
|
|
|
//
|
|
|
|
// The interface contract requires that all of these methods are safe for
|
|
|
|
// concurrent access with respect to the source.
|
|
|
|
type TxSource interface {
|
|
|
|
// LastUpdated returns the last time a transaction was added to or
|
|
|
|
// removed from the source pool.
|
|
|
|
LastUpdated() time.Time
|
|
|
|
|
|
|
|
// MiningDescs returns a slice of mining descriptors for all the
|
|
|
|
// transactions in the source pool.
|
|
|
|
MiningDescs() []*TxDesc
|
|
|
|
|
|
|
|
// HaveTransaction returns whether or not the passed transaction hash
|
|
|
|
// exists in the source pool.
|
2016-08-08 21:04:33 +02:00
|
|
|
HaveTransaction(hash *chainhash.Hash) bool
|
2015-11-25 23:27:14 +01:00
|
|
|
}
|