The two 2-phase commits that are possible for multi-hop payments (cancel-on-timeout or finish-on-timeout) will always have a penalty on one of the phases but never on the other, and either 2-phase commit will have on opposite phases. To avoid a non-attacker getting stuck with the whole payment as penalty, the penalty can be done in "chunks ". But when penalty is done in chunks, the combined time until the payment has fully timed out tends to increase, and this makes the phase with no penalty vulnerable to Denial of Service (DoS) attacks. The solution is to combine both 2-phase commits, and use the one with the penalty on the first phase as the first phase, and the one with the penalty on the second phase as the second phase. This requires an intermediary phase that shifts from finish-on-timeout to cancel-on-timeout, resulting in a 3-phase commit. This is the logical way to do multi-hop payments.


Big thanks to Ryan for inventing Ripple and starting the "multihop payment movement". Anyone who finds my invention is helpful, feel free to discuss it here. It was invented thanks to feedback from Ryan and Michiel. Peace /Johan
UML for 2-phase commit images:
@startuml
start
:Prepare;
note right: No penalty
note left: Cancel on timeout
:Commit;
note right: Penalty
end
@enduml
@startuml
start
:Prepare;
note right: Penalty
note left: Finish on timeout
if (All agree?) then ([Yes])
:Commit;
note right: No penalty
end
else ([No])
:Cancel;
note right: Penalty
stop
endif
@enduml
UML for 3-phase commit image:
@startuml
start
:Prepare;
note left: Finish on timeout
note right: Penalty
if (All agree?) then ([Yes])
:Pre-Commit;
note left: Cancel on timeout
note right: Penalty
:Commit;
note right: Penalty
end
else ([No])
:Cancel;
note right: Penalty
stop
endif
@enduml