From f65dc1cb3f065a0ef7f53629c83411bdf4240382 Mon Sep 17 00:00:00 2001 From: Charlie Chen <34498985+ws4charlie@users.noreply.github.com> Date: Wed, 7 Feb 2024 23:35:21 -0600 Subject: [PATCH] fix: cherry pick hotfix v12.2.5 (#1727) * provide bitcoin_chain_id when query tss address * update changelog * added comment for readibility --- changelog.md | 1 + zetaclient/bitcoin_client.go | 2 +- zetaclient/inbound_tracker.go | 4 ++-- zetaclient/interfaces.go | 2 +- zetaclient/query.go | 6 ++++-- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/changelog.md b/changelog.md index b7bb34d3dd..3c82c9f527 100644 --- a/changelog.md +++ b/changelog.md @@ -14,6 +14,7 @@ * [1690](https://github.com/zeta-chain/node/issues/1690) - double watched gas prices and fix btc scheduler * [1687](https://github.com/zeta-chain/node/pull/1687) - only use EVM supported chains for gas stability pool * [1692](https://github.com/zeta-chain/node/pull/1692) - fix get params query for emissions module +* [1721](https://github.com/zeta-chain/node/issues/1721) - zetaclient should provide bitcoin_chain_id when querying TSS address ### Tests diff --git a/zetaclient/bitcoin_client.go b/zetaclient/bitcoin_client.go index 5dee82bdb8..b67f8c0dd6 100644 --- a/zetaclient/bitcoin_client.go +++ b/zetaclient/bitcoin_client.go @@ -700,7 +700,7 @@ func GetBtcEvent( return nil, err } if wpkhAddress.EncodeAddress() != targetAddress { - return nil, err + return nil, nil // irrelevant tx to us, skip } // deposit amount has to be no less than the minimum depositor fee if out.Value < BtcDepositorFeeMin { diff --git a/zetaclient/inbound_tracker.go b/zetaclient/inbound_tracker.go index 31ea30f06e..31f0c4fab1 100644 --- a/zetaclient/inbound_tracker.go +++ b/zetaclient/inbound_tracker.go @@ -96,7 +96,7 @@ func (ob *BitcoinChainClient) CheckReceiptForBtcTxHash(txHash string, vote bool) if err != nil { return "", err } - tss, err := ob.zetaClient.GetBtcTssAddress() + tss, err := ob.zetaClient.GetBtcTssAddress(ob.chain.ChainId) if err != nil { return "", err } @@ -116,7 +116,7 @@ func (ob *BitcoinChainClient) CheckReceiptForBtcTxHash(txHash string, vote bool) if err != nil { ob.logger.WatchInTx.Error().Err(err).Msg("error posting to zeta core") return "", err - } else if ballot == "" { + } else if zetaHash != "" { ob.logger.WatchInTx.Info().Msgf("BTC deposit detected and reported: PostVoteInbound zeta tx: %s ballot %s", zetaHash, ballot) } return msg.Digest(), nil diff --git a/zetaclient/interfaces.go b/zetaclient/interfaces.go index 6ccf4faef8..ba58afed09 100644 --- a/zetaclient/interfaces.go +++ b/zetaclient/interfaces.go @@ -87,7 +87,7 @@ type ZetaCoreBridger interface { GetCrosschainFlags() (observertypes.CrosschainFlags, error) GetObserverList() ([]string, error) GetKeyGen() (*observertypes.Keygen, error) - GetBtcTssAddress() (string, error) + GetBtcTssAddress(chainID int64) (string, error) GetInboundTrackersForChain(chainID int64) ([]crosschaintypes.InTxTracker, error) GetLogger() *zerolog.Logger ZetaChain() common.Chain diff --git a/zetaclient/query.go b/zetaclient/query.go index 99131ce6fc..bf2afa4d9f 100644 --- a/zetaclient/query.go +++ b/zetaclient/query.go @@ -308,9 +308,11 @@ func (b *ZetaCoreBridge) GetEthTssAddress() (string, error) { return resp.Eth, nil } -func (b *ZetaCoreBridge) GetBtcTssAddress() (string, error) { +func (b *ZetaCoreBridge) GetBtcTssAddress(chainID int64) (string, error) { client := observertypes.NewQueryClient(b.grpcConn) - resp, err := client.GetTssAddress(context.Background(), &observertypes.QueryGetTssAddressRequest{}) + resp, err := client.GetTssAddress(context.Background(), &observertypes.QueryGetTssAddressRequest{ + BitcoinChainId: chainID, + }) if err != nil { return "", err }