@@ -171,22 +171,82 @@ func (p *ChainPorter) resumePendingParcels() error {
171171 return err
172172 }
173173
174+ // Return early if there are no pending parcels to resume.
175+ if len (outboundParcels ) == 0 {
176+ log .Info ("No pending parcels to resume" )
177+ return nil
178+ }
179+
180+ log .Infof ("Attempting to resume asset transfer for %d parcels" ,
181+ len (outboundParcels ))
182+
174183 // We resume delivery using the normal parcel delivery mechanism by
175184 // converting the outbound parcels into pending parcels.
176185 for idx := range outboundParcels {
177186 outboundParcel := outboundParcels [idx ]
178- log .Infof ("Attempting to resume delivery for anchor_txid=%v" ,
179- outboundParcel .AnchorTx .TxHash ().String ())
187+
188+ pendingParcel := NewPendingParcel (outboundParcel )
189+ reportPendingParcel (* pendingParcel )
180190
181191 // At this point the asset porter should be running. It should
182192 // therefore pick up the pending parcels from the channel and
183193 // attempt to deliver them.
184- p .outboundParcels <- NewPendingParcel ( outboundParcel )
194+ p .outboundParcels <- pendingParcel
185195 }
186196
187197 return nil
188198}
189199
200+ // reportPendingParcel logs information about a pending parcel.
201+ func reportPendingParcel (pendingParcel PendingParcel ) {
202+ outboundParcel := pendingParcel .pkg ().OutboundPkg
203+
204+ // Formulate a log entry for each proof delivery pending transfer output
205+ // for the pending parcel.
206+ var outputLogStrings []string
207+
208+ for idx := range outboundParcel .Outputs {
209+ transferOut := outboundParcel .Outputs [idx ]
210+
211+ // Process only the proof outputs that are pending delivery.
212+ // Skip outputs with proofs that don't need to be delivered to a
213+ // peer (none) or those with proofs already delivered
214+ // (some true).
215+ if transferOut .ProofDeliveryComplete .UnwrapOr (true ) {
216+ continue
217+ }
218+
219+ // Construct a log string for the transfer output.
220+ skBytes := transferOut .ScriptKey .PubKey .SerializeCompressed ()
221+ proofCourierAddr := string (
222+ transferOut .ProofCourierAddr ,
223+ )
224+
225+ outputLog := fmt .Sprintf (
226+ "transfer_output_idx=%d, script_key=%x, " +
227+ "proof_courier_addr=%s" ,
228+ idx , skBytes , proofCourierAddr ,
229+ )
230+ outputLogStrings = append (
231+ outputLogStrings , outputLog ,
232+ )
233+ }
234+
235+ log .Infof ("Encountered pending parcel " +
236+ "(anchor_txid=%v, count_undelivered_proofs=%d)" ,
237+ outboundParcel .AnchorTx .TxHash ().String (),
238+ len (outputLogStrings ))
239+
240+ // If there are any outputs with pending delivery proofs, we'll log
241+ // them here.
242+ if len (outputLogStrings ) > 0 {
243+ perOutputLog := strings .Join (outputLogStrings , "\n " )
244+
245+ log .Debugf ("Transfer output(s) with delivery pending " +
246+ "proofs:\n %v" , perOutputLog )
247+ }
248+ }
249+
190250// Stop signals that the chain porter should gracefully stop.
191251func (p * ChainPorter ) Stop () error {
192252 var stopErr error
@@ -662,8 +722,10 @@ func (p *ChainPorter) transferReceiverProof(pkg *sendPackage) error {
662722 }
663723
664724 if ! shouldDeliverProof {
665- log .Debugf ("Not delivering transfer ouput proof " +
666- "(proof_delivery_status=%v, script_key=%x)" ,
725+ log .Debugf ("Transfer ouput proof does not require " +
726+ "delivery (transfer_output_position=%d, " +
727+ "proof_delivery_status=%v, " +
728+ "script_key=%x)" , out .Position ,
667729 out .ProofDeliveryComplete ,
668730 key .SerializeCompressed ())
669731 return nil
@@ -684,8 +746,9 @@ func (p *ChainPorter) transferReceiverProof(pkg *sendPackage) error {
684746 "script key %x" , key .SerializeCompressed ())
685747 }
686748
687- log .Debugf ("Attempting to deliver proof for script key %x" ,
688- key .SerializeCompressed ())
749+ log .Debugf ("Attempting to deliver proof (script_key=%x, " +
750+ "proof_courier_addr=%s)" , key .SerializeCompressed (),
751+ out .ProofCourierAddr )
689752
690753 proofCourierAddr , err := proof .ParseCourierAddress (
691754 string (out .ProofCourierAddr ),
0 commit comments