tlv+record+routing: add payload size calculation

This commit is contained in:
Joost Jager committed 2019-12-20 11:00:01 +01:00
1 parent 72a6383975
commit e8fd05e8e3
4 files changed
+121 -1

No files matched your search

+5
View File
@@ -98,6 +98,11 @@ func (r *MPP) Record() tlv.Record {
)
}
// PayloadSize returns the size this record takes up in encoded form.
func (r *MPP) PayloadSize() uint64 {
return 32 + tlv.SizeTUint64(uint64(r.totalMsat))
}
// String returns a human-readable representation of the mpp payload field.
func (r *MPP) String() string {
return fmt.Sprintf("total=%v, addr=%x", r.totalMsat, r.paymentAddr)