From d629f2780054d25b10e3305bbd593321dccd65c7 Mon Sep 17 00:00:00 2001 From: Alexis Sellier Date: Fri, 4 Aug 2017 17:03:07 +0200 Subject: [PATCH] Use new proof method --- app/store.go | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/app/store.go b/app/store.go index 329b63516..efb5471ca 100644 --- a/app/store.go +++ b/app/store.go @@ -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 = wire.BinaryBytes(proofExists) + } else { + resQuery.Proof = wire.BinaryBytes(proofNotExists) } - resQuery.Value = value - resQuery.Proof = proof } else { value := tree.Get(key) resQuery.Value = value