@@ -19,7 +19,6 @@ import (
1919 token2 "github.com/hyperledger-labs/fabric-token-sdk/token"
2020 "github.com/hyperledger-labs/fabric-token-sdk/token/services/ttx"
2121 "github.com/hyperledger-labs/fabric-token-sdk/token/token"
22- "go.opentelemetry.io/otel/trace"
2322)
2423
2524// TransferAction defines a transfer action
@@ -76,19 +75,16 @@ type TransferView struct {
7675}
7776
7877func (t * TransferView ) Call (context view.Context ) (txID interface {}, err error ) {
79- span := trace .SpanFromContext (context .Context ())
8078
8179 // As a first step operation, the sender contacts the recipient's FSC node
8280 // to ask for the identity to use to assign ownership of the freshly created token.
8381 // Notice that, this step would not be required if the sender knew already which
8482 // identity the recipient wants to use.
8583 // If t.RecipientData is different from nil, then this recipient data will be advertised to the recipient
8684 // to make sure the recipient is aware of this identity the will be used to transfer tokens to
87- span .AddEvent ("receive_recipient_identity" )
8885 recipient , err := ttx .RequestRecipientIdentity (context , t .Recipient , ServiceOpts (t .TMSID , ttx .WithRecipientData (t .RecipientData ), ttx .WithRecipientWalletID (t .RecipientWalletID ))... )
8986 assert .NoError (err , "failed getting recipient" )
9087
91- span .AddEvent ("add_additional_recipients" )
9288 wm := token2 .GetManagementService (context , ServiceOpts (t .TMSID )... ).WalletManager ()
9389 // if there are more recipients, ask for their recipient identity
9490 var additionalRecipients []view.Identity
@@ -111,7 +107,7 @@ func (t *TransferView) Call(context view.Context) (txID interface{}, err error)
111107 // and specify the auditor that must be contacted to approve the operation.
112108 var tx * ttx.Transaction
113109 txOpts := TxOpts (t .TMSID , ttx .WithAuditor (view2 .GetIdentityProvider (context ).Identity (t .Auditor )))
114- span . AddEvent ( "create_transfer " )
110+ logger . DebugfContext ( context . Context (), "Create transfer " )
115111 if ! t .NotAnonymous {
116112 // create an anonymous transaction (this means that the resulting Fabric transaction will be signed using idemix, for example),
117113 tx , err = ttx .NewAnonymousTransaction (context , txOpts ... )
@@ -139,7 +135,7 @@ func (t *TransferView) Call(context view.Context) (txID interface{}, err error)
139135 // selector.Select(wallet, amount, tokenType)
140136 // It is also possible to pass a custom token selector to the Transfer function by using the relative opt:
141137 // token2.WithTokenSelector(selector).
142- span . AddEvent ( "append_transfer " )
138+ logger . DebugfContext ( context . Context (), "Append transfer " )
143139 err = tx .Transfer (
144140 senderWallet ,
145141 t .Type ,
@@ -151,7 +147,7 @@ func (t *TransferView) Call(context view.Context) (txID interface{}, err error)
151147 assert .NoError (err , "failed adding transfer action [%d:%s]" , t .Amount , t .Recipient )
152148
153149 // add additional transfers
154- span . AddEvent ( "add_additional_transfers " )
150+ logger . DebugfContext ( context . Context (), "Append additional actions " )
155151 for i , action := range t .TransferAction {
156152 err = tx .Transfer (
157153 senderWallet ,
@@ -184,26 +180,24 @@ func (t *TransferView) Call(context view.Context) (txID interface{}, err error)
184180 stream := view4 .GetStream (context )
185181 endorserOpts = append (endorserOpts , ttx .WithExternalWalletSigner (t .Wallet , ttx .NewStreamExternalWalletSignerServer (stream )))
186182 }
187- span . AddEvent ( "collect_endorsements" )
183+
188184 _ , err = context .RunView (ttx .NewCollectEndorsementsView (tx , endorserOpts ... ))
189185 assert .NoError (err , "failed to sign transaction [<<<%s>>>]" , tx .ID ())
190186
191187 // Sanity checks:
192188 // - the transaction is in pending state
193- span . AddEvent ( "verify_owner " )
189+ logger . DebugfContext ( context . Context (), "Verify owner " )
194190 owner := ttx .NewOwner (context , tx .TokenService ())
195191 vc , _ , err := owner .GetStatus (context .Context (), tx .ID ())
196192 assert .NoError (err , "failed to retrieve status for transaction [%s]" , tx .ID ())
197193 assert .Equal (ttx .Pending , vc , "transaction [%s] should be in busy state" , tx .ID ())
198194
199195 // Send to the ordering service and wait for finality
200- span .AddEvent ("ask_ordering_finality" )
201196 _ , err = context .RunView (ttx .NewOrderingAndFinalityView (tx ))
202197 assert .NoError (err , "failed asking ordering" )
203198
204199 // Sanity checks:
205200 // - the transaction is in confirmed state
206- span .AddEvent ("verify_tx_status" )
207201 vc , _ , err = owner .GetStatus (context .Context (), tx .ID ())
208202 assert .NoError (err , "failed to retrieve status for transaction [%s]" , tx .ID ())
209203 assert .Equal (ttx .Confirmed , vc , "transaction [%s] should be in valid state" , tx .ID ())
0 commit comments