cnct: resolve anchors post-confirmation

Sweeping anchors and being able to bump the fee was already added in a
previous commit. This commit extends anchor sweeping with an anchor
resolver object that becomes active after the commitment tx confirms.
At that point, the anchors do not serve the purpose of getting the
commitment tranaction confirmed anymore. It is however still possible to
reclaim some of their value if using a low fee rate.
This commit is contained in:
Joost Jager
2019-11-25 13:17:44 +01:00
parent d84b596f55
commit ea397c9d6e
5 changed files with 282 additions and 6 deletions

View File

@@ -94,12 +94,14 @@ func (i *commitSweepResolverTestContext) waitForResult() {
}
type mockSweeper struct {
sweptInputs chan input.Input
sweptInputs chan input.Input
updatedInputs chan wire.OutPoint
}
func newMockSweeper() *mockSweeper {
return &mockSweeper{
sweptInputs: make(chan input.Input),
sweptInputs: make(chan input.Input),
updatedInputs: make(chan wire.OutPoint),
}
}
@@ -125,6 +127,18 @@ func (s *mockSweeper) RelayFeePerKW() chainfee.SatPerKWeight {
return 253
}
func (s *mockSweeper) UpdateParams(input wire.OutPoint,
params sweep.ParamsUpdate) (chan sweep.Result, error) {
s.updatedInputs <- input
result := make(chan sweep.Result, 1)
result <- sweep.Result{
Tx: &wire.MsgTx{},
}
return result, nil
}
var _ UtxoSweeper = &mockSweeper{}
// TestCommitSweepResolverNoDelay tests resolution of a direct commitment output