|
|
@ -37,8 +37,7 @@ from .lnutil import (Outpoint, LocalConfig, RECEIVED, UpdateAddHtlc, |
|
|
|
LOCAL, REMOTE, HTLCOwner, |
|
|
|
ln_compare_features, privkey_to_pubkey, MIN_FINAL_CLTV_EXPIRY_ACCEPTED, |
|
|
|
LightningPeerConnectionClosed, HandshakeFailed, |
|
|
|
RemoteMisbehaving, |
|
|
|
NBLOCK_OUR_CLTV_EXPIRY_DELTA, ShortChannelID, |
|
|
|
RemoteMisbehaving, ShortChannelID, |
|
|
|
IncompatibleLightningFeatures, derive_payment_secret_from_payment_preimage, |
|
|
|
LN_MAX_FUNDING_SAT, calc_fees_for_commitment_tx, |
|
|
|
UpfrontShutdownScriptViolation) |
|
|
@ -1363,7 +1362,7 @@ class Peer(Logger): |
|
|
|
next_cltv_expiry = processed_onion.hop_data.payload["outgoing_cltv_value"]["outgoing_cltv_value"] |
|
|
|
except: |
|
|
|
raise OnionRoutingFailure(code=OnionFailureCode.INVALID_ONION_PAYLOAD, data=b'\x00\x00\x00') |
|
|
|
if htlc.cltv_expiry - next_cltv_expiry < NBLOCK_OUR_CLTV_EXPIRY_DELTA: |
|
|
|
if htlc.cltv_expiry - next_cltv_expiry < next_chan.forwarding_cltv_expiry_delta: |
|
|
|
data = htlc.cltv_expiry.to_bytes(4, byteorder="big") + outgoing_chan_upd_len + outgoing_chan_upd |
|
|
|
raise OnionRoutingFailure(code=OnionFailureCode.INCORRECT_CLTV_EXPIRY, data=data) |
|
|
|
if htlc.cltv_expiry - lnutil.MIN_FINAL_CLTV_EXPIRY_ACCEPTED <= local_height \ |
|
|
@ -1378,8 +1377,8 @@ class Peer(Logger): |
|
|
|
raise OnionRoutingFailure(code=OnionFailureCode.INVALID_ONION_PAYLOAD, data=b'\x00\x00\x00') |
|
|
|
forwarding_fees = fee_for_edge_msat( |
|
|
|
forwarded_amount_msat=next_amount_msat_htlc, |
|
|
|
fee_base_msat=lnutil.OUR_FEE_BASE_MSAT, |
|
|
|
fee_proportional_millionths=lnutil.OUR_FEE_PROPORTIONAL_MILLIONTHS) |
|
|
|
fee_base_msat=next_chan.forwarding_fee_base_msat, |
|
|
|
fee_proportional_millionths=next_chan.forwarding_fee_proportional_millionths) |
|
|
|
if htlc.amount_msat - next_amount_msat_htlc < forwarding_fees: |
|
|
|
data = next_amount_msat_htlc.to_bytes(8, byteorder="big") + outgoing_chan_upd_len + outgoing_chan_upd |
|
|
|
raise OnionRoutingFailure(code=OnionFailureCode.FEE_INSUFFICIENT, data=data) |
|
|
|