lbcd/mempool
Dave Collins 15bace88dc
mempool: Add basic test harness infrastructure.
This adds a basic test harness infrastructure for the mempool package
which aims to make writing tests for it much easier.

The harness provides functionality for creating and signing transactions
as well as a fake chain that provides utxos for use in generating valid
transactions and allows an arbitrary chain height to be set.  In order
to simplify transaction creation, a single signing key and payment
address is used throughout and a convenience type for spendable outputs
is provided.

The harness is initialized with a spendable coinbase output by default
and the fake chain height set to the maturity height needed to ensure
the provided output is in fact spendable as well as a policy that is
suitable for testing.

Since tests are in the same package and each harness provides a unique
pool and fake chain instance, the tests can safely reach into the pool
policy, or any other state, and change it for a given harness without
affecting the others.

In order to be able to make use of the existing blockchain.Viewpoint
type, a Clone method has been to the UtxoEntry type which allows the
fake chain instance to keep a single view with the actual available
unspent utxos while the mempool ends up fetching a subset of the view
with the specifically requested entries cloned.

To demo the harness, this also contains a couple of tests which make use
of it:

- TestSimpleOrphanChain -- Ensures an entire chain of orphans is
  properly accepted and connects up when the missing parent transaction
  is added
- TestOrphanRejects -- Ensure orphans are actually rejected when the
  flag on ProcessTransactions is set to reject them
2016-08-24 10:04:40 -05:00
..
error.go mempool: Refactor mempool code to its own package. (#737) 2016-08-19 11:08:37 -05:00
log.go mempool: Refactor mempool code to its own package. (#737) 2016-08-19 11:08:37 -05:00
mempool.go mempool: unexport the mutex 2016-08-23 14:59:48 -04:00
mempool_test.go mempool: Add basic test harness infrastructure. 2016-08-24 10:04:40 -05:00
policy.go mempool: Refactor mempool code to its own package. (#737) 2016-08-19 11:08:37 -05:00
policy_test.go mempool: Refactor mempool code to its own package. (#737) 2016-08-19 11:08:37 -05:00
README.md mempool: Refactor mempool code to its own package. (#737) 2016-08-19 11:08:37 -05:00

mempool

[Build Status] (https://travis-ci.org/btcsuite/btcd) ![ISC License] (http://img.shields.io/badge/license-ISC-blue.svg) [GoDoc] (http://godoc.org/github.com/btcsuite/btcd/mempool)

Overview

This package is currently a work in progress.

Installation and Updating

$ go get -u github.com/btcsuite/btcd/mempool

License

Package mempool is licensed under the copyfree ISC License.