See suggested improvements here: https://github.com/ElementsProject/libwally-core/pull/349#issuecomment-1326916051