mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-08 14:57:38 +02:00
chainntnfs: return an error when witness stack is empty
This commit adds a check when receiving transactions from `BitcoindClient` so an error is returned when empty witness is found.
This commit is contained in:
@@ -74,6 +74,11 @@ var (
|
||||
// out of range.
|
||||
ErrNumConfsOutOfRange = fmt.Errorf("number of confirmations must be "+
|
||||
"between %d and %d", 1, MaxNumConfs)
|
||||
|
||||
// ErrEmptyWitnessStack is returned when a spending transaction has an
|
||||
// empty witness stack. More details in,
|
||||
// - https://github.com/bitcoin/bitcoin/issues/28730
|
||||
ErrEmptyWitnessStack = errors.New("witness stack is empty")
|
||||
)
|
||||
|
||||
// rescanState indicates the progression of a registration before the notifier
|
||||
@@ -1297,6 +1302,16 @@ func (n *TxNotifier) updateSpendDetails(spendRequest SpendRequest,
|
||||
return nil
|
||||
}
|
||||
|
||||
// Return an error if the witness data is not present in the spending
|
||||
// transaction.
|
||||
//
|
||||
// TODO(yy): maybe we should do a panic here instead to inform the user
|
||||
// to reindex the bitcoind since it's critical error?
|
||||
// panic("Please re-index your bitcoind...")
|
||||
if !details.HasSpenderWitness() {
|
||||
return ErrEmptyWitnessStack
|
||||
}
|
||||
|
||||
// If the historical rescan found the spending transaction for this
|
||||
// request, but it's at a later height than the notifier (this can
|
||||
// happen due to latency with the backend during a reorg), then we'll
|
||||
|
Reference in New Issue
Block a user