Skip to content

Commit bb41b6f

Browse files
committed
rpcserver: allow parcel to be nil
1 parent 1da727b commit bb41b6f

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

rpcserver.go

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4300,21 +4300,28 @@ func marshalSendEvent(event fn.Event) (*taprpc.SendEvent, error) {
43004300
}
43014301
}
43024302

4303-
switch e.Parcel.(type) {
4304-
case *tapfreighter.AddressParcel:
4305-
result.ParcelType = taprpc.ParcelType_PARCEL_TYPE_ADDRESS
4303+
if e.Parcel != nil {
4304+
switch e.Parcel.(type) {
4305+
case *tapfreighter.AddressParcel:
4306+
result.ParcelType =
4307+
taprpc.ParcelType_PARCEL_TYPE_ADDRESS
43064308

4307-
case *tapfreighter.PreSignedParcel:
4308-
result.ParcelType = taprpc.ParcelType_PARCEL_TYPE_PRE_SIGNED
4309+
case *tapfreighter.PreSignedParcel:
4310+
result.ParcelType =
4311+
taprpc.ParcelType_PARCEL_TYPE_PRE_SIGNED
43094312

4310-
case *tapfreighter.PendingParcel:
4311-
result.ParcelType = taprpc.ParcelType_PARCEL_TYPE_PENDING
4313+
case *tapfreighter.PendingParcel:
4314+
result.ParcelType =
4315+
taprpc.ParcelType_PARCEL_TYPE_PENDING
43124316

4313-
case *tapfreighter.PreAnchoredParcel:
4314-
result.ParcelType = taprpc.ParcelType_PARCEL_TYPE_PRE_ANCHORED
4317+
case *tapfreighter.PreAnchoredParcel:
4318+
result.ParcelType =
4319+
taprpc.ParcelType_PARCEL_TYPE_PRE_ANCHORED
43154320

4316-
default:
4317-
return nil, fmt.Errorf("unknown parcel type %T", e.Parcel)
4321+
default:
4322+
return nil, fmt.Errorf("unknown parcel type %T",
4323+
e.Parcel)
4324+
}
43184325
}
43194326

43204327
if e.AnchorTx != nil {

0 commit comments

Comments
 (0)