contractcourt: update TestChannelArbitratorAnchors

This commit adds a deadline field to mockSweeper that can be used to
track the customized conf target (deadline) used for sweeping anchors.
The relevant test, TestChannelArbitratorAnchors is updated to reflect
that the deadlines are indeed taking effect.
This commit is contained in:
yyforyongyu
2021-05-11 20:57:31 +08:00
parent 391f240ccb
commit 0dc3190fec
2 changed files with 79 additions and 3 deletions

View File

@@ -108,14 +108,17 @@ type mockSweeper struct {
sweepTx *wire.MsgTx
sweepErr error
createSweepTxChan chan *wire.MsgTx
deadlines []uint32
}
func newMockSweeper() *mockSweeper {
return &mockSweeper{
sweptInputs: make(chan input.Input),
sweptInputs: make(chan input.Input, 3),
updatedInputs: make(chan wire.OutPoint),
sweepTx: &wire.MsgTx{},
createSweepTxChan: make(chan *wire.MsgTx),
deadlines: []uint32{},
}
}
@@ -124,6 +127,11 @@ func (s *mockSweeper) SweepInput(input input.Input, params sweep.Params) (
s.sweptInputs <- input
// Update the deadlines used if it's set.
if params.Fee.ConfTarget != 0 {
s.deadlines = append(s.deadlines, params.Fee.ConfTarget)
}
result := make(chan sweep.Result, 1)
result <- sweep.Result{
Tx: s.sweepTx,