Why does my c-lightning node pay more than the invoice plus routing fees? A friend sent me an invoice for 500,000 Satoshis. To my surprise, I sent 502294 Satoshis.

Here's what I see from my c-lightning console:


"msatoshi": 500,000,000
"msatoshi_sent": 502,294,595


My friend received a different amount on lnd:


"value": "500000"
"amt_paid_sat": "501791"


Any reasons why I am not sending the amount requested on the invoice? Also is my understanding correct that I paid 503 satoshis in fees for this transaction? It's more than I expected on the lightning network.

Thanks,

Francois
In your c-lightning node you have configured your maximum fee rate which is used by the pay command to do the payment. 

The BOLT04 describes how overpaying up to twice the amount to obfuscate payments in order to have better privacy is part of the protocol: 


  if the amount paid is more than twice the amount expected:
  SHOULD fail the HTLC.
  
  SHOULD return an incorrect_or_unknown_payment_details error.
  
  Note: this allows the origin node to reduce information leakage by altering the amount while not allowing for accidental gross overpayment.


In combination with this merged pull request c-lightning fixed this issue
implementing random overpayments up to the maximum fee rate. 

So generally c-lightning will randomly overpay your transaction with an amount that is lower to the maximum feerate you are willing to pay. 

Not that in earlier days lnd did not accept overpayments as they seemed to not have implemented this part of the protocol.