Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DBC: Implement in-memory MerkleReg backed OrderingDAG #1088

Open
joshuef opened this issue Mar 30, 2022 · 0 comments
Open

DBC: Implement in-memory MerkleReg backed OrderingDAG #1088

joshuef opened this issue Mar 30, 2022 · 0 comments

Comments

@joshuef
Copy link
Contributor

joshuef commented Mar 30, 2022

Where

Probably inside sn/data/spentbook

What

We need the following API's implemented on top of the Ordering DAG (which in our case will simply be the MerkleReg)

type OrderingDAG = MerkleReg<MaidTransaction>;
type InvertedDAG = BTreeMap<Hash, BTreeSet<Hash>>; // used for bootstrapping and traversing the DAG forward

struct MaidTransaction {
    // hash of the MaidTransaction that produced an output with this inputs public key
    inputs: BTreeMap<PublicKey, Hash>,
    ringct: RingCtTransaction, // The actual transaction
}
/// return the hashes of the most recent MaidTransactions
fn spentbook_roots(&self) -> BTreeSet<Hash>
/// return the MaidTransaction for the given hash
fn spentbook_read(&self, tx_hash: Hash) -> Option<MaidTransaction>
/// returns the transactions that came after the transaction with hash `tx_hash`
/// This will be used to traverse the SpentBook from the genesis onwards.
fn spentbook_next_transactions(&self, tx_hash: Hash) -> Option<BTreeSet<Hash>>

The in memory dag would only be written to as/when we have log_spent in place.

This is just a quick issue to get the basics of a spent book in place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant