Use new proof method

This commit is contained in:
Alexis Sellier 2017-08-04 17:03:07 +02:00
parent 18a1dd7f6b
commit d629f27800
1 changed files with 11 additions and 5 deletions

View File

@ -180,12 +180,18 @@ func (s *Store) Query(reqQuery abci.RequestQuery) (resQuery abci.ResponseQuery)
key := reqQuery.Data // Data holds the key bytes
resQuery.Key = key
if reqQuery.Prove {
value, proof, exists := tree.Proof(key)
if !exists {
resQuery.Log = "Key not found"
value, proofExists, proofNotExists, err := tree.GetWithProof(key)
if err != nil {
resQuery.Log = err.Error()
break
}
if value != nil {
resQuery.Value = value
resQuery.Proof = proof
resQuery.Proof = wire.BinaryBytes(proofExists)
} else {
resQuery.Proof = wire.BinaryBytes(proofNotExists)
}
} else {
value := tree.Get(key)
resQuery.Value = value