Mina中的scan state代码解析

1. 引言

前序博客有:

Mina引入scan state来异步实现交易证明,scan state中有多棵树,将待证明交易作为scan state中树的叶子节点,相应的证明称为base job,树的非叶子节点的证明称为merge job。树的根节点对应的证明称为ledger_proof。

可将scan state中每棵树中的每个节点看成是待完成的job:

  • job状态结构为:Todo和Done 两种状态。
(**Each node on the tree is viewed as a job that needs to be completed. When a job is completed, it creates a new "Todo" job and marks the old job as "Done"*)
module Job_status : sig
  [%%versioned:
  module Stable : sig
    module V1 : sig
      type t = Todo | Done [@@deriving sexp]
  • Weight:可添加到某树的job数,与该树的特定层相关。
(**number of jobs that can be added to this tree. This number corresponding to a specific level of the tree. New jobs received is distributed across the tree based on this number. *)
module Weight : sig
  [%%versioned:
  module Stable : sig
    module V1 : sig
      type t = { base : int; merge : int }
  • Base Job结构为:

附录1. Mina系列博客

Mina系列博客有:

猜你喜欢

转载自blog.csdn.net/mutourend/article/details/125152233
今日推荐