Skip to content

Commit cb7b848

Browse files
committed
fix: fix issue when the target is the final destination
Signed-off-by: Colton Wolkins (Indicio work address) <colton@indicio.tech>
1 parent 800bc79 commit cb7b848

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

didcomm_messaging/routing.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@ async def prepare_forward(
105105

106106
# Grab our target to pack the initial message to, then pack the message
107107
# for the DID target
108-
next_target = chain.pop(0)["did"]
108+
final_destination = chain.pop(0)
109+
next_target = final_destination["did"]
109110
packed_message = encoded_message
110111

111112
# Loop through the entire services chain and pack the message for each
@@ -130,4 +131,7 @@ async def prepare_forward(
130131

131132
# Return the forward-packed message as well as the last service in the
132133
# chain, which is the destination of the top-level forward message.
133-
return (packed_message, chain[-1]["service"])
134+
service = final_destination["service"]
135+
if len(chain):
136+
service = chain[-1]["service"]
137+
return (packed_message, service)

0 commit comments

Comments
 (0)