Calculate a forwarding fee from a directional channel update
A public Lightning channel can advertise different fees in its two directions. Selecting a channel ID alone is insufficient for a forwarding quote.
Choose the forwarding source
Set SCID to the short channel ID and SOURCE to the public key of the node forwarding into that channel. The filter selects that node's advertised policy.
lightning-cli listchannels "$SCID" | jq --arg s "$SOURCE" '.channels[] | select(.source == $s) | {destination, base_fee_millisatoshi, fee_per_millionth, last_update}'
Work through a quote
With a base fee of 1,000 msat and a proportional fee of 200 ppm, forwarding 10,000,000 msat adds 2,000 msat plus the base, or 3,000 msat. Check last_update when recording the quote. Gossip describes policy at an observation time and cannot guarantee that usable liquidity exists.