Skip to content

Commit 99daf3d

Browse files
committed
taprpc: add proof delivery status field to RPC TransferOutput message
This commit enhances the ListTransfers RPC endpoint by adding the proof delivery status for each transfer output in its response.
1 parent 9946cac commit 99daf3d

File tree

6 files changed

+860
-704
lines changed

6 files changed

+860
-704
lines changed

rpcserver.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3364,6 +3364,9 @@ func marshalOutboundParcel(
33643364
return nil, err
33653365
}
33663366

3367+
// Marshall the proof delivery status.
3368+
proofDeliveryStatus := marshalOutputProofDeliveryStatus(out)
3369+
33673370
rpcOutputs[idx] = &taprpc.TransferOutput{
33683371
Anchor: rpcAnchor,
33693372
ScriptKey: scriptPubKey.SerializeCompressed(),
@@ -3375,6 +3378,7 @@ func marshalOutboundParcel(
33753378
SplitCommitRootHash: splitCommitRoot,
33763379
OutputType: rpcOutType,
33773380
AssetVersion: assetVersion,
3381+
ProofDeliveryStatus: proofDeliveryStatus,
33783382
}
33793383
}
33803384

@@ -3397,6 +3401,23 @@ func marshalOutboundParcel(
33973401
}, nil
33983402
}
33993403

3404+
// marshalOutputProofDeliveryStatus turns the output proof delivery status into
3405+
// the RPC counterpart.
3406+
func marshalOutputProofDeliveryStatus(
3407+
out tapfreighter.TransferOutput) taprpc.ProofDeliveryStatus {
3408+
3409+
proofDeliveryStatus := taprpc.ProofDeliveryStatusNotApplicable
3410+
out.ProofDeliveryComplete.WhenSome(func(complete bool) {
3411+
if complete {
3412+
proofDeliveryStatus = taprpc.ProofDeliveryStatusComplete
3413+
} else {
3414+
proofDeliveryStatus = taprpc.ProofDeliveryStatusPending
3415+
}
3416+
})
3417+
3418+
return proofDeliveryStatus
3419+
}
3420+
34003421
// marshalOutputType turns the transfer output type into the RPC counterpart.
34013422
func marshalOutputType(outputType tappsbt.VOutputType) (taprpc.OutputType,
34023423
error) {

taprpc/assetwalletrpc/assetwallet.swagger.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -941,6 +941,16 @@
941941
"default": "OUTPUT_TYPE_SIMPLE",
942942
"description": " - OUTPUT_TYPE_SIMPLE: OUTPUT_TYPE_SIMPLE is a plain full-value or split output that is not a\nsplit root and does not carry passive assets. In case of a split, the\nasset of this output has a split commitment.\n - OUTPUT_TYPE_SPLIT_ROOT: OUTPUT_TYPE_SPLIT_ROOT is a split root output that carries the change\nfrom a split or a tombstone from a non-interactive full value send\noutput. In either case, the asset of this output has a tx witness."
943943
},
944+
"taprpcProofDeliveryStatus": {
945+
"type": "string",
946+
"enum": [
947+
"PROOF_DELIVERY_STATUS_NOT_APPLICABLE",
948+
"PROOF_DELIVERY_STATUS_COMPLETE",
949+
"PROOF_DELIVERY_STATUS_PENDING"
950+
],
951+
"default": "PROOF_DELIVERY_STATUS_NOT_APPLICABLE",
952+
"description": "ProofDeliveryStatus is an enum that describes the status of the delivery of\na proof associated with an asset transfer output.\n\n - PROOF_DELIVERY_STATUS_NOT_APPLICABLE: Delivery is not applicable; the proof will not be delivered.\n - PROOF_DELIVERY_STATUS_COMPLETE: The proof has been successfully delivered.\n - PROOF_DELIVERY_STATUS_PENDING: The proof is pending delivery. This status indicates that the proof has\nnot yet been delivered successfully. One or more attempts at proof\ndelivery may have been made."
953+
},
944954
"taprpcScriptKey": {
945955
"type": "object",
946956
"properties": {
@@ -1031,6 +1041,10 @@
10311041
"relative_lock_time": {
10321042
"type": "string",
10331043
"format": "uint64"
1044+
},
1045+
"proof_delivery_status": {
1046+
"$ref": "#/definitions/taprpcProofDeliveryStatus",
1047+
"description": "The delivery status of the proof associated with this output."
10341048
}
10351049
}
10361050
},

taprpc/marshal.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,15 @@ import (
2020
"github.com/lightningnetwork/lnd/keychain"
2121
)
2222

23+
// Shorthand for the asset transfer output proof delivery status enum.
24+
//
25+
// nolint: lll
26+
var (
27+
ProofDeliveryStatusNotApplicable = ProofDeliveryStatus_PROOF_DELIVERY_STATUS_NOT_APPLICABLE
28+
ProofDeliveryStatusComplete = ProofDeliveryStatus_PROOF_DELIVERY_STATUS_COMPLETE
29+
ProofDeliveryStatusPending = ProofDeliveryStatus_PROOF_DELIVERY_STATUS_PENDING
30+
)
31+
2332
// KeyLookup is used to determine whether a key is under the control of the
2433
// local wallet.
2534
type KeyLookup interface {

0 commit comments

Comments
 (0)