Commit fd2bb5a5 authored by Jakob Botsch Nielsen's avatar Jakob Botsch Nielsen

Introduce FullTx type exposed by ChainBuilder

This contains _all_ information that happened in a transaction (for
instance, including the exact contracts that were deployed). The
ChainBuilder exposes the trace of transactions (as FullTx values) that
have happened in the chain.
parent 14815aae
Pipeline #11606 passed with stage
in 6 minutes and 28 seconds
......@@ -306,6 +306,10 @@ Record ChainBuilderInterface :=
Address (* coinbase *) ->
list (Address * ChainAction) (* actions *) ->
option cbi_type;
(* List of transactions that have been executed on the chain, in order.
That is, the head of the list corresponds to actions in the very first block.
This includes "internal" transactions (txs resulting from contract execution) *)
cbi_all_txs : cbi_type -> list FullTx;
}.
Record ChainBuilder :=
......@@ -331,3 +335,7 @@ Definition add_block
let (ifc, val) := cur in
let new_val := ifc.(cbi_add_block) val coinbase actions in
option_map (build_chain_builder ifc) new_val.
Definition all_txs (cb : ChainBuilder) :=
let (ifc, val) := cb in
ifc.(cbi_all_txs) val.
......@@ -10,3 +10,13 @@ Fixpoint find_first {A B : Type} (f : A -> option B) (l : list A)
end
| [] => None
end.
Fixpoint map_option {A B : Type} (f : A -> option B) (l : list A)
: list B :=
match l with
| hd :: tl => match f hd with
| Some b => b :: map_option f tl
| None => map_option f tl
end
| [] => []
end.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment