mirror of
https://github.com/aljazceru/breez-lnd.git
synced 2026-01-06 07:54:24 +01:00
lnwallet: add function to locate script index to script_utils.go
This commit is contained in:
@@ -83,3 +83,19 @@ func spendMultiSig(redeemScript, sigA, sigB []byte) ([]byte, error) {
|
|||||||
// that's all, get bytes
|
// that's all, get bytes
|
||||||
return bldr.Script()
|
return bldr.Script()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// findScriptOutputIndex...
|
||||||
|
// only finds first matchin, assumes unique pkScripts
|
||||||
|
func findScriptOutputIndex(tx *wire.MsgTx, script []byte) (bool, uint32) {
|
||||||
|
found := false
|
||||||
|
index := uint32(0)
|
||||||
|
for i, txOut := range tx.TxOut {
|
||||||
|
if bytes.Equal(txOut.PkScript, script) {
|
||||||
|
found = true
|
||||||
|
index = uint32(i)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return found, index
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user