Skip to content

Commit

Permalink
fix contract address
Browse files Browse the repository at this point in the history
  • Loading branch information
CoderZhi committed Mar 9, 2024
1 parent d808f0f commit 083250c
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion api/serverV2_integrity_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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 {
Expand Down

0 comments on commit 083250c

Please sign in to comment.