mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-09-02 18:25:21 +00:00
lnchan: remove debugging code, commented out code
This commit is contained in:
parent
2323118bda
commit
06d4224101
2 changed files with 5 additions and 23 deletions
|
@ -147,7 +147,7 @@ class Channel(PrintError):
|
|||
except:
|
||||
return super().diagnostic_name()
|
||||
|
||||
def __init__(self, state, sweep_address = None, name = None, payment_completed : Optional[Callable[[HTLCOwner, UpdateAddHtlc, bytes], None]] = None, local_commitment = None):
|
||||
def __init__(self, state, sweep_address = None, name = None, payment_completed : Optional[Callable[[HTLCOwner, UpdateAddHtlc, bytes], None]] = None):
|
||||
self.preimages = {}
|
||||
if not payment_completed:
|
||||
payment_completed = lambda this, x, y, z: None
|
||||
|
@ -205,12 +205,7 @@ class Channel(PrintError):
|
|||
for sub in (LOCAL, REMOTE):
|
||||
self.log[sub].locked_in.update(self.log[sub].adds.keys())
|
||||
|
||||
if local_commitment:
|
||||
local_commitment = Transaction(str(local_commitment))
|
||||
local_commitment.deserialize(True)
|
||||
self.set_local_commitment(local_commitment)
|
||||
else:
|
||||
self.set_local_commitment(self.current_commitment(LOCAL))
|
||||
self.set_local_commitment(self.current_commitment(LOCAL))
|
||||
self.set_remote_commitment(self.current_commitment(REMOTE))
|
||||
|
||||
def set_local_commitment(self, ctx):
|
||||
|
@ -781,7 +776,7 @@ class Channel(PrintError):
|
|||
serialized_channel[k] = v
|
||||
dumped = ChannelJsonEncoder().encode(serialized_channel)
|
||||
roundtripped = json.loads(dumped)
|
||||
reconstructed = Channel(roundtripped, local_commitment=self.local_commitment)
|
||||
reconstructed = Channel(roundtripped)
|
||||
to_save_new = reconstructed.to_save()
|
||||
if to_save_new != to_save_ref:
|
||||
from pprint import PrettyPrinter
|
||||
|
@ -877,7 +872,8 @@ class Channel(PrintError):
|
|||
if remote_sig: # only None in test
|
||||
preimage_hex = tx.serialize_preimage(0)
|
||||
pre_hash = sha256d(bfh(preimage_hex))
|
||||
assert ecc.verify_signature(self.config[REMOTE].multisig_key.pubkey, remote_sig, pre_hash)
|
||||
if not ecc.verify_signature(self.config[REMOTE].multisig_key.pubkey, remote_sig, pre_hash):
|
||||
self.print_error("WARNING: commitment signature inconsistency, cannot force close")
|
||||
|
||||
def force_close_tx(self):
|
||||
tx = self.local_commitment
|
||||
|
|
|
@ -82,7 +82,6 @@ def create_channel_state(funding_txid, funding_index, funding_sat, local_feerate
|
|||
per_commitment_secret_seed=seed,
|
||||
funding_locked_received=True,
|
||||
was_announced=False,
|
||||
# just a random signature
|
||||
current_commitment_signature=None,
|
||||
current_htlc_signatures=None,
|
||||
),
|
||||
|
@ -135,19 +134,6 @@ def create_test_channels(feerate=6000, local=None, remote=None):
|
|||
alice.set_state('OPEN')
|
||||
bob.set_state('OPEN')
|
||||
|
||||
#old_bob = bob.config[REMOTE]
|
||||
#bob.config[REMOTE] = bob.config[REMOTE]._replace(ctn=bob.config[REMOTE].ctn)
|
||||
#sig_from_bob = bob.sign_next_commitment()[0]
|
||||
#bob.config[REMOTE] = old_bob
|
||||
|
||||
#old_alice = alice.config[REMOTE]
|
||||
#alice.config[REMOTE] = alice.config[REMOTE]._replace(ctn=alice.config[REMOTE].ctn)
|
||||
#sig_from_alice = alice.sign_next_commitment()[0]
|
||||
#alice.config[REMOTE] = old_alice
|
||||
|
||||
#alice.config[LOCAL] = alice.config[LOCAL]._replace(current_commitment_signature=sig_from_bob)
|
||||
#bob.config[LOCAL] = bob.config[LOCAL]._replace(current_commitment_signature=sig_from_alice)
|
||||
|
||||
return alice, bob
|
||||
|
||||
class TestFee(unittest.TestCase):
|
||||
|
|
Loading…
Add table
Reference in a new issue