Skip to content

Commit

Permalink
Increase rounds in TestEstimateFeeRollback to test dropping txs that …
Browse files Browse the repository at this point in the history
…have been in the mempool too long.
  • Loading branch information
Daniel Krawisz committed Oct 19, 2016
1 parent 4279c60 commit d27bed7
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion mempool/estimatefee_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,15 @@ func newTestFeeEstimator(binSize, maxReplacements, maxRollback uint32) *FeeEstim
}
}

// lastBlock is a linked list of the block hashes which have been
// processed by the test FeeEstimator.
type lastBlock struct {
hash *chainhash.Hash
prev *lastBlock
}

// estimateFeeTester interacts with the FeeEstimator to keep track
// of its expected state.
type estimateFeeTester struct {
ef *FeeEstimator
t *testing.T
Expand Down Expand Up @@ -91,6 +95,7 @@ func (eft *estimateFeeTester) rollback() {
eft.last = eft.last.prev
}

// TestEstimateFee tests basic functionality in the FeeEstimator.
func TestEstimateFee(t *testing.T) {
ef := newTestFeeEstimator(5, 3, 1)
eft := estimateFeeTester{ef: ef, t: t}
Expand Down Expand Up @@ -315,13 +320,15 @@ func (eft *estimateFeeTester) round(txHistory [][]*TxDesc,
return append(txHistory, newTxs), append(estimateHistory, estimates)
}

// TestEstimateFeeRollback tests the rollback function, which undoes the
// effect of a adding a new block.
func TestEstimateFeeRollback(t *testing.T) {
txPerRound := uint32(7)
txPerBlock := uint32(5)
binSize := uint32(6)
maxReplacements := uint32(4)
stepsBack := 2
rounds := 1 //8
rounds := 30

eft := estimateFeeTester{ef: newTestFeeEstimator(binSize, maxReplacements, uint32(stepsBack)), t: t}
var txHistory [][]*TxDesc
Expand Down

0 comments on commit d27bed7

Please sign in to comment.