althea-net / rita

Rita is a routing and billing protocol that allows devices to buy and sell bandwidth
https://docs.althea.net/
Apache License 2.0
91 stars 24 forks source link

Don't mark payment as failed when we get a json_rpc error #917

Closed jkilpatr closed 5 months ago

jkilpatr commented 5 months ago

This patch resolves an issue where routers may repeatedly overpay because of a temporary full node error. The original goal of this bit of logic was to fail the payment fast if the error was from the json_rpc (transaction failed validation) but json rpc errors can actually encompass more types of failures including some where the rpc node actually did send the tx.

Now we fall back to just always believeing we have sent the tx in this case and verifying via the txid.

Also modified here is the behavior around blocking tx when payment issues are detected, since the timeout is triggered internally when the MakePayment state machine result is returned blocking a payemnt in this case only results in a 10 minute timeout and never any positive result.

This patch also adds some extra logging to failure cases and renames the debt keeper send update function to be more intitutive to read.