-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #208 from kcalvinalvin/2024-11-01-update-mempool-f…
…rom-btcd mempool, btcd, btcjson, rpcclient: pull in mempool PRs from btcd
- Loading branch information
Showing
21 changed files
with
1,669 additions
and
403 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
package mempool | ||
|
||
import ( | ||
"time" | ||
|
||
"github.com/utreexo/utreexod/btcjson" | ||
"github.com/utreexo/utreexod/btcutil" | ||
"github.com/utreexo/utreexod/chaincfg/chainhash" | ||
"github.com/utreexo/utreexod/wire" | ||
) | ||
|
||
// TxMempool defines an interface that's used by other subsystems to interact | ||
// with the mempool. | ||
type TxMempool interface { | ||
// LastUpdated returns the last time a transaction was added to or | ||
// removed from the source pool. | ||
LastUpdated() time.Time | ||
|
||
// TxDescs returns a slice of descriptors for all the transactions in | ||
// the pool. | ||
TxDescs() []*TxDesc | ||
|
||
// RawMempoolVerbose returns all the entries in the mempool as a fully | ||
// populated btcjson result. | ||
RawMempoolVerbose() map[string]*btcjson.GetRawMempoolVerboseResult | ||
|
||
// Count returns the number of transactions in the main pool. It does | ||
// not include the orphan pool. | ||
Count() int | ||
|
||
// FetchTransaction returns the requested transaction from the | ||
// transaction pool. This only fetches from the main transaction pool | ||
// and does not include orphans. | ||
FetchTransaction(txHash *chainhash.Hash) (*btcutil.Tx, error) | ||
|
||
// HaveTransaction returns whether or not the passed transaction | ||
// already exists in the main pool or in the orphan pool. | ||
HaveTransaction(hash *chainhash.Hash) bool | ||
|
||
// ProcessTransaction is the main workhorse for handling insertion of | ||
// new free-standing transactions into the memory pool. It includes | ||
// functionality such as rejecting duplicate transactions, ensuring | ||
// transactions follow all rules, orphan transaction handling, and | ||
// insertion into the memory pool. | ||
// | ||
// It returns a slice of transactions added to the mempool. When the | ||
// error is nil, the list will include the passed transaction itself | ||
// along with any additional orphan transactions that were added as a | ||
// result of the passed one being accepted. | ||
ProcessTransaction(tx *btcutil.Tx, allowOrphan, | ||
rateLimit bool, tag Tag) ([]*TxDesc, error) | ||
|
||
// RemoveTransaction removes the passed transaction from the mempool. | ||
// When the removeRedeemers flag is set, any transactions that redeem | ||
// outputs from the removed transaction will also be removed | ||
// recursively from the mempool, as they would otherwise become | ||
// orphans. | ||
RemoveTransaction(tx *btcutil.Tx, removeRedeemers bool) | ||
|
||
// CheckMempoolAcceptance behaves similarly to bitcoind's | ||
// `testmempoolaccept` RPC method. It will perform a series of checks | ||
// to decide whether this transaction can be accepted to the mempool. | ||
// If not, the specific error is returned and the caller needs to take | ||
// actions based on it. | ||
CheckMempoolAcceptance(tx *btcutil.Tx) (*MempoolAcceptResult, error) | ||
|
||
// CheckSpend checks whether the passed outpoint is already spent by | ||
// a transaction in the mempool. If that's the case the spending | ||
// transaction will be returned, if not nil will be returned. | ||
CheckSpend(op wire.OutPoint) *btcutil.Tx | ||
} |
Oops, something went wrong.