Skip to content

Commit 24265c1

Browse files
committed
fix(fabric-interop-cc): fix function name in comment
Signed-off-by: findmyhappy <[email protected]>
1 parent 8beaa46 commit 24265c1

File tree

2 files changed

+14
-18
lines changed

2 files changed

+14
-18
lines changed

weaver/core/network/fabric-interop-cc/contracts/interop/manage_assets.go

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@
99
package main
1010

1111
import (
12-
"fmt"
1312
"errors"
13+
"fmt"
1414

1515
"github.com/hyperledger-cacti/cacti/weaver/core/network/fabric-interop-cc/libs/assetexchange/v2"
16+
wutils "github.com/hyperledger-cacti/cacti/weaver/core/network/fabric-interop-cc/libs/utils/v2"
1617
"github.com/hyperledger/fabric-contract-api-go/contractapi"
1718
log "github.com/sirupsen/logrus"
18-
wutils "github.com/hyperledger-cacti/cacti/weaver/core/network/fabric-interop-cc/libs/utils/v2"
1919
)
2020

2121
const (
22-
callerCCIdPrefix = "CallerCCId_" // prefix for the caller CC ID map, contractId --> caller-cc-id
22+
callerCCIdPrefix = "CallerCCId_" // prefix for the caller CC ID map, contractId --> caller-cc-id
2323
)
2424

2525
// helper functions to log and return errors
@@ -50,7 +50,7 @@ func (s *SmartContract) LockAsset(ctx contractapi.TransactionContextInterface, a
5050
}
5151

5252
// Start the locking process now
53-
contractId, err := assetexchange.LockAsset(ctx, callerChaincodeID, assetAgreementBytesBase64, lockInfoBytesBase64)
53+
contractId, err := assetexchange.LockAsset(ctx, callerChaincodeID, assetAgreementBytesBase64, lockInfoBytesBase64)
5454
if err != nil {
5555
return "", err
5656
}
@@ -144,7 +144,7 @@ func (s *SmartContract) UnlockAssetUsingContractId(ctx contractapi.TransactionCo
144144
return nil
145145
}
146146

147-
// ClaimAsset cc is used to record claim of an asset on the ledger (this uses the contractId)
147+
// Record claim of an asset on the ledger (this uses the contractId)
148148
func (s *SmartContract) ClaimAssetUsingContractId(ctx contractapi.TransactionContextInterface, contractId string, claimInfoBytesBase64 string) error {
149149
callerChaincodeID, err := wutils.GetLocalChaincodeID(ctx.GetStub())
150150
if err != nil {
@@ -327,5 +327,3 @@ func (s *SmartContract) GetHTLCHashPreImage(ctx contractapi.TransactionContextIn
327327
func (s *SmartContract) GetHTLCHashPreImageByContractId(ctx contractapi.TransactionContextInterface, contractId string) (string, error) {
328328
return assetexchange.GetHTLCHashPreImageByContractId(ctx, contractId)
329329
}
330-
331-

weaver/core/network/fabric-interop-cc/libs/assetexchange/assetSwapContracts.go

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -196,22 +196,22 @@ func ClaimFungibleAsset(ctx contractapi.TransactionContextInterface, contractId,
196196
if err != nil {
197197
return logThenErrorf(err.Error())
198198
}
199-
199+
200200
return claimAssetCommon(ctx, assetLockVal.LockInfo, assetLockVal.ExpiryTimeSecs, assetLockVal.Recipient, "", contractId, claimInfoBytesBase64)
201201
}
202202

203-
// ClaimAsset cc is used to record claim of an asset on the ledger (this uses the contractId)
203+
// Record claim of an asset on the ledger (this uses the contractId)
204204
func ClaimAssetUsingContractId(ctx contractapi.TransactionContextInterface, contractId, claimInfoBytesBase64 string) error {
205205

206206
assetLockKey, assetLockVal, err := fetchLockStateUsingContractId(ctx, contractId)
207207
if err != nil {
208208
return logThenErrorf(err.Error())
209209
}
210-
210+
211211
return claimAssetCommon(ctx, assetLockVal.GetLockInfo(), assetLockVal.GetExpiryTimeSecs(), assetLockVal.GetRecipient(), assetLockKey, contractId, claimInfoBytesBase64)
212212
}
213213

214-
// Common Claim function for both fungible and non-fungible assets,
214+
// Common Claim function for both fungible and non-fungible assets,
215215
// with or without contractId
216216
func claimAssetCommon(ctx contractapi.TransactionContextInterface, lockInfo interface{}, expiryTimeSecs uint64, recipient, assetLockKey, contractId, claimInfoBytesBase64 string) error {
217217

@@ -261,7 +261,7 @@ func claimAssetCommon(ctx contractapi.TransactionContextInterface, lockInfo inte
261261
if err != nil {
262262
return logThenErrorf("failed to delete lock for the asset associated with the contractId %s: %+v", contractId, err)
263263
}
264-
264+
265265
err = ctx.GetStub().PutState(generateAssetLockMapKey(assetLockKey), []byte(contractId))
266266
if err != nil {
267267
return logThenErrorf("failed to write to the world state: %+v", err)
@@ -333,7 +333,7 @@ func UnlockFungibleAsset(ctx contractapi.TransactionContextInterface, contractId
333333
if err != nil {
334334
return logThenErrorf(err.Error())
335335
}
336-
336+
337337
return unlockAssetCommon(ctx, assetLockVal.ExpiryTimeSecs, assetLockVal.Locker, "", contractId)
338338
}
339339

@@ -344,14 +344,14 @@ func UnlockAssetUsingContractId(ctx contractapi.TransactionContextInterface, con
344344
if err != nil {
345345
return logThenErrorf(err.Error())
346346
}
347-
347+
348348
return unlockAssetCommon(ctx, assetLockVal.GetExpiryTimeSecs(), assetLockVal.GetLocker(), assetLockKey, contractId)
349349
}
350350

351351
// Common unlock functions for both fungible and non-fungible assets,
352352
// with or without contractId
353353
func unlockAssetCommon(ctx contractapi.TransactionContextInterface, expiryTimeSecs uint64, locker, assetLockKey, contractId string) error {
354-
354+
355355
txCreatorECertBase64, err := getECertOfTxCreatorBase64(ctx)
356356
if err != nil {
357357
return logThenErrorf("unable to get the transaction creator information: %+v", err)
@@ -470,7 +470,7 @@ func IsAssetLockedQueryUsingContractId(ctx contractapi.TransactionContextInterfa
470470
if err != nil {
471471
errStr := fmt.Sprintf("no contractId %s exists on the ledger", contractId)
472472
errStrFungible := fmt.Sprintf("contractId %s is not associated with any currently locked asset", contractId)
473-
473+
474474
// Reporting no error only if the lock contract doesn't exist at all
475475
if err.Error() == errStr || err.Error() == errStrFungible {
476476
return false, nil
@@ -486,5 +486,3 @@ func IsAssetLockedQueryUsingContractId(ctx contractapi.TransactionContextInterfa
486486

487487
return true, nil
488488
}
489-
490-

0 commit comments

Comments
 (0)