fix expiring channels

This commit is contained in:
Jack Robison 2021-07-21 12:53:51 -04:00 committed by Victor Shyba
parent f55b6bdc71
commit fb5c008fc5

View file

@ -643,8 +643,20 @@ class BlockProcessor:
if (tx_num, position) not in self.txo_to_claim: if (tx_num, position) not in self.txo_to_claim:
self._spend_claim_txo(txi, spent_claims) self._spend_claim_txo(txi, spent_claims)
if expired: if expired:
# do this to follow the same content claim removing pathway as if a claim (possible channel) was abandoned # abandon the channels last to handle abandoned signed claims in the same tx,
# see test_abandon_channel_and_claims_in_same_tx
expired_channels = {}
for abandoned_claim_hash, (tx_num, nout, name) in spent_claims.items(): for abandoned_claim_hash, (tx_num, nout, name) in spent_claims.items():
self._abandon_claim(abandoned_claim_hash, tx_num, nout, name)
if name.startswith('@'):
expired_channels[abandoned_claim_hash] = (tx_num, nout, name)
else:
# print(f"\texpire {abandoned_claim_hash.hex()} {tx_num} {nout}")
self._abandon_claim(abandoned_claim_hash, tx_num, nout, name)
# do this to follow the same content claim removing pathway as if a claim (possible channel) was abandoned
for abandoned_claim_hash, (tx_num, nout, name) in expired_channels.items():
# print(f"\texpire {abandoned_claim_hash.hex()} {tx_num} {nout}") # print(f"\texpire {abandoned_claim_hash.hex()} {tx_num} {nout}")
self._abandon_claim(abandoned_claim_hash, tx_num, nout, name) self._abandon_claim(abandoned_claim_hash, tx_num, nout, name)