btcsuite / btcutil

Provides bitcoin-specific convenience functions and types
480 stars 410 forks source link

Fix nil pointer dereference when WitnessHash is called before HasWitness #165

Closed onyb closed 4 years ago

onyb commented 4 years ago

If the witness hash is populated in the cache before the HasWitness method is invoked, it results in a nil pointer deference.

Added a breaking test that reproduces the behaviour; then a few assertions using dummy witness data.

Issue: btcsuite/btcd#1543 Related PR: btcsuite/btcutil#156