@@ -643,47 +643,16 @@ func (p *ChainPorter) transferReceiverProof(pkg *sendPackage) error {
643643 deliver := func (ctx context.Context , out TransferOutput ) error {
644644 key := out .ScriptKey .PubKey
645645
646- // If this is an output that is going to our own node/wallet,
647- // we don't need to transfer the proof.
648- if out .ScriptKey .TweakedScriptKey != nil && out .ScriptKeyLocal {
649- log .Debugf ("Not transferring proof for local output " +
650- "script key %x" , key .SerializeCompressed ())
651- return nil
652- }
653-
654- // Un-spendable means this is a tombstone output resulting from
655- // a split.
656- unSpendable , err := out .ScriptKey .IsUnSpendable ()
646+ // We'll first check to see if the proof should be delivered.
647+ shouldDeliverProof , err := out .ShouldDeliverProof ()
657648 if err != nil {
658- return fmt .Errorf ("error checking if script key is " +
659- "unspendable: %w" , err )
660- }
661- if unSpendable {
662- log .Debugf ("Not transferring proof for un-spendable " +
663- "output script key %x" ,
664- key .SerializeCompressed ())
665- return nil
666- }
667-
668- // Burns are also always kept local and not sent to any
669- // receiver.
670- if len (out .WitnessData ) > 0 && asset .IsBurnKey (
671- out .ScriptKey .PubKey , out .WitnessData [0 ],
672- ) {
673-
674- log .Debugf ("Not transferring proof for burn script " +
675- "key %x" , key .SerializeCompressed ())
676- return nil
649+ return fmt .Errorf ("error determining if proof should " +
650+ "be delivered: %w" , err )
677651 }
678652
679- // We can only deliver proofs for outputs that have a proof
680- // courier address. If an output doesn't have one, we assume it
681- // is an interactive send where the recipient is already aware
682- // of the proof or learns of it through another channel.
683- if len (out .ProofCourierAddr ) == 0 {
684- log .Debugf ("Not transferring proof for output with " +
685- "script key %x as it has no proof courier " +
686- "address" , key .SerializeCompressed ())
653+ if ! shouldDeliverProof {
654+ log .Debugf ("Not delivering proof for output with " +
655+ "script key %x" , key .SerializeCompressed ())
687656 return nil
688657 }
689658
0 commit comments