use of com.jd.blockchain.ledger.MerkleProof in project jdchain-core by blockchain-jd-com.
the class KvDataset method getDataProof.
public MerkleDataProof getDataProof(Bytes key, long version) {
DataEntry<Bytes, byte[]> dataEntry = getDataEntry(key, version);
if (dataEntry == null) {
return null;
}
MerkleProof proof = getProof(key);
return new MerkleDataEntryWrapper(dataEntry, proof);
}
use of com.jd.blockchain.ledger.MerkleProof in project jdchain-core by blockchain-jd-com.
the class MerkleSequenceDataset method getDataProof.
public MerkleDataProof getDataProof(Bytes key, long version) {
DataEntry<Bytes, byte[]> dataEntry = getDataEntry(key, version);
if (dataEntry == null) {
return null;
}
MerkleProof proof = getProof(key);
return new MerkleDataEntryWrapper(dataEntry, proof);
}
use of com.jd.blockchain.ledger.MerkleProof in project jdchain-core by blockchain-jd-com.
the class KvDataset method getDataProof.
public MerkleDataProof getDataProof(Bytes key) {
DataEntry<Bytes, byte[]> dataEntry = getDataEntry(key);
if (dataEntry == null) {
return null;
}
MerkleProof proof = getProof(key);
return new MerkleDataEntryWrapper(dataEntry, proof);
}
use of com.jd.blockchain.ledger.MerkleProof in project jdchain-core by blockchain-jd-com.
the class MerkleHashDataset method getDataProof.
public MerkleDataProof getDataProof(Bytes key) {
DataEntry<Bytes, byte[]> dataEntry = getDataEntry(key);
if (dataEntry == null) {
return null;
}
MerkleProof proof = getProof(key);
return new MerkleDataEntryWrapper(dataEntry, proof);
}
use of com.jd.blockchain.ledger.MerkleProof in project jdchain-core by blockchain-jd-com.
the class MerkleHashSortTreeTest method assertMerkleProof.
private MerkleProof assertMerkleProof(VersioningKVData<String, byte[]> data, MerkleTree merkleTree) {
MerkleProof proof_nx = merkleTree.getProof(BytesUtils.toBytes("KEY_NOT_EXIST"));
assertNull(proof_nx);
MerkleProof proof = merkleTree.getProof(BytesUtils.toBytes(data.getKey()), data.getVersion());
assertNotNull(proof);
HashDigest dataHash = SHA256_HASH_FUNC.hash(data.getValue());
assertEquals(dataHash, proof.getDataHash());
HashDigest rootHash = merkleTree.getRootHash();
assertEquals(rootHash, proof.getRootHash());
assertTrue(MerkleProofVerifier.verify(proof));
return proof;
}
Aggregations