From b9417a0c41f63ba7d745fcf7c1795d578d3064fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enis=20Bayramo=C4=9Flu?= Date: Tue, 19 Dec 2023 15:08:23 +0100 Subject: [PATCH] Fix events treatments for txs endpoint In the presensence of orphans, we can have multiple executions of the same transaction yielding different events every time. This commit makes sure that each execution gets associated with its own events only. --- haskell-src/exec/Chainweb/Server.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/haskell-src/exec/Chainweb/Server.hs b/haskell-src/exec/Chainweb/Server.hs index e73a5c7e..ddfb2113 100644 --- a/haskell-src/exec/Chainweb/Server.hs +++ b/haskell-src/exec/Chainweb/Server.hs @@ -433,9 +433,10 @@ 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 + toApiTxDetail tx contHist blk (filter (sameBlock tx) evs) signers sigs queryTxsByPactId :: LogFunctionIO Text -> Limit -> Text -> Connection -> IO [TxSummary] queryTxsByPactId logger limit pactid c =