Skip to content

Commit

Permalink
fix findAnchoringSealEvent, add AnchorQuerier (#172)
Browse files Browse the repository at this point in the history
Co-authored-by: Petteri Stenius <[email protected]>
  • Loading branch information
psteniusubi and psteniusubi authored Jan 23, 2024
1 parent f24cf4b commit 98a33ae
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/keria/app/agenting.py
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,9 @@ def recur(self, tyme, deeds=None):
seqNoDo = querying.SeqNoQuerier(hby=self.hby, hab=self.agentHab, pre=pre, sn=sn)
self.extend([seqNoDo])
elif "anchor" in msg:
pass
anchor = msg['anchor']
anchorDo = querying.AnchorQuerier(hby=self.hby, hab=self.agentHab, pre=pre, anchor=anchor)
self.extend([anchorDo])
else:
qryDo = querying.QueryDoer(hby=self.hby, hab=self.agentHab, pre=pre, kvy=self.kvy)
self.extend([qryDo])
Expand Down
2 changes: 1 addition & 1 deletion src/keria/core/longrunning.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ def status(self, op):
operation.done = False
elif "anchor" in op.metadata:
anchor = op.metadata["anchor"]
if self.hby.db.findAnchoringEvent(op.oid, anchor=anchor) is not None:
if self.hby.db.findAnchoringSealEvent(op.oid, seal=anchor) is not None:
operation.done = True
operation.response = asdict(kever.state())
else:
Expand Down
7 changes: 6 additions & 1 deletion tests/app/test_agenting.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,12 @@ def test_querier(helpers):
# Anchor not implemented yet
qry.queries.append(dict(pre="EI7AkI40M11MS7lkTCb10JC9-nDt-tXwQh44OHAFlv_9", anchor={}))
qry.recur(1.0, deeds=deeds)
assert len(qry.doers) == 0
assert len(qry.doers) == 1
anchorDoer = qry.doers[0]
assert isinstance(anchorDoer, querying.AnchorQuerier) is True
assert anchorDoer.pre == "EI7AkI40M11MS7lkTCb10JC9-nDt-tXwQh44OHAFlv_9"
assert anchorDoer.anchor == {}
qry.doers.remove(anchorDoer)

qry.queries.append(dict(pre="EI7AkI40M11MS7lkTCb10JC9-nDt-tXwQh44OHAFlv_9"))
qry.recur(1.0, deeds=deeds)
Expand Down

0 comments on commit 98a33ae

Please sign in to comment.