[Lib] Fix for spesmilo#5366 which also affects EC: partial txn ser. overflow
[Lib] Fix for spesmilo#5366 which also affects EC: partial txn ser. overflow

Serialization format we use for partial txn's encodes xpub for
derivation path only uses 2 bytes.  It's possible to have a wallet with
>65535 addresses. At that point this serialization scheme fails.

This code handles address indices >65535 in derivation path.

Taken verbatim from spesmilo#5367, commit 6ad24ea3b3ee4e497240447d5865f184aa1efc9a

fyookball/electrum,fyookball/electrum,fyookball/electrum