multi: make input.OutPoint return wire.OutPoint

This commit is contained in:
yyforyongyu
2024-03-27 17:07:48 +08:00
parent fce86f9b22
commit e771993785
21 changed files with 136 additions and 134 deletions

View File

@@ -9,6 +9,9 @@ import (
"github.com/lightningnetwork/lnd/lntypes"
)
// EmptyOutPoint is a zeroed outpoint.
var EmptyOutPoint wire.OutPoint
// Input represents an abstract UTXO which is to be spent using a sweeping
// transaction. The method provided give the caller all information needed to
// construct a valid input within a sweeping transaction to sweep this
@@ -16,7 +19,7 @@ import (
type Input interface {
// Outpoint returns the reference to the output being spent, used to
// construct the corresponding transaction input.
OutPoint() *wire.OutPoint
OutPoint() wire.OutPoint
// RequiredTxOut returns a non-nil TxOut if input commits to a certain
// transaction output. This is used in the SINGLE|ANYONECANPAY case to
@@ -107,8 +110,8 @@ type inputKit struct {
// OutPoint returns the breached output's identifier that is to be included as
// a transaction input.
func (i *inputKit) OutPoint() *wire.OutPoint {
return &i.outpoint
func (i *inputKit) OutPoint() wire.OutPoint {
return i.outpoint
}
// RequiredTxOut returns a nil for the base input type.

View File

@@ -23,15 +23,11 @@ var _ Input = (*MockInput)(nil)
// Outpoint returns the reference to the output being spent, used to construct
// the corresponding transaction input.
func (m *MockInput) OutPoint() *wire.OutPoint {
func (m *MockInput) OutPoint() wire.OutPoint {
args := m.Called()
op := args.Get(0)
if op == nil {
return nil
}
return op.(*wire.OutPoint)
return op.(wire.OutPoint)
}
// RequiredTxOut returns a non-nil TxOut if input commits to a certain

View File

@@ -43,7 +43,7 @@ func MultiPrevOutFetcher(inputs []Input) (*txscript.MultiPrevOutFetcher, error)
op := inp.OutPoint()
desc := inp.SignDesc()
if op == nil {
if op == EmptyOutPoint {
return nil, fmt.Errorf("missing input outpoint")
}
@@ -51,7 +51,7 @@ func MultiPrevOutFetcher(inputs []Input) (*txscript.MultiPrevOutFetcher, error)
return nil, fmt.Errorf("missing input utxo information")
}
fetcher.AddPrevOut(*op, desc.Output)
fetcher.AddPrevOut(op, desc.Output)
}
return fetcher, nil