From be869a63ff1540dd542b2241a7db5cd1c6fbc07f Mon Sep 17 00:00:00 2001 From: Abel Armoa <30988000+aarmoa@users.noreply.github.com> Date: Wed, 2 Oct 2024 23:10:23 -0300 Subject: [PATCH] (fix) Added validation in SyncBroadcast code to avoid waiting to see the TX in the mainpool if it has been rejected by the node during broadcast --- client/chain/chain.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/chain/chain.go b/client/chain/chain.go index de5f06dd..e6231a07 100644 --- a/client/chain/chain.go +++ b/client/chain/chain.go @@ -833,7 +833,7 @@ func (c *chainClient) SyncBroadcastSignedTx(txBytes []byte) (*txtypes.BroadcastT ctx := context.Background() res, err := common.ExecuteCall(ctx, c.network.ChainCookieAssistant, c.txClient.BroadcastTx, &req) - if err != nil { + if err != nil || res.TxResponse.Code != 0 { return res, err } @@ -904,7 +904,7 @@ func (c *chainClient) broadcastTx( } res, err := common.ExecuteCall(context.Background(), c.network.ChainCookieAssistant, c.txClient.BroadcastTx, &req) - if !await || err != nil { + if err != nil || res.TxResponse.Code != 0 || !await { return res, err }