Last active
March 26, 2019 09:27
-
-
Save termslang/1b10ab43bf94733fc4102e0845dc48bb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Transaction = struct | |
type t = tx_signed | |
module KEY = struct | |
type t = tx_signed | |
let compare a b = String.compare a.data.sender b.data.sender | |
end | |
(* TODO move implementation here *) | |
let is_valid ~tx = false | |
let make ~sender ~receiver ~amount = | |
let nonce = (Address.Ledger.get sender).nonce in | |
let data = {sender; receiver; amount; nonce} in | |
(* TODO sign tx data *) | |
{signature = ""; data} | |
module Pool = struct | |
module TxSet = Set.Make (KEY) | |
let data = ref TxSet.empty | |
let add ~tx = | |
match is_valid ~tx with | |
| false -> () | |
| true -> data := TxSet.add tx !data | |
let remove ~tx = data := TxSet.remove tx !data | |
let mem ~tx = TxSet.mem tx !data | |
let elements = TxSet.elements !data | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment