Answer 1
First of all this create deadlock issue.
Locking from and to sequentially from.Lock.Lock() followed by to.Lock.Lock()
can lead to a deadlock when two goroutines simultaneously call transfer,
each with reversed user arguments.
one possible solution is to always lock the user with the smaller ID first.
this ensures that the locking order is consistent across all calls to preventing deadlocks.
for mitigating the deadlock issue we can use the below code.