Skip to content

Commit

Permalink
lsps2: remove broken extra_fee TLV
Browse files Browse the repository at this point in the history
  • Loading branch information
JssDWt committed Sep 4, 2023
1 parent 6651cbd commit d16ffd2
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions cln/cln_interceptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,16 +293,18 @@ func encodePayloadWithNextHop(payload []byte, scid lightning.ShortChannelID, amo
uTlvMap[uint64(t)] = b
}

if feeMsat != nil {
// Add an extra_fee record.
fee := shared.NewExtraFeeRecord(feeMsat)
feebuf := bytes.NewBuffer([]byte{})
if err := fee.Encode(feebuf); err != nil {
return nil, fmt.Errorf("failed to encode extra_fee %x: %v", innerPayload[:], err)
}

uTlvMap[uint64(shared.ExtraFeeTlvType)] = feebuf.Bytes()
}
// TODO: Add the extra_fee TLV to the update_add_htlc message.
// Below snippet doesn't work.
// if feeMsat != nil {
// // Add an extra_fee record.
// fee := shared.NewExtraFeeRecord(feeMsat)
// feebuf := bytes.NewBuffer([]byte{})
// if err := fee.Encode(feebuf); err != nil {
// return nil, fmt.Errorf("failed to encode extra_fee %x: %v", innerPayload[:], err)
// }

// uTlvMap[uint64(shared.ExtraFeeTlvType)] = feebuf.Bytes()
// }

tlvRecords := tlv.MapToRecords(uTlvMap)
s, err = tlv.NewStream(tlvRecords...)
Expand Down

0 comments on commit d16ffd2

Please sign in to comment.