Skip to content

int64 -> uint64 #4288

Open
Open
@tim2CF

Description

@tim2CF

Background

In many places of LND gRPC protobuf documents is used int64 type instead of uint64 or uint32, even if value will never be negative, and negative numbers don't make any sense in context. For example (just some of many)

dates

lnd/lnrpc/rpc.proto

Lines 2838 to 2842 in 3190437

/// When this invoice was created
int64 creation_date = 7;
/// When this invoice was settled
int64 settle_date = 8;

and money amounts

lnd/lnrpc/rpc.proto

Lines 2896 to 2904 in 3190437

/**
The amount that was accepted for this invoice, in satoshis. This will ONLY
be set if this invoice has been settled. We provide this field as if the
invoice was created with a zero value, then we need to record what amount
was ultimately accepted. Additionally, it's possible that the sender paid
MORE that was specified in the original invoice. So we'll record that here
as well.
*/
int64 amt_paid_sat = 19;

int64 value = 5;

I'm not expert in BOLT protocol, and I don't know many details. Maybe these values actually can be negative, I don't know. But if they can't - transition to uint64 or uint32 might be good improvement, and will reduce complexity everywhere including third-party applications which are using gRPC to communicate with LND.

Your environment

  • grpc-1.23.0
  • lnd version 0.10.0-beta
  • Linux 4b3ce405f0cb 4.19.76-linuxkit Fix name typo in README #1 SMP Fri Apr 3 15:53:26 UTC 2020 x86_64 GNU/Linux
  • Bitcoin Core Daemon version v0.18.1.0-gfa27a0760792b251585f2a70eccdd547f915b7e4

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementImprovements to existing features / behaviourgRPCprotosrpcRelated to the RPC interface

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions