transaction: rm hardcoded sighash magic numbers
This commit is contained in:
@@ -39,7 +39,7 @@ from .util import bfh, bh2u, chunks, TxMinedInfo
|
||||
from .invoices import PR_PAID
|
||||
from .bitcoin import redeem_script_to_address
|
||||
from .crypto import sha256, sha256d
|
||||
from .transaction import Transaction, PartialTransaction, TxInput
|
||||
from .transaction import Transaction, PartialTransaction, TxInput, Sighash
|
||||
from .logging import Logger
|
||||
from .lnonion import decode_onion_error, OnionFailureCode, OnionRoutingFailure
|
||||
from . import lnutil
|
||||
@@ -1101,7 +1101,7 @@ class Channel(AbstractChannel):
|
||||
data = self.config[LOCAL].current_htlc_signatures
|
||||
htlc_sigs = list(chunks(data, 64))
|
||||
htlc_sig = htlc_sigs[htlc_relative_idx]
|
||||
remote_htlc_sig = ecc.der_sig_from_sig_string(htlc_sig) + b'\x01'
|
||||
remote_htlc_sig = ecc.der_sig_from_sig_string(htlc_sig) + Sighash.to_sigbytes(Sighash.ALL)
|
||||
return remote_htlc_sig
|
||||
|
||||
def revoke_current_commitment(self):
|
||||
@@ -1554,7 +1554,7 @@ class Channel(AbstractChannel):
|
||||
assert self.signature_fits(tx)
|
||||
tx.sign({bh2u(self.config[LOCAL].multisig_key.pubkey): (self.config[LOCAL].multisig_key.privkey, True)})
|
||||
remote_sig = self.config[LOCAL].current_commitment_signature
|
||||
remote_sig = ecc.der_sig_from_sig_string(remote_sig) + b"\x01"
|
||||
remote_sig = ecc.der_sig_from_sig_string(remote_sig) + Sighash.to_sigbytes(Sighash.ALL)
|
||||
tx.add_signature_to_txin(txin_idx=0,
|
||||
signing_pubkey=self.config[REMOTE].multisig_key.pubkey.hex(),
|
||||
sig=remote_sig.hex())
|
||||
|
||||
Reference in New Issue
Block a user