htlcswitch: merge copy htlc custom records

This commit is contained in:
Carla Kirk-Cohen committed 2024-11-07 13:46:54 -05:00
1 parent 0899077fb5
commit 7896bef2a0
4 files changed
+13 -18

No files matched your search

+6 -3
View File
@@ -715,9 +715,12 @@ func (f *interceptedForward) ResumeModified(
htlc.Amount = amount htlc.Amount = amount
}) })
if len(validatedRecords) > 0 { // Merge custom records with any validated records that were
htlc.CustomRecords = validatedRecords // added in the modify request, overwriting any existing values
} // with those supplied in the modifier API.
htlc.CustomRecords = htlc.CustomRecords.MergedCopy(
validatedRecords,
)
case *lnwire.UpdateFulfillHTLC: case *lnwire.UpdateFulfillHTLC:
if len(validatedRecords) > 0 { if len(validatedRecords) > 0 {
+3 -7
View File
@@ -3254,13 +3254,9 @@ type ForwardHtlcInterceptResponse struct {
// the resumed HTLC. This field is ignored if the action is not // the resumed HTLC. This field is ignored if the action is not
// RESUME_MODIFIED. // RESUME_MODIFIED.
// //
// If this map is populated, it will overwrite any of the wire custom // This map will merge with the existing set of custom records (if any),
// records set by LND. It is the caller's responsibility to copy any desired // replacing any conflicting types. Note that there currently is no support
// records across. If the map is empty, no action will be taken and existing // for deleting existing custom records (they can only be replaced).
// custom records will be propagated.
//
// The API does not currently support deleting custom records, unless they
// are overwritten by a new set.
OutWireCustomRecords map[uint64][]byte `protobuf:"bytes,8,rep,name=out_wire_custom_records,json=outWireCustomRecords,proto3" json:"out_wire_custom_records,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` OutWireCustomRecords map[uint64][]byte `protobuf:"bytes,8,rep,name=out_wire_custom_records,json=outWireCustomRecords,proto3" json:"out_wire_custom_records,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
} }
+3 -7
View File
@@ -1064,13 +1064,9 @@ message ForwardHtlcInterceptResponse {
// the resumed HTLC. This field is ignored if the action is not // the resumed HTLC. This field is ignored if the action is not
// RESUME_MODIFIED. // RESUME_MODIFIED.
// //
// If this map is populated, it will overwrite any of the wire custom // This map will merge with the existing set of custom records (if any),
// records set by LND. It is the caller's responsibility to copy any desired // replacing any conflicting types. Note that there currently is no support
// records across. If the map is empty, no action will be taken and existing // for deleting existing custom records (they can only be replaced).
// custom records will be propagated.
//
// The API does not currently support deleting custom records, unless they
// are overwritten by a new set.
map<uint64, bytes> out_wire_custom_records = 8; map<uint64, bytes> out_wire_custom_records = 8;
} }
+1 -1
View File
@@ -1525,7 +1525,7 @@
"type": "string", "type": "string",
"format": "byte" "format": "byte"
}, },
"description": "Any custom records that should be set on the p2p wire message message of\nthe resumed HTLC. This field is ignored if the action is not\nRESUME_MODIFIED.\n\nIf this map is populated, it will overwrite any of the wire custom\nrecords set by LND. It is the caller's responsibility to copy any desired\nrecords across. If the map is empty, no action will be taken and existing\ncustom records will be propagated.\n\nThe API does not currently support deleting custom records, unless they\nare overwritten by a new set." "description": "Any custom records that should be set on the p2p wire message message of\nthe resumed HTLC. This field is ignored if the action is not\nRESUME_MODIFIED.\n\nThis map will merge with the existing set of custom records (if any),\nreplacing any conflicting types. Note that there currently is no support\nfor deleting existing custom records (they can only be replaced)."
} }
}, },
"description": "*\nForwardHtlcInterceptResponse enables the caller to resolve a previously hold\nforward. The caller can choose either to:\n- `Resume`: Execute the default behavior (usually forward).\n- `ResumeModified`: Execute the default behavior (usually forward) with HTLC\nfield modifications.\n- `Reject`: Fail the htlc backwards.\n- `Settle`: Settle this htlc with a given preimage." "description": "*\nForwardHtlcInterceptResponse enables the caller to resolve a previously hold\nforward. The caller can choose either to:\n- `Resume`: Execute the default behavior (usually forward).\n- `ResumeModified`: Execute the default behavior (usually forward) with HTLC\nfield modifications.\n- `Reject`: Fail the htlc backwards.\n- `Settle`: Settle this htlc with a given preimage."