From 21c149d980281f69e32a8772b87f1ef5a013ae1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enis=20Bayramo=C4=9Flu?= Date: Wed, 20 Dec 2023 13:39:03 +0100 Subject: [PATCH] Fix events treatments for txs endpoint (#177) In the presence of orphans, we can have multiple executions of the same transaction yielding different events every time. This PR makes sure that each execution gets associated with its own events only. * Fix events treatments for txs endpoint * Apply @emmanueldenloye's suggestion --- haskell-src/exec/Chainweb/Server.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/haskell-src/exec/Chainweb/Server.hs b/haskell-src/exec/Chainweb/Server.hs index e73a5c7e..d151df74 100644 --- a/haskell-src/exec/Chainweb/Server.hs +++ b/haskell-src/exec/Chainweb/Server.hs @@ -433,9 +433,11 @@ queryTxsByKey logger rk c = , Api._signer_capList = caps } let sigs = Api.Sig . unSignature . _signer_sig <$> dbSigners + sameBlock tx ev = (unBlockId $ _tx_block tx) == (unBlockId $ _ev_block ev) return $ (`fmap` r) $ \(tx,contHist, blk) -> - toApiTxDetail tx contHist blk evs signers sigs + let evsInTxBlock = filter (sameBlock tx) evs + in toApiTxDetail tx contHist blk evsInTxBlock signers sigs queryTxsByPactId :: LogFunctionIO Text -> Limit -> Text -> Connection -> IO [TxSummary] queryTxsByPactId logger limit pactid c =