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 committed 2021-06-29 20:25:47 +08:00
1 parent 391f240ccb
commit 0dc3190fec
2 files changed
+79 -3

No files matched your search

+9 -1
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,