mirror of https://github.com/lightninglabs/loop
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
375 B
Go
21 lines
375 B
Go
5 years ago
|
package client
|
||
|
|
||
|
import (
|
||
|
"errors"
|
||
|
|
||
|
"github.com/btcsuite/btcd/wire"
|
||
|
)
|
||
|
|
||
|
// getTxInputByOutpoint returns a tx input based on a given input outpoint.
|
||
|
func getTxInputByOutpoint(tx *wire.MsgTx, input *wire.OutPoint) (
|
||
|
*wire.TxIn, error) {
|
||
|
|
||
|
for _, in := range tx.TxIn {
|
||
|
if in.PreviousOutPoint == *input {
|
||
|
return in, nil
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return nil, errors.New("input not found")
|
||
|
}
|