Merge pull request #10294 from spesmilo/dust_override
add dust_override to SweepInfo
This commit is contained in:
@@ -43,6 +43,7 @@ class SweepInfo(NamedTuple):
|
|||||||
txin: PartialTxInput
|
txin: PartialTxInput
|
||||||
txout: Optional[PartialTxOutput] # only for first-stage htlc tx
|
txout: Optional[PartialTxOutput] # only for first-stage htlc tx
|
||||||
can_be_batched: bool # todo: this could be more fine-grained
|
can_be_batched: bool # todo: this could be more fine-grained
|
||||||
|
dust_override: bool
|
||||||
|
|
||||||
def is_anchor(self):
|
def is_anchor(self):
|
||||||
return self.name in ['local_anchor', 'remote_anchor']
|
return self.name in ['local_anchor', 'remote_anchor']
|
||||||
@@ -260,6 +261,7 @@ def sweep_their_htlctx_justice(
|
|||||||
txin=txin,
|
txin=txin,
|
||||||
txout=None,
|
txout=None,
|
||||||
can_be_batched=False,
|
can_be_batched=False,
|
||||||
|
dust_override=False,
|
||||||
)
|
)
|
||||||
return index_to_sweepinfo
|
return index_to_sweepinfo
|
||||||
|
|
||||||
@@ -337,6 +339,7 @@ def sweep_our_ctx(
|
|||||||
txin=txin,
|
txin=txin,
|
||||||
txout=None,
|
txout=None,
|
||||||
can_be_batched=True,
|
can_be_batched=True,
|
||||||
|
dust_override=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
# to_local
|
# to_local
|
||||||
@@ -358,6 +361,7 @@ def sweep_our_ctx(
|
|||||||
txin=txin,
|
txin=txin,
|
||||||
txout=None,
|
txout=None,
|
||||||
can_be_batched=True,
|
can_be_batched=True,
|
||||||
|
dust_override=False,
|
||||||
)
|
)
|
||||||
we_breached = ctn < chan.get_oldest_unrevoked_ctn(LOCAL)
|
we_breached = ctn < chan.get_oldest_unrevoked_ctn(LOCAL)
|
||||||
if we_breached:
|
if we_breached:
|
||||||
@@ -398,6 +402,7 @@ def sweep_our_ctx(
|
|||||||
# - in particular, it would be safe to batch htlcs where
|
# - in particular, it would be safe to batch htlcs where
|
||||||
# htlc_direction, htlc.payment_hash, htlc.cltv_abs
|
# htlc_direction, htlc.payment_hash, htlc.cltv_abs
|
||||||
# all match. That is, MPP htlcs for the same payment.
|
# all match. That is, MPP htlcs for the same payment.
|
||||||
|
dust_override=False,
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
# second-stage
|
# second-stage
|
||||||
@@ -420,6 +425,7 @@ def sweep_our_ctx(
|
|||||||
# this is safe to batch, we are the only ones who can spend
|
# this is safe to batch, we are the only ones who can spend
|
||||||
# (assuming we did not broadcast a revoked state)
|
# (assuming we did not broadcast a revoked state)
|
||||||
can_be_batched=True,
|
can_be_batched=True,
|
||||||
|
dust_override=False,
|
||||||
)
|
)
|
||||||
|
|
||||||
# offered HTLCs, in our ctx --> "timeout"
|
# offered HTLCs, in our ctx --> "timeout"
|
||||||
@@ -557,6 +563,7 @@ def sweep_their_ctx_to_remote_backup(
|
|||||||
txin=txin,
|
txin=txin,
|
||||||
txout=None,
|
txout=None,
|
||||||
can_be_batched=True,
|
can_be_batched=True,
|
||||||
|
dust_override=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
# to_remote
|
# to_remote
|
||||||
@@ -577,6 +584,7 @@ def sweep_their_ctx_to_remote_backup(
|
|||||||
txin=txin,
|
txin=txin,
|
||||||
txout=None,
|
txout=None,
|
||||||
can_be_batched=True,
|
can_be_batched=True,
|
||||||
|
dust_override=False,
|
||||||
)
|
)
|
||||||
return txs
|
return txs
|
||||||
|
|
||||||
@@ -634,6 +642,7 @@ def sweep_their_ctx(
|
|||||||
txin=txin,
|
txin=txin,
|
||||||
txout=None,
|
txout=None,
|
||||||
can_be_batched=True,
|
can_be_batched=True,
|
||||||
|
dust_override=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
# to_local is handled by lnwatcher
|
# to_local is handled by lnwatcher
|
||||||
@@ -646,6 +655,7 @@ def sweep_their_ctx(
|
|||||||
txin=txin,
|
txin=txin,
|
||||||
txout=None,
|
txout=None,
|
||||||
can_be_batched=False,
|
can_be_batched=False,
|
||||||
|
dust_override=False,
|
||||||
)
|
)
|
||||||
|
|
||||||
# to_remote
|
# to_remote
|
||||||
@@ -676,6 +686,7 @@ def sweep_their_ctx(
|
|||||||
txin=txin,
|
txin=txin,
|
||||||
txout=None,
|
txout=None,
|
||||||
can_be_batched=True,
|
can_be_batched=True,
|
||||||
|
dust_override=False,
|
||||||
)
|
)
|
||||||
|
|
||||||
# HTLCs
|
# HTLCs
|
||||||
@@ -715,6 +726,7 @@ def sweep_their_ctx(
|
|||||||
txout=None,
|
txout=None,
|
||||||
can_be_batched=False, # both parties can spend
|
can_be_batched=False, # both parties can spend
|
||||||
# (still, in some cases we could batch, see comment in sweep_our_ctx)
|
# (still, in some cases we could batch, see comment in sweep_our_ctx)
|
||||||
|
dust_override=False,
|
||||||
)
|
)
|
||||||
# received HTLCs, in their ctx --> "timeout"
|
# received HTLCs, in their ctx --> "timeout"
|
||||||
# offered HTLCs, in their ctx --> "success"
|
# offered HTLCs, in their ctx --> "success"
|
||||||
|
|||||||
@@ -529,6 +529,7 @@ class SwapManager(Logger):
|
|||||||
txout=None,
|
txout=None,
|
||||||
name=name,
|
name=name,
|
||||||
can_be_batched=can_be_batched,
|
can_be_batched=can_be_batched,
|
||||||
|
dust_override=False,
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
self.wallet.txbatcher.add_sweep_input('swaps', sweep_info)
|
self.wallet.txbatcher.add_sweep_input('swaps', sweep_info)
|
||||||
|
|||||||
@@ -265,7 +265,7 @@ class TxBatch(Logger):
|
|||||||
|
|
||||||
def is_dust(self, sweep_info: SweepInfo) -> bool:
|
def is_dust(self, sweep_info: SweepInfo) -> bool:
|
||||||
"""Can raise NoDynamicFeeEstimates."""
|
"""Can raise NoDynamicFeeEstimates."""
|
||||||
if sweep_info.is_anchor():
|
if sweep_info.dust_override:
|
||||||
return False
|
return False
|
||||||
if sweep_info.txout is not None:
|
if sweep_info.txout is not None:
|
||||||
return False
|
return False
|
||||||
|
|||||||
@@ -86,6 +86,7 @@ SWAP_SWEEP_INFO = SweepInfo(
|
|||||||
txout=None,
|
txout=None,
|
||||||
name='swap claim',
|
name='swap claim',
|
||||||
can_be_batched=True,
|
can_be_batched=True,
|
||||||
|
dust_override=False,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user