mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-19 20:15:18 +02:00
chainntnfs/txnotifier: stricter confirmation matching via scripts
This commit is contained in:
@@ -192,18 +192,22 @@ func (r ConfRequest) ConfHintKey() ([]byte, error) {
|
|||||||
// the outputs of the transaction to determine if it matches. Otherwise, we'll
|
// the outputs of the transaction to determine if it matches. Otherwise, we'll
|
||||||
// match on the txid.
|
// match on the txid.
|
||||||
func (r ConfRequest) MatchesTx(tx *wire.MsgTx) bool {
|
func (r ConfRequest) MatchesTx(tx *wire.MsgTx) bool {
|
||||||
if r.TxID != ZeroHash {
|
scriptMatches := func() bool {
|
||||||
return r.TxID == tx.TxHash()
|
pkScript := r.PkScript.Script()
|
||||||
}
|
for _, txOut := range tx.TxOut {
|
||||||
|
if bytes.Equal(txOut.PkScript, pkScript) {
|
||||||
pkScript := r.PkScript.Script()
|
return true
|
||||||
for _, txOut := range tx.TxOut {
|
}
|
||||||
if bytes.Equal(txOut.PkScript, pkScript) {
|
|
||||||
return true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
return false
|
if r.TxID != ZeroHash {
|
||||||
|
return r.TxID == tx.TxHash() && scriptMatches()
|
||||||
|
}
|
||||||
|
|
||||||
|
return scriptMatches()
|
||||||
}
|
}
|
||||||
|
|
||||||
// ConfNtfn represents a notifier client's request to receive a notification
|
// ConfNtfn represents a notifier client's request to receive a notification
|
||||||
|
Reference in New Issue
Block a user