What is stopping a node operator from not forwarding a payment to the next node in the route?
Could someone change their code to become a bad actor?
Nothing is. The payment would be stuck.
This is a problem with invoices which are risky to retry due to potential loss of funds. But LND automatically prefers nodes less that fail or make payments get stuck.
reply
A specific payment I think is hard to do it, or even impossible. You can disable a channel if you want. But that will be dumb and useless.
reply
In a bad actor sits at the only cross road to split the network in halves (theoretically, this is unrealistic in practice due to internet) that is called an "eclipse attack". In Bitcoin both sides will know that because the Hashrate would seem unrealistic for both sides.
Also, the Bitcoin gossip network fulfills the "Continuous Byzantine Agreement". If everyone signs the message that they forward - malicious actors cannot fake messages. This so called "Dolev Strong Protocol". This makes malicious actors easy to identify and ignore. Honest actors establish p2p channels only with other honest actors.
reply
Sorry, I was referring to lightning node operators. They see each payment routing through their node in real time.
reply