From 1a3879be27ffef3cbb761aee5a2f7a827dd26706 Mon Sep 17 00:00:00 2001 From: Charlie Chen Date: Tue, 6 Feb 2024 14:41:59 -0600 Subject: [PATCH 1/3] provide bitcoin_chain_id when query tss address --- zetaclient/bitcoin_client.go | 2 +- zetaclient/inbound_tracker.go | 2 +- zetaclient/interfaces.go | 2 +- zetaclient/query.go | 6 ++++-- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/zetaclient/bitcoin_client.go b/zetaclient/bitcoin_client.go index 5dee82bdb8..6d72e50bfd 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 } // 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..6f425a2caf 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 } 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 } From f6086452b071f461d10cf1f84faee0e3ee3da494 Mon Sep 17 00:00:00 2001 From: Charlie Chen Date: Tue, 6 Feb 2024 17:43:38 -0600 Subject: [PATCH 2/3] update changelog --- changelog.md | 1 + zetaclient/inbound_tracker.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) 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/inbound_tracker.go b/zetaclient/inbound_tracker.go index 6f425a2caf..31f0c4fab1 100644 --- a/zetaclient/inbound_tracker.go +++ b/zetaclient/inbound_tracker.go @@ -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 From c24f45b0e16b0c0d35523e59b1fdfff4f84a1c3a Mon Sep 17 00:00:00 2001 From: Charlie Chen Date: Wed, 7 Feb 2024 15:49:51 -0600 Subject: [PATCH 3/3] added comment for readibility --- zetaclient/bitcoin_client.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zetaclient/bitcoin_client.go b/zetaclient/bitcoin_client.go index 6d72e50bfd..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, nil + return nil, nil // irrelevant tx to us, skip } // deposit amount has to be no less than the minimum depositor fee if out.Value < BtcDepositorFeeMin {