lnchan: remove debugging code, commented out code
This commit is contained in:
@@ -147,7 +147,7 @@ class Channel(PrintError):
|
|||||||
except:
|
except:
|
||||||
return super().diagnostic_name()
|
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 = {}
|
self.preimages = {}
|
||||||
if not payment_completed:
|
if not payment_completed:
|
||||||
payment_completed = lambda this, x, y, z: None
|
payment_completed = lambda this, x, y, z: None
|
||||||
@@ -205,12 +205,7 @@ class Channel(PrintError):
|
|||||||
for sub in (LOCAL, REMOTE):
|
for sub in (LOCAL, REMOTE):
|
||||||
self.log[sub].locked_in.update(self.log[sub].adds.keys())
|
self.log[sub].locked_in.update(self.log[sub].adds.keys())
|
||||||
|
|
||||||
if local_commitment:
|
self.set_local_commitment(self.current_commitment(LOCAL))
|
||||||
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_remote_commitment(self.current_commitment(REMOTE))
|
self.set_remote_commitment(self.current_commitment(REMOTE))
|
||||||
|
|
||||||
def set_local_commitment(self, ctx):
|
def set_local_commitment(self, ctx):
|
||||||
@@ -781,7 +776,7 @@ class Channel(PrintError):
|
|||||||
serialized_channel[k] = v
|
serialized_channel[k] = v
|
||||||
dumped = ChannelJsonEncoder().encode(serialized_channel)
|
dumped = ChannelJsonEncoder().encode(serialized_channel)
|
||||||
roundtripped = json.loads(dumped)
|
roundtripped = json.loads(dumped)
|
||||||
reconstructed = Channel(roundtripped, local_commitment=self.local_commitment)
|
reconstructed = Channel(roundtripped)
|
||||||
to_save_new = reconstructed.to_save()
|
to_save_new = reconstructed.to_save()
|
||||||
if to_save_new != to_save_ref:
|
if to_save_new != to_save_ref:
|
||||||
from pprint import PrettyPrinter
|
from pprint import PrettyPrinter
|
||||||
@@ -877,7 +872,8 @@ class Channel(PrintError):
|
|||||||
if remote_sig: # only None in test
|
if remote_sig: # only None in test
|
||||||
preimage_hex = tx.serialize_preimage(0)
|
preimage_hex = tx.serialize_preimage(0)
|
||||||
pre_hash = sha256d(bfh(preimage_hex))
|
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):
|
def force_close_tx(self):
|
||||||
tx = self.local_commitment
|
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,
|
per_commitment_secret_seed=seed,
|
||||||
funding_locked_received=True,
|
funding_locked_received=True,
|
||||||
was_announced=False,
|
was_announced=False,
|
||||||
# just a random signature
|
|
||||||
current_commitment_signature=None,
|
current_commitment_signature=None,
|
||||||
current_htlc_signatures=None,
|
current_htlc_signatures=None,
|
||||||
),
|
),
|
||||||
@@ -135,19 +134,6 @@ def create_test_channels(feerate=6000, local=None, remote=None):
|
|||||||
alice.set_state('OPEN')
|
alice.set_state('OPEN')
|
||||||
bob.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
|
return alice, bob
|
||||||
|
|
||||||
class TestFee(unittest.TestCase):
|
class TestFee(unittest.TestCase):
|
||||||
|
|||||||
Reference in New Issue
Block a user