mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-05-04 08:50:20 +02:00
chainntnfs: stop lnd
when received witness stack is empty
This commit uses `Criticalf` to gracefully stop `lnd` when the received witness data is empty.
This commit is contained in:
parent
28c3c835bf
commit
ee883c332f
@ -223,11 +223,19 @@ func (m *MempoolNotifier) findRelevantInputs(tx *btcutil.Tx) (inputsWithTx,
|
|||||||
}
|
}
|
||||||
watchedInputs[*op] = details
|
watchedInputs[*op] = details
|
||||||
|
|
||||||
|
// Sanity check the witness stack. If it's not empty, continue
|
||||||
|
// to next iteration.
|
||||||
|
if details.HasSpenderWitness() {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
// Return an error if the witness data is not present in the
|
// Return an error if the witness data is not present in the
|
||||||
// spending transaction.
|
// spending transaction.
|
||||||
if !details.HasSpenderWitness() {
|
Log.Criticalf("Found spending tx for outpoint=%v in mempool, "+
|
||||||
return nil, ErrEmptyWitnessStack
|
"but the transaction %v does not have witness",
|
||||||
}
|
op, details.SpendingTx.TxHash())
|
||||||
|
|
||||||
|
return nil, ErrEmptyWitnessStack
|
||||||
}
|
}
|
||||||
|
|
||||||
return watchedInputs, nil
|
return watchedInputs, nil
|
||||||
|
@ -1305,10 +1305,13 @@ func (n *TxNotifier) updateSpendDetails(spendRequest SpendRequest,
|
|||||||
// Return an error if the witness data is not present in the spending
|
// Return an error if the witness data is not present in the spending
|
||||||
// transaction.
|
// transaction.
|
||||||
//
|
//
|
||||||
// TODO(yy): maybe we should do a panic here instead to inform the user
|
// NOTE: if the witness stack is empty, we will do a critical log which
|
||||||
// to reindex the bitcoind since it's critical error?
|
// shuts down the node.
|
||||||
// panic("Please re-index your bitcoind...")
|
|
||||||
if !details.HasSpenderWitness() {
|
if !details.HasSpenderWitness() {
|
||||||
|
Log.Criticalf("Found spending tx for outpoint=%v, but the "+
|
||||||
|
"transaction %v does not have witness",
|
||||||
|
spendRequest.OutPoint, details.SpendingTx.TxHash())
|
||||||
|
|
||||||
return ErrEmptyWitnessStack
|
return ErrEmptyWitnessStack
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user