chainntnfs/bitcoindnotify: fix possible panic with lack of txindex
In this commit, we fix a recently introduced bug which can result in a panic when bitcoind nodes without a txindex active are started. The issue was that we would still defence the transaction's blockhash, which would be nil if we detected that the backend didn't have the txindex active.
This commit is contained in:
parent
188b8462cd
commit
005510b54f
@ -616,13 +616,10 @@ func (b *BitcoindNotifier) RegisterSpendNtfn(outpoint *wire.OutPoint,
|
||||
// of a race condition, wherein the output itself is unspent,
|
||||
// and only arrives in the mempool after the getxout call.
|
||||
if blockHash != nil {
|
||||
startHash, err := chainhash.NewHashFromStr(tx.BlockHash)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Rescan all the blocks until the current one.
|
||||
startHeight, err := b.chainConn.GetBlockHeight(startHash)
|
||||
startHeight, err := b.chainConn.GetBlockHeight(
|
||||
blockHash,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user