Skip to content

Commit

Permalink
tx: fix forkid failing for multisig
Browse files Browse the repository at this point in the history
  • Loading branch information
ramizpolic committed Jul 26, 2020
1 parent 474720e commit 1f0302e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions electrum/transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -1784,7 +1784,7 @@ def serialize_preimage(self, txin_index: int, *,
txin = inputs[txin_index]
nHashType = int_to_hex(self.get_hash_type(), 4)
preimage_script = self.get_preimage_script(txin)
if self.is_segwit_input(txin):
if True or self.is_segwit_input(txin): # force segwit
if bip143_shared_txdigest_fields is None:
bip143_shared_txdigest_fields = self._calc_bip143_shared_txdigest_fields()
hashPrevouts = bip143_shared_txdigest_fields.hashPrevouts
Expand Down Expand Up @@ -1879,7 +1879,8 @@ def update_signatures(self, signatures: Sequence[str]):
for i, txin in enumerate(self.inputs()):
pubkeys = [pk.hex() for pk in txin.pubkeys]
sig = signatures[i]
if bfh(sig) in list(txin.part_sigs.values()):
sig_final = sig + int_to_hex(self.get_sighash(), 1)
if bfh(sig_final) in list(txin.part_sigs.values()):
continue
pre_hash = sha256d(bfh(self.serialize_preimage(i)))
sig_string = ecc.sig_string_from_der_sig(bfh(sig[:-2]))
Expand All @@ -1896,8 +1897,8 @@ def update_signatures(self, signatures: Sequence[str]):
except Exception:
_logger.exception('')
continue
_logger.info(f"adding sig: txin_idx={i}, signing_pubkey={pubkey_hex}, sig={sig}")
self.add_signature_to_txin(txin_idx=i, signing_pubkey=pubkey_hex, sig=sig)
_logger.info(f"adding sig: txin_idx={i}, signing_pubkey={pubkey_hex}, sig={sig_final}")
self.add_signature_to_txin(txin_idx=i, signing_pubkey=pubkey_hex, sig=sig_final)
break
# redo raw
self.invalidate_ser_cache()
Expand Down

0 comments on commit 1f0302e

Please sign in to comment.