Neptune-Crypto / neptune-core

anonymous peer-to-peer cash
Apache License 2.0
23 stars 7 forks source link

Bug in RPC's `utxo_digest` endpoint #140

Closed Sword-Smith closed 2 months ago

Sword-Smith commented 2 months ago

This code needs to use count_leaves instead of len on the archival-MMR. And the len method on ArchivalMmr should be deleted again, as length is not a established term for MMRs.

    async fn utxo_digest(self, _: context::Context, index: u64) -> Option<Digest> {
        let state = self.state.lock_guard().await;
        let aocl = &state.chain.archival_state().archival_mutator_set.ams().aocl;

        match index > 0 && index < aocl.len().await {
            true => Some(aocl.get_leaf_async(index).await),
            false => None,
        }
    }
dan-da commented 2 months ago

closed by 5aabe43215f8e8bf5fbbfb31003058b599639bb9