input: add new Preimage method to input.Input

In this commit, we add a new method to obtain an option of a preimage to
the input.Input struct. This is useful for callers that have an Input,
and want to optionally obtain the preimage.
This commit is contained in:
Olaoluwa Osuntokun
2024-10-15 19:17:06 -07:00
committed by Oliver Gugger
parent e3eef0adff
commit 413fdaf3fb
3 changed files with 46 additions and 1 deletions

View File

@@ -1160,6 +1160,11 @@ func (bo *breachedOutput) SignDesc() *input.SignDescriptor {
return &bo.signDesc
}
// Preimage returns the preimage that was used to create the breached output.
func (bo *breachedOutput) Preimage() fn.Option[lntypes.Preimage] {
return fn.None[lntypes.Preimage]()
}
// CraftInputScript computes a valid witness that allows us to spend from the
// breached output. It does so by first generating and memoizing the witness
// generation function, which parameterized primarily by the witness type and