From 1effd3eff242ecfb2644d270db96ec51c41ef1e4 Mon Sep 17 00:00:00 2001 From: charliec Date: Tue, 12 Sep 2023 14:22:38 -0500 Subject: [PATCH] cleaned up redundant code --- zetaclient/bitcoin_client.go | 28 +--------------------------- 1 file changed, 1 insertion(+), 27 deletions(-) diff --git a/zetaclient/bitcoin_client.go b/zetaclient/bitcoin_client.go index 3db06609f1..c9aa882991 100644 --- a/zetaclient/bitcoin_client.go +++ b/zetaclient/bitcoin_client.go @@ -367,7 +367,7 @@ func (ob *BitcoinChainClient) IsSendOutTxProcessed(sendHash string, nonce uint64 ob.logger.ObserveOutTx.Warn().Msg("IsSendOutTxProcessed: res.Amount > 0") amount = res.Amount } else if res.Amount == 0 { - ob.logger.ObserveOutTx.Error().Msgf("IsSendOutTxProcessed: res.Amount == 0, using original amount %f", amount) + ob.logger.ObserveOutTx.Error().Msg("IsSendOutTxProcessed: res.Amount == 0") return false, false, nil } else { amount = -res.Amount @@ -921,32 +921,6 @@ func (ob *BitcoinChainClient) checkTSSVin(vins []btcjson.Vin, nonce uint64) erro return nil } -// TODO: develop a well-defined cctx validation in zetacore. -func (ob *BitcoinChainClient) ValidateCctxParams(params *types.OutboundTxParams) error { - // More broadly, we should probably think about the address format that we support - // 1. legacy P2PKH like 2Mz1XjXzgQCxXfazTAmsTAj46dQkmAdK5X2 - // 2. segwit P2PKH like tb1qy9pqmk2pd9sv63g27jt8r657wy0d9ueeh0nqur, this is what we support for now - // 3. taproot P2PKH? - // 4. other P2SH? - - // validate receiver address - addr, err := btcutil.DecodeAddress(params.Receiver, config.BitconNetParams) - if err != nil { - return err - } - _, ok := addr.(*btcutil.AddressWitnessPubKeyHash) - if err != nil || !ok { - return fmt.Errorf("ValidateCctxParams: cannot convert address %s to P2WPKH address", params.Receiver) - } - - // validate amount - _, err = getSatoshis(float64(params.Amount.Uint64()) / 1e8) - if err != nil { - return fmt.Errorf("ValidateCctxParams: invalid amount %d", params.Amount) - } - return nil -} - // Vout is valid if: // - The first output is the nonce-mark // - The second output is the correct payment to recipient