input: refactor all inputs to use MakeBaseInput, add opts

In this commit, we refactor all the other constructors for the input to
use MakeBaseInput. We also add a new set of functional options as well.
This'll be useful later on to ensure that new options are properly
applied to all the input types.
This commit is contained in:
Olaoluwa Osuntokun
2024-06-03 23:02:40 -07:00
parent e0ced8e629
commit 3f50339898
2 changed files with 104 additions and 81 deletions

View File

@@ -8,8 +8,10 @@ import (
"github.com/btcsuite/btcd/btcec/v2/schnorr/musig2"
"github.com/btcsuite/btcd/txscript"
"github.com/btcsuite/btcd/wire"
"github.com/lightningnetwork/lnd/fn"
"github.com/lightningnetwork/lnd/keychain"
"github.com/lightningnetwork/lnd/lntypes"
"github.com/lightningnetwork/lnd/tlv"
"github.com/stretchr/testify/mock"
)
@@ -127,6 +129,17 @@ func (m *MockInput) UnconfParent() *TxInfo {
return info.(*TxInfo)
}
func (m *MockInput) ResolutionBlob() fn.Option[tlv.Blob] {
args := m.Called()
info := args.Get(0)
if info == nil {
return fn.None[tlv.Blob]()
}
return info.(fn.Option[tlv.Blob])
}
// MockWitnessType implements the `WitnessType` interface and is used by other
// packages for mock testing.
type MockWitnessType struct {