Skip to content

Commit dac604a

Browse files
committed
tapgarden: always notify subscribers on receive complete
This commit moves the notification for subscribers about a transfer being complete from the proof courier only part to the general function we end up in if a transfer is complete.
1 parent 80d9022 commit dac604a

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

tapgarden/custodian.go

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -498,15 +498,6 @@ func (c *Custodian) receiveProof(addr *address.Tap, op wire.OutPoint) {
498498
log.Errorf("Unable to import proofs: %v", err)
499499
return
500500
}
501-
502-
// At this point the "receive" process is complete. We will now notify
503-
// all status event subscribers.
504-
receiveCompleteEvent := NewAssetRecvCompleteEvent(*addr, op)
505-
err = c.publishSubscriberStatusEvent(receiveCompleteEvent)
506-
if err != nil {
507-
log.Errorf("Unable publish status event: %v", err)
508-
return
509-
}
510501
}
511502

512503
// mapToTapAddr attempts to match a transaction output to a Taproot Asset
@@ -707,13 +698,23 @@ func (c *Custodian) mapProofToEvent(p proof.Blob) error {
707698
func (c *Custodian) setReceiveCompleted(event *address.Event,
708699
lastProof *proof.Proof, proofFile *proof.File) error {
709700

701+
// At this point the "receive" process is complete. We will now notify
702+
// all status event subscribers.
703+
receiveCompleteEvent := NewAssetRecvCompleteEvent(
704+
*event.Addr.Tap, event.Outpoint,
705+
)
706+
err := c.publishSubscriberStatusEvent(receiveCompleteEvent)
707+
if err != nil {
708+
log.Errorf("Unable publish status event: %v", err)
709+
}
710+
710711
// The proof is created after a single confirmation. To make sure we
711712
// notice if the anchor transaction is re-organized out of the chain, we
712713
// give all the not-yet-sufficiently-buried proofs in the received proof
713714
// file to the re-org watcher and replace the updated proof in the local
714715
// proof archive if a re-org happens. The sender will do the same, so no
715716
// re-send of the proof is necessary.
716-
err := c.cfg.ProofWatcher.MaybeWatch(
717+
err = c.cfg.ProofWatcher.MaybeWatch(
717718
proofFile, c.cfg.ProofWatcher.DefaultUpdateCallback(),
718719
)
719720
if err != nil {

0 commit comments

Comments
 (0)