fix expiring channels

This commit is contained in:
Jack Robison 2021-07-21 12:53:51 -04:00
parent c26a99e65c
commit c28aae9913
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2

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)