contractcourt: test commitment deadline logic

This commit adds two tests to check that a) the correct deadline is used
given different HTLC sets and b) when sweeping anchors the correct
deadlines are used.
This commit is contained in:
yyforyongyu
2021-05-11 21:00:00 +08:00
parent 0dc3190fec
commit 614884dcb8
2 changed files with 252 additions and 3 deletions

View File

@@ -109,7 +109,7 @@ type mockSweeper struct {
sweepErr error
createSweepTxChan chan *wire.MsgTx
deadlines []uint32
deadlines []int
}
func newMockSweeper() *mockSweeper {
@@ -118,7 +118,7 @@ func newMockSweeper() *mockSweeper {
updatedInputs: make(chan wire.OutPoint),
sweepTx: &wire.MsgTx{},
createSweepTxChan: make(chan *wire.MsgTx),
deadlines: []uint32{},
deadlines: []int{},
}
}
@@ -129,7 +129,7 @@ func (s *mockSweeper) SweepInput(input input.Input, params sweep.Params) (
// Update the deadlines used if it's set.
if params.Fee.ConfTarget != 0 {
s.deadlines = append(s.deadlines, params.Fee.ConfTarget)
s.deadlines = append(s.deadlines, int(params.Fee.ConfTarget))
}
result := make(chan sweep.Result, 1)