diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/kernel/BranchManager.ml | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/kernel/BranchManager.ml b/lib/kernel/BranchManager.ml index a371a0c..4d2fb1d 100644 --- a/lib/kernel/BranchManager.ml +++ b/lib/kernel/BranchManager.ml @@ -53,9 +53,12 @@ module Make (S : Abstract.Storage.STORAGE) = struct | None -> Ok None | Some head -> B.load ?root tx storage head |> Result.map Option.some ) + (* a head moves only to a valid state, judged before the head is + taken, since judging may run stored programs that read storage *) method update key reference value = let open Utilities.Result in let open Protocols in + let* () = Option.fold ~none:(Ok ()) ~some:Denial.check value in SI.with_transaction storage (fun tx -> match Utilities.Atomic.mswap head (fun head -> |
