@@ -126,6 +126,12 @@ type (
126126 // output.
127127 NewTransferOutput = sqlc.InsertAssetTransferOutputParams
128128
129+ // OutputProofDeliveryStatus wraps the params needed to set the delivery
130+ // status of a given output proof.
131+ //
132+ // nolint: lll
133+ OutputProofDeliveryStatus = sqlc.SetTransferOutputProofDeliveryStatusParams
134+
129135 // NewPassiveAsset wraps the params needed to insert a new passive
130136 // asset.
131137 NewPassiveAsset = sqlc.InsertPassiveAssetParams
@@ -278,6 +284,11 @@ type ActiveAssetsStore interface {
278284 InsertAssetTransferOutput (ctx context.Context ,
279285 arg NewTransferOutput ) error
280286
287+ // SetTransferOutputProofDeliveryStatus sets the delivery status of a
288+ // given transfer output proof.
289+ SetTransferOutputProofDeliveryStatus (ctx context.Context ,
290+ arg OutputProofDeliveryStatus ) error
291+
281292 // FetchTransferInputs fetches the inputs to a given asset transfer.
282293 FetchTransferInputs (ctx context.Context ,
283294 transferID int64 ) ([]TransferInputRow , error )
@@ -2750,6 +2761,43 @@ func (a *AssetStore) QueryProofTransferLog(ctx context.Context,
27502761 return timestamps , err
27512762}
27522763
2764+ // ConfirmProofDelivery marks a transfer output proof as successfully
2765+ // delivered to counterparty.
2766+ func (a * AssetStore ) ConfirmProofDelivery (ctx context.Context ,
2767+ anchorOutpoint wire.OutPoint , outputPosition uint64 ) error {
2768+
2769+ // Serialize the anchor outpoint to bytes.
2770+ anchorOutpointBytes , err := encodeOutpoint (anchorOutpoint )
2771+ if err != nil {
2772+ return fmt .Errorf ("unable to encode anchor outpoint: %w" , err )
2773+ }
2774+
2775+ // Ensure that the position value can be stored in a 32-bit integer.
2776+ // Type cast if possible, otherwise return an error.
2777+ if outputPosition > math .MaxInt32 {
2778+ return fmt .Errorf ("position value is too large for db: %d" ,
2779+ outputPosition )
2780+ }
2781+ outPosition := int32 (outputPosition )
2782+
2783+ var writeTxOpts AssetStoreTxOptions
2784+
2785+ err = a .db .ExecTx (ctx , & writeTxOpts , func (q ActiveAssetsStore ) error {
2786+ params := OutputProofDeliveryStatus {
2787+ DeliveryComplete : sqlBool (true ),
2788+ SerializedAnchorOutpoint : anchorOutpointBytes ,
2789+ Position : outPosition ,
2790+ }
2791+ return q .SetTransferOutputProofDeliveryStatus (ctx , params )
2792+ })
2793+ if err != nil {
2794+ return fmt .Errorf ("failed to confirm transfer output proof " +
2795+ "delivery status in db: %w" , err )
2796+ }
2797+
2798+ return nil
2799+ }
2800+
27532801// ConfirmParcelDelivery marks a spend event on disk as confirmed. This updates
27542802// the on-chain reference information on disk to point to this new spend.
27552803func (a * AssetStore ) ConfirmParcelDelivery (ctx context.Context ,
0 commit comments