From 083250cf18d926274aa142f4e9dc08cddd6a03ff Mon Sep 17 00:00:00 2001 From: zhi Date: Sat, 9 Mar 2024 16:43:33 +0800 Subject: [PATCH] fix contract address --- api/serverV2_integrity_test.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/api/serverV2_integrity_test.go b/api/serverV2_integrity_test.go index 7a8a9af2a5..8994d9b664 100644 --- a/api/serverV2_integrity_test.go +++ b/api/serverV2_integrity_test.go @@ -226,6 +226,10 @@ func deployContractV2(bc blockchain.Blockchain, dao blockdao.BlockDAO, actPool a if err != nil { return "", err } + h1, err := ex1.Hash() + if err != nil { + return "", err + } if err := actPool.Add(context.Background(), ex1); err != nil { return "", err } @@ -238,7 +242,12 @@ func deployContractV2(bc blockchain.Blockchain, dao blockdao.BlockDAO, actPool a } actPool.Reset() // get deployed contract address - return blk.Receipts[0].ContractAddress, nil + for _, receipt := range blk.Receipts { + if receipt.ActionHash == h1 { + return receipt.ContractAddress, nil + } + } + return "", errors.New("failed to find execution receipt") } func addActsToActPool(ctx context.Context, ap actpool.ActPool) error {