btcsuite / btcutil

Provides bitcoin-specific convenience functions and types
479 stars 409 forks source link

Is the algorithm testing the derived child point is at infinity right? #117

Closed ruoshan closed 2 years ago

ruoshan commented 6 years ago

https://github.com/btcsuite/btcutil/blob/06f32abe079c0670ea6adf08f41754ef36063a72/hdkeychain/extendedkey.go#L304

According to the BIP32, should we test the childX and childY instead of the above code? I don't know much about the secp256k1 curve, I am confused about how to testing whether or not the point is at finity, in btcec pkg, it's tested by X.Sign() == 0 && Y.Sign() == 0, but here, it's tested by X.Sign() == 0 || Y.Sign() ==0, why the OR logic not AND?

Roasbeef commented 2 years ago

The new version of this routine looks like: https://github.com/btcsuite/btcd/blob/master/btcutil/hdkeychain/extendedkey.go#L343