Skip to content

Commit

Permalink
new fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
lumtis committed May 17, 2024
1 parent f7fb5cc commit d54cdc9
Show file tree
Hide file tree
Showing 30 changed files with 281 additions and 281 deletions.
6 changes: 3 additions & 3 deletions cmd/zetacored/parse_genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,15 +158,15 @@ func GetImportData(t *testing.T, cdc *codec.ProtoCodec, n int) map[string]json.R
// Add crosschain data to genesis state
importedCrossChainGenState := crosschaintypes.GetGenesisStateFromAppState(cdc, importData)
cctxList := make([]*crosschaintypes.CrossChainTx, n)
intxHashToCctxList := make([]crosschaintypes.InboundHashToCctx, n)
inboundHashToCctxList := make([]crosschaintypes.InboundHashToCctx, n)
finalLizedInbounds := make([]string, n)
for i := 0; i < n; i++ {
cctxList[i] = sample.CrossChainTx(t, fmt.Sprintf("crosschain-%d", i))
intxHashToCctxList[i] = sample.InboundHashToCctx(t, fmt.Sprintf("intxHashToCctxList-%d", i))
inboundHashToCctxList[i] = sample.InboundHashToCctx(t, fmt.Sprintf("inboundHashToCctxList-%d", i))
finalLizedInbounds[i] = fmt.Sprintf("finalLizedInbounds-%d", i)
}
importedCrossChainGenState.CrossChainTxs = cctxList
importedCrossChainGenState.InboundHashToCctxList = intxHashToCctxList
importedCrossChainGenState.InboundHashToCctxList = inboundHashToCctxList
importedCrossChainGenState.FinalizedInbounds = finalLizedInbounds
importedCrossChainStateBz, err := json.Marshal(importedCrossChainGenState)
require.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion contrib/localnet/scripts/start-zetacored.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
/usr/sbin/sshd

# This function add authz observer authorizations for inbound/outbound votes and tracker messages
# These messages have been renamed for v17: https://github.com/zeta-chain/node/blob/refactor/rename-outbound-inbound/docs/releases/v17_breaking_changes.md#intx-and-outtx-renaming
# These messages have been renamed for v17: https://github.com/zeta-chain/node/blob/refactor/rename-outbound-inbound/docs/releases/v17_breaking_changes.md#inbound-and-outtx-renaming
# There if the genesis is generated with a v16 binary for the upgrade tests, it will not contains authorizations for new messages
# This function will add the missing authorizations to the genesis file
# TODO: Remove this function when v17 is released
Expand Down
2 changes: 1 addition & 1 deletion e2e/runner/bitcoin.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ func (runner *E2ERunner) SendToTSSFromDeployerWithMemo(
if err != nil {
panic(err)
}
runner.Logger.Info("bitcoin intx events:")
runner.Logger.Info("bitcoin inbound events:")
for _, event := range events {
runner.Logger.Info(" TxHash: %s", event.TxHash)
runner.Logger.Info(" From: %s", event.FromAddress)
Expand Down
8 changes: 4 additions & 4 deletions x/crosschain/keeper/finalized_inbounds.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ func (k Keeper) SetFinalizedInbound(ctx sdk.Context, finalizedInboundIndex strin
store.Set(types.KeyPrefix(finalizedInboundIndex), []byte{1})
}

func (k Keeper) AddFinalizedInbound(ctx sdk.Context, intxHash string, chainID int64, eventIndex uint64) {
finalizedInboundIndex := types.FinalizedInboundKey(intxHash, chainID, eventIndex)
func (k Keeper) AddFinalizedInbound(ctx sdk.Context, inboundHash string, chainID int64, eventIndex uint64) {
finalizedInboundIndex := types.FinalizedInboundKey(inboundHash, chainID, eventIndex)
k.SetFinalizedInbound(ctx, finalizedInboundIndex)
}
func (k Keeper) IsFinalizedInbound(ctx sdk.Context, intxHash string, chainID int64, eventIndex uint64) bool {
finalizedInboundIndex := types.FinalizedInboundKey(intxHash, chainID, eventIndex)
func (k Keeper) IsFinalizedInbound(ctx sdk.Context, inboundHash string, chainID int64, eventIndex uint64) bool {
finalizedInboundIndex := types.FinalizedInboundKey(inboundHash, chainID, eventIndex)
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.FinalizedInboundsKey))
return store.Has(types.KeyPrefix(finalizedInboundIndex))
}
Expand Down
16 changes: 8 additions & 8 deletions x/crosschain/keeper/finalized_inbounds_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@ import (
func TestKeeper_IsFinalizedInbound(t *testing.T) {
t.Run("check true for finalized inbound", func(t *testing.T) {
k, ctx, _, _ := keepertest.CrosschainKeeper(t)
intxHash := sample.Hash().String()
inboundHash := sample.Hash().String()
chainID := sample.Chain(5).ChainId
eventIndex := sample.EventIndex()
k.AddFinalizedInbound(ctx, intxHash, chainID, eventIndex)
require.True(t, k.IsFinalizedInbound(ctx, intxHash, chainID, eventIndex))
k.AddFinalizedInbound(ctx, inboundHash, chainID, eventIndex)
require.True(t, k.IsFinalizedInbound(ctx, inboundHash, chainID, eventIndex))
})
t.Run("check false for non-finalized inbound", func(t *testing.T) {
k, ctx, _, _ := keepertest.CrosschainKeeper(t)
intxHash := sample.Hash().String()
inboundHash := sample.Hash().String()
chainID := sample.Chain(5).ChainId
eventIndex := sample.EventIndex()
require.False(t, k.IsFinalizedInbound(ctx, intxHash, chainID, eventIndex))
require.False(t, k.IsFinalizedInbound(ctx, inboundHash, chainID, eventIndex))
})
t.Run("check true for finalized inbound list", func(t *testing.T) {
k, ctx, _, _ := keepertest.CrosschainKeeper(t)
Expand All @@ -46,11 +46,11 @@ func TestKeeper_IsFinalizedInbound(t *testing.T) {
func TestKeeper_AddFinalizedInbound(t *testing.T) {
t.Run("check add finalized inbound", func(t *testing.T) {
k, ctx, _, _ := keepertest.CrosschainKeeper(t)
intxHash := sample.Hash().String()
inboundHash := sample.Hash().String()
chainID := sample.Chain(5).ChainId
eventIndex := sample.EventIndex()
k.AddFinalizedInbound(ctx, intxHash, chainID, eventIndex)
require.True(t, k.IsFinalizedInbound(ctx, intxHash, chainID, eventIndex))
k.AddFinalizedInbound(ctx, inboundHash, chainID, eventIndex)
require.True(t, k.IsFinalizedInbound(ctx, inboundHash, chainID, eventIndex))
})
}

Expand Down
46 changes: 23 additions & 23 deletions x/crosschain/keeper/inbound_tracker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,73 +28,73 @@ func createNInboundTracker(keeper *keeper.Keeper, ctx sdk.Context, n int, chainI
func TestKeeper_GetAllInboundTrackerForChain(t *testing.T) {
t.Run("Get Inbound trackers one by one", func(t *testing.T) {
keeper, ctx, _, _ := keepertest.CrosschainKeeper(t)
intxTrackers := createNInboundTracker(keeper, ctx, 10, 5)
for _, item := range intxTrackers {
inboundTrackers := createNInboundTracker(keeper, ctx, 10, 5)
for _, item := range inboundTrackers {
rst, found := keeper.GetInboundTracker(ctx, item.ChainId, item.TxHash)
require.True(t, found)
require.Equal(t, item, rst)
}
})
t.Run("Get all Inbound trackers", func(t *testing.T) {
keeper, ctx, _, _ := keepertest.CrosschainKeeper(t)
intxTrackers := createNInboundTracker(keeper, ctx, 10, 5)
inboundTrackers := createNInboundTracker(keeper, ctx, 10, 5)
rst := keeper.GetAllInboundTracker(ctx)
require.Equal(t, intxTrackers, rst)
require.Equal(t, inboundTrackers, rst)
})
t.Run("Get all InTx trackers for chain", func(t *testing.T) {
keeper, ctx, _, _ := keepertest.CrosschainKeeper(t)
intxTrackersNew := createNInboundTracker(keeper, ctx, 100, 6)
inboundTrackersNew := createNInboundTracker(keeper, ctx, 100, 6)
rst := keeper.GetAllInboundTrackerForChain(ctx, 6)
sort.SliceStable(rst, func(i, j int) bool {
return rst[i].TxHash < rst[j].TxHash
})
sort.SliceStable(intxTrackersNew, func(i, j int) bool {
return intxTrackersNew[i].TxHash < intxTrackersNew[j].TxHash
sort.SliceStable(inboundTrackersNew, func(i, j int) bool {
return inboundTrackersNew[i].TxHash < inboundTrackersNew[j].TxHash
})
require.Equal(t, intxTrackersNew, rst)
require.Equal(t, inboundTrackersNew, rst)
})
t.Run("Get all InTx trackers for chain paginated by limit", func(t *testing.T) {
keeper, ctx, _, _ := keepertest.CrosschainKeeper(t)
intxTrackers := createNInboundTracker(keeper, ctx, 100, 6)
inboundTrackers := createNInboundTracker(keeper, ctx, 100, 6)
rst, pageRes, err := keeper.GetAllInboundTrackerForChainPaginated(ctx, 6, &query.PageRequest{Limit: 10, CountTotal: true})
require.NoError(t, err)
require.Subset(t, nullify.Fill(intxTrackers), nullify.Fill(rst))
require.Equal(t, len(intxTrackers), int(pageRes.Total))
require.Subset(t, nullify.Fill(inboundTrackers), nullify.Fill(rst))
require.Equal(t, len(inboundTrackers), int(pageRes.Total))
})
t.Run("Get all InTx trackers for chain paginated by offset", func(t *testing.T) {
keeper, ctx, _, _ := keepertest.CrosschainKeeper(t)
intxTrackers := createNInboundTracker(keeper, ctx, 100, 6)
inboundTrackers := createNInboundTracker(keeper, ctx, 100, 6)
rst, pageRes, err := keeper.GetAllInboundTrackerForChainPaginated(ctx, 6, &query.PageRequest{Offset: 10, CountTotal: true})
require.NoError(t, err)
require.Subset(t, nullify.Fill(intxTrackers), nullify.Fill(rst))
require.Equal(t, len(intxTrackers), int(pageRes.Total))
require.Subset(t, nullify.Fill(inboundTrackers), nullify.Fill(rst))
require.Equal(t, len(inboundTrackers), int(pageRes.Total))
})
t.Run("Get all InTx trackers paginated by limit", func(t *testing.T) {
keeper, ctx, _, _ := keepertest.CrosschainKeeper(t)
intxTrackers := append(createNInboundTracker(keeper, ctx, 10, 6), createNInboundTracker(keeper, ctx, 10, 7)...)
inboundTrackers := append(createNInboundTracker(keeper, ctx, 10, 6), createNInboundTracker(keeper, ctx, 10, 7)...)
rst, pageRes, err := keeper.GetAllInboundTrackerPaginated(ctx, &query.PageRequest{Limit: 20, CountTotal: true})
require.NoError(t, err)
require.Subset(t, nullify.Fill(intxTrackers), nullify.Fill(rst))
require.Equal(t, len(intxTrackers), int(pageRes.Total))
require.Subset(t, nullify.Fill(inboundTrackers), nullify.Fill(rst))
require.Equal(t, len(inboundTrackers), int(pageRes.Total))
})
t.Run("Get all InTx trackers paginated by offset", func(t *testing.T) {
keeper, ctx, _, _ := keepertest.CrosschainKeeper(t)
intxTrackers := append(createNInboundTracker(keeper, ctx, 100, 6), createNInboundTracker(keeper, ctx, 100, 7)...)
inboundTrackers := append(createNInboundTracker(keeper, ctx, 100, 6), createNInboundTracker(keeper, ctx, 100, 7)...)
rst, pageRes, err := keeper.GetAllInboundTrackerPaginated(ctx, &query.PageRequest{Offset: 10, CountTotal: true})
require.NoError(t, err)
require.Subset(t, nullify.Fill(intxTrackers), nullify.Fill(rst))
require.Equal(t, len(intxTrackers), int(pageRes.Total))
require.Subset(t, nullify.Fill(inboundTrackers), nullify.Fill(rst))
require.Equal(t, len(inboundTrackers), int(pageRes.Total))
})
t.Run("Delete InboundTracker", func(t *testing.T) {
keeper, ctx, _, _ := keepertest.CrosschainKeeper(t)
intxTrackers := createNInboundTracker(keeper, ctx, 10, 5)
inboundTrackers := createNInboundTracker(keeper, ctx, 10, 5)
trackers := keeper.GetAllInboundTracker(ctx)
for _, item := range trackers {
keeper.RemoveInboundTrackerIfExists(ctx, item.ChainId, item.TxHash)
}

intxTrackers = createNInboundTracker(keeper, ctx, 10, 6)
for _, item := range intxTrackers {
inboundTrackers = createNInboundTracker(keeper, ctx, 10, 6)
for _, item := range inboundTrackers {
keeper.RemoveInboundTrackerIfExists(ctx, item.ChainId, item.TxHash)
}
rst := keeper.GetAllInboundTrackerForChain(ctx, 6)
Expand Down
2 changes: 1 addition & 1 deletion x/crosschain/migrations/v4/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ func MoveTssToObserverModule(ctx sdk.Context,
}
}

// SetBitcoinFinalizedInbound sets the finalized inbound for bitcoin chains to prevent new ballots from being created with same intxhash
// SetBitcoinFinalizedInbound sets the finalized inbound for bitcoin chains to prevent new ballots from being created with same inboundhash
func SetBitcoinFinalizedInbound(ctx sdk.Context, crosschainKeeper crosschainKeeper) {
for _, cctx := range crosschainKeeper.GetAllCrossChainTx(ctx) {
if cctx.InboundParams != nil {
Expand Down
8 changes: 4 additions & 4 deletions x/crosschain/types/cctx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ func Test_InitializeCCTX(t *testing.T) {
creator := sample.AccAddress()
amount := sdkmath.NewUint(42)
message := "test"
intxBlockHeight := uint64(420)
intxHash := sample.Hash()
inboundBlockHeight := uint64(420)
inboundHash := sample.Hash()
gasLimit := uint64(100)
asset := "test-asset"
eventIndex := uint64(1)
Expand All @@ -97,8 +97,8 @@ func Test_InitializeCCTX(t *testing.T) {
ReceiverChain: receiverChain.ChainId,
Amount: amount,
Message: message,
InboundHash: intxHash.String(),
InboundBlockHeight: intxBlockHeight,
InboundHash: inboundHash.String(),
InboundBlockHeight: inboundBlockHeight,
GasLimit: gasLimit,
CoinType: cointType,
TxOrigin: sender.String(),
Expand Down
4 changes: 2 additions & 2 deletions x/crosschain/types/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ func (m CrossChainTx) LogIdentifierForCCTX() string {
return fmt.Sprintf("%s-%d-%d-%d", m.InboundParams.Sender, m.InboundParams.SenderChainId, outTx.ReceiverChainId, outTx.TssNonce)
}

func FinalizedInboundKey(intxHash string, chainID int64, eventIndex uint64) string {
return fmt.Sprintf("%d-%s-%d", chainID, intxHash, eventIndex)
func FinalizedInboundKey(inboundHash string, chainID int64, eventIndex uint64) string {
return fmt.Sprintf("%d-%s-%d", chainID, inboundHash, eventIndex)
}

var (
Expand Down
8 changes: 4 additions & 4 deletions zetaclient/chains/bitcoin/fee.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ const (
)

var (
// BtcOutboundBytesDepositor is the outtx size incurred by the depositor: 68vB
// BtcOutboundBytesDepositor is the outbound size incurred by the depositor: 68vB
BtcOutboundBytesDepositor = OutboundSizeDepositor()

// BtcOutboundBytesWithdrawer is the outtx size incurred by the withdrawer: 177vB
// BtcOutboundBytesWithdrawer is the outbound size incurred by the withdrawer: 177vB
BtcOutboundBytesWithdrawer = OutboundSizeWithdrawer()

// DefaultDepositorFee is the default depositor fee is 0.00001360 BTC (20 * 68vB / 100000000)
Expand Down Expand Up @@ -126,12 +126,12 @@ func GetOutputSizeByAddress(to btcutil.Address) (uint64, error) {
}
}

// OutboundSizeDepositor returns outtx size (68vB) incurred by the depositor
// OutboundSizeDepositor returns outbound size (68vB) incurred by the depositor
func OutboundSizeDepositor() uint64 {
return bytesPerInput + bytesPerWitness/blockchain.WitnessScaleFactor
}

// OutboundSizeWithdrawer returns outtx size (177vB) incurred by the withdrawer (1 input, 3 outputs)
// OutboundSizeWithdrawer returns outbound size (177vB) incurred by the withdrawer (1 input, 3 outputs)
func OutboundSizeWithdrawer() uint64 {
bytesWiredTx := WiredTxSize(1, 3)
bytesInput := uint64(1) * bytesPerInput // nonce mark
Expand Down
10 changes: 5 additions & 5 deletions zetaclient/chains/bitcoin/fee_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -411,15 +411,15 @@ func TestOutboundSizeBreakdown(t *testing.T) {
getTestAddrScript(t, ScriptTypeP2PKH),
}

// add all outtx sizes paying to each address
// add all outbound sizes paying to each address
txSizeTotal := uint64(0)
for _, payee := range payees {
sizeOutput, err := EstimateOutboundSize(2, []btcutil.Address{payee})
require.NoError(t, err)
txSizeTotal += sizeOutput
}

// calculate the average outtx size
// calculate the average outbound size
// #nosec G701 always in range
txSizeAverage := uint64((float64(txSizeTotal))/float64(len(payees)) + 0.5)

Expand All @@ -431,7 +431,7 @@ func TestOutboundSizeBreakdown(t *testing.T) {
txSizeWithdrawer := OutboundSizeWithdrawer()
require.Equal(t, uint64(177), txSizeWithdrawer)

// total outtx size == (deposit fee + withdrawer fee), 245 = 68 + 177
// total outbound size == (deposit fee + withdrawer fee), 245 = 68 + 177
require.Equal(t, OutboundBytesAvg, txSizeAverage)
require.Equal(t, txSizeAverage, txSizeDepositor+txSizeWithdrawer)

Expand All @@ -445,12 +445,12 @@ func TestOutboundSizeMinMaxError(t *testing.T) {
toP2TR := getTestAddrScript(t, ScriptTypeP2TR)
toP2WPKH := getTestAddrScript(t, ScriptTypeP2WPKH)

// Estimate the largest outtx size in vByte
// Estimate the largest outbound size in vByte
sizeMax, err := EstimateOutboundSize(21, []btcutil.Address{toP2TR})
require.NoError(t, err)
require.Equal(t, OutboundBytesMax, sizeMax)

// Estimate the smallest outtx size in vByte
// Estimate the smallest outbound size in vByte
sizeMin, err := EstimateOutboundSize(2, []btcutil.Address{toP2WPKH})
require.NoError(t, err)
require.Equal(t, OutboundBytesMin, sizeMin)
Expand Down
8 changes: 4 additions & 4 deletions zetaclient/chains/bitcoin/observer/inbound.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ func (ob *Observer) ObserveInbound() error {
return nil
}

// WatchInboundTracker watches zetacore for bitcoin intx trackers
// WatchInboundTracker watches zetacore for bitcoin inbound trackers
func (ob *Observer) WatchInboundTracker() {
ticker, err := types.NewDynamicTicker("Bitcoin_WatchInboundTracker", ob.GetChainParams().InboundTicker)
if err != nil {
Expand All @@ -220,7 +220,7 @@ func (ob *Observer) WatchInboundTracker() {
}
err := ob.ProcessInboundTrackers()
if err != nil {
ob.logger.Inbound.Error().Err(err).Msgf("error observing intx tracker for chain %d", ob.chain.ChainId)
ob.logger.Inbound.Error().Err(err).Msgf("error observing inbound tracker for chain %d", ob.chain.ChainId)
}
ticker.UpdateInterval(ob.GetChainParams().InboundTicker, ob.logger.Inbound)
case <-ob.stop:
Expand Down Expand Up @@ -440,12 +440,12 @@ func GetBtcEvent(
// event found, get sender address
if found {
if len(tx.Vin) == 0 { // should never happen
return nil, fmt.Errorf("GetBtcEvent: no input found for intx: %s", tx.Txid)
return nil, fmt.Errorf("GetBtcEvent: no input found for inbound: %s", tx.Txid)
}

fromAddress, err := GetSenderAddressByVin(rpcClient, tx.Vin[0], netParams)
if err != nil {
return nil, errors.Wrapf(err, "error getting sender address for intx: %s", tx.Txid)
return nil, errors.Wrapf(err, "error getting sender address for inbound: %s", tx.Txid)
}

return &BTCInboundEvent{
Expand Down
14 changes: 7 additions & 7 deletions zetaclient/chains/bitcoin/observer/inbound_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ func TestGetSenderAddressByVinErrors(t *testing.T) {
}

func TestGetBtcEvent(t *testing.T) {
// load archived intx P2WPKH raw result
// load archived inbound P2WPKH raw result
// https://mempool.space/tx/847139aa65aa4a5ee896375951cbf7417cfc8a4d6f277ec11f40cd87319f04aa
txHash := "847139aa65aa4a5ee896375951cbf7417cfc8a4d6f277ec11f40cd87319f04aa"
chain := chains.BtcMainnetChain
Expand All @@ -316,7 +316,7 @@ func TestGetBtcEvent(t *testing.T) {
TxHash: tx.Txid,
}

t.Run("should get BTC intx event from P2WPKH sender", func(t *testing.T) {
t.Run("should get BTC inbound event from P2WPKH sender", func(t *testing.T) {
// https://mempool.space/tx/c5d224963832fc0b9a597251c2342a17b25e481a88cc9119008e8f8296652697
preHash := "c5d224963832fc0b9a597251c2342a17b25e481a88cc9119008e8f8296652697"
tx.Vin[0].Txid = preHash
Expand All @@ -330,7 +330,7 @@ func TestGetBtcEvent(t *testing.T) {
require.NoError(t, err)
require.Equal(t, eventExpected, event)
})
t.Run("should get BTC intx event from P2TR sender", func(t *testing.T) {
t.Run("should get BTC inbound event from P2TR sender", func(t *testing.T) {
// replace vin with a P2TR vin, so the sender address will change
// https://mempool.space/tx/3618e869f9e87863c0f1cc46dbbaa8b767b4a5d6d60b143c2c50af52b257e867
preHash := "3618e869f9e87863c0f1cc46dbbaa8b767b4a5d6d60b143c2c50af52b257e867"
Expand All @@ -345,7 +345,7 @@ func TestGetBtcEvent(t *testing.T) {
require.NoError(t, err)
require.Equal(t, eventExpected, event)
})
t.Run("should get BTC intx event from P2WSH sender", func(t *testing.T) {
t.Run("should get BTC inbound event from P2WSH sender", func(t *testing.T) {
// replace vin with a P2WSH vin, so the sender address will change
// https://mempool.space/tx/d13de30b0cc53b5c4702b184ae0a0b0f318feaea283185c1cddb8b341c27c016
preHash := "d13de30b0cc53b5c4702b184ae0a0b0f318feaea283185c1cddb8b341c27c016"
Expand All @@ -360,7 +360,7 @@ func TestGetBtcEvent(t *testing.T) {
require.NoError(t, err)
require.Equal(t, eventExpected, event)
})
t.Run("should get BTC intx event from P2SH sender", func(t *testing.T) {
t.Run("should get BTC inbound event from P2SH sender", func(t *testing.T) {
// replace vin with a P2SH vin, so the sender address will change
// https://mempool.space/tx/211568441340fd5e10b1a8dcb211a18b9e853dbdf265ebb1c728f9b52813455a
preHash := "211568441340fd5e10b1a8dcb211a18b9e853dbdf265ebb1c728f9b52813455a"
Expand All @@ -375,7 +375,7 @@ func TestGetBtcEvent(t *testing.T) {
require.NoError(t, err)
require.Equal(t, eventExpected, event)
})
t.Run("should get BTC intx event from P2PKH sender", func(t *testing.T) {
t.Run("should get BTC inbound event from P2PKH sender", func(t *testing.T) {
// replace vin with a P2PKH vin, so the sender address will change
// https://mempool.space/tx/781fc8d41b476dbceca283ebff9573fda52c8fdbba5e78152aeb4432286836a7
preHash := "781fc8d41b476dbceca283ebff9573fda52c8fdbba5e78152aeb4432286836a7"
Expand Down Expand Up @@ -465,7 +465,7 @@ func TestGetBtcEvent(t *testing.T) {
}

func TestGetBtcEventErrors(t *testing.T) {
// load archived intx P2WPKH raw result
// load archived inbound P2WPKH raw result
// https://mempool.space/tx/847139aa65aa4a5ee896375951cbf7417cfc8a4d6f277ec11f40cd87319f04aa
txHash := "847139aa65aa4a5ee896375951cbf7417cfc8a4d6f277ec11f40cd87319f04aa"
chain := chains.BtcMainnetChain
Expand Down
Loading

0 comments on commit d54cdc9

Please sign in to comment.