Commit 6c6a0a9
committed
Prefactor: Simplify state transitions, drop lock around
The previous transition pattern of `OutboundJITChannelState` was never
great: we'd take `&mut self`, only to also return `Self` and required
updating the state externally to the state transtion methods. In
addition, we previously wrapped `PaymentQueue` in an `Arc<Mutex<..>>` to
avoid cloning them during state transtions.
Here, we clean up all of this, having the state transtion methods
updating the state in-place and merely returning an `action` in the
method's `Result`s. We also use `core::mem::take` to move the
`payment_queue` to the new states without reallocation.PaymentQueue
1 parent b1fc7d8 commit 6c6a0a9
File tree
2 files changed
+167
-161
lines changed- lightning-liquidity/src/lsps2
2 files changed
+167
-161
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
57 | 63 | | |
58 | 64 | | |
59 | 65 | | |
| |||
0 commit comments