mit-dci / utreexo

accumulator for bitcoin utxo set
MIT License
323 stars 60 forks source link

Don't ignore returned error in genproofs #301

Closed kcalvinalvin closed 3 years ago

kcalvinalvin commented 3 years ago

https://github.com/mit-dci/utreexo/blob/80da33426dc3a90d2ea53f1e2f10e3dd9ef0fa1d/bridgenode/genproofs.go#L62-L65

We're overwriting the error here and not returning what's actually the problem. Don't do that.

sloorush commented 3 years ago

Should it just return the err, or Is there a way to find out explicitly when the -datadir argument is incorrectly given?

Or should it be a more generalized message like

initialization error. Please verify config.\n%s\n
If your .blk and .dat files are "+ 
"not in %s, specify alternate path with -datadir\n.", err, cfg.BlockDir
kcalvinalvin commented 3 years ago

It should just return the error since InitBridgeNodeState() returns explicit error messages.

EDIT: Or no maybe something like

returnErr := fmt.Errorf("initialization error: %s. If your .blk and .dat files are not in %s, specify alternate path with -datadir\n.", err.String(), cfg.BlockDir)
return returnErr
sloorush commented 3 years ago

Cool! I'll take this up. 🤖