[backport#14690] Throw error if CPubKey is invalid during PSBT keypath serialization
Summary:
Related to #14689
We should catch this error before attempting to deserialize it later.
Depends on D6029
This is a backport of Core PR14690
Test Plan:
cmake .. -GNinja -DENABLE_WERROR=ON ninja check-all
Reviewers: #bitcoin_abc, deadalnix
Reviewed By: #bitcoin_abc, deadalnix
Differential Revision: https://reviews.bitcoinabc.org/D6030