Worked by coincidence; the txn would always retry and there was a 1/10 chance it would pass by selecting the same to/from keys.
@@ -58,7 +58,7 @@ func ExampleSTM_apply() {
// transfer amount
xfer := fromInt / 2
- fromInt, toInt = fromInt-xfer, toInt-xfer
+ fromInt, toInt = fromInt-xfer, toInt+xfer
// writeback
stm.Put(fromK, fmt.Sprintf("%d", fromInt))