1
0

ln update_fee: enforce that feerate is over default min relay fee

(this was always already the case when we are the funder, but we were
not checking it when remote is responsible for update_fee)
This commit is contained in:
SomberNight
2021-09-24 20:13:58 +02:00
parent 4af103378a
commit 1ff9f9910f
5 changed files with 15 additions and 2 deletions

View File

@@ -61,6 +61,7 @@ from .address_synchronizer import TX_HEIGHT_LOCAL
from .lnutil import CHANNEL_OPENING_TIMEOUT
from .lnutil import ChannelBackupStorage, ImportedChannelBackupStorage, OnchainChannelBackupStorage
from .lnutil import format_short_channel_id
from .simple_config import FEERATE_PER_KW_MIN_RELAY_LIGHTNING
if TYPE_CHECKING:
from .lnworker import LNWallet
@@ -1346,6 +1347,8 @@ class Channel(AbstractChannel):
# feerate uses sat/kw
if self.constraints.is_initiator != from_us:
raise Exception(f"Cannot update_fee: wrong initiator. us: {from_us}")
if feerate < FEERATE_PER_KW_MIN_RELAY_LIGHTNING:
raise Exception(f"Cannot update_fee: feerate lower than min relay fee. {feerate} sat/kw. us: {from_us}")
sender = LOCAL if from_us else REMOTE
ctx_owner = -sender
ctn = self.get_next_ctn(ctx_owner)