Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

paystatus: remove doubled amount_msat. #4911

Conversation

rustyrussell
Copy link
Contributor

It's always been there:

{
   "pay": [
      {
         "bolt11": "...",
         "amount_msat": "1000msat",
         "amount_msat": "1000msat",
         "destination": "03...",
         "attempts": [
            {
               "strategy": "Initial attempt",
               "start_time": "2021-11-06T04:20:20.135Z",
               "age_in_seconds": 229032,
               "end_time": "2021-11-06T04:20:27.792Z",
               "state": "completed",
               "success": {
                  "id": 31994,
                  "payment_preimage": "..."
               }
            }
         ]
      }
   ]
}

Reported-by: denis2342 on IRC
Changelog-Fixed: JSON-RPC: paystatus entries no longer have two identical amount_msat entries.
Signed-off-by: Rusty Russell rusty@rustcorp.com.au

Copy link
Contributor

@vincenzopalazzo vincenzopalazzo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ack 105b096

@denis2342
Copy link
Contributor

denis2342 commented Nov 8, 2021

my proposal would be to replace both these amount_msat lines with the following line:

json_add_amount_msat_compat(ret, p->amount, "msatoshi", "amount_msat");

This generates two fields, one as string and one as integer, both msat.

@rustyrussell
Copy link
Contributor Author

my proposal would be to replace both these amount_msat lines with the following line:

json_add_amount_msat_compat(ret, p->amount, "msatoshi", "amount_msat");

This generates two fields, one as string and one as integer, both msat.

The "msatoshi" fields are being slowly deprecated, though. The intention is that all amounts are explicitly "msat" (we had errors early on when amounts were specified differently in different places).

@denis2342
Copy link
Contributor

my proposal would be to replace both these amount_msat lines with the following line:
json_add_amount_msat_compat(ret, p->amount, "msatoshi", "amount_msat");
This generates two fields, one as string and one as integer, both msat.

The "msatoshi" fields are being slowly deprecated, though. The intention is that all amounts are explicitly "msat" (we had errors early on when amounts were specified differently in different places).

So no integer field is wanted?

@ZmnSCPxj
Copy link
Contributor

ZmnSCPxj commented Nov 9, 2021

So no integer field is wanted?

Correct, the intent is to always use a string with an explicit unit.

It's always been there:

```
{
   "pay": [
      {
         "bolt11": "...",
         "amount_msat": "1000msat",
         "amount_msat": "1000msat",
         "destination": "03...",
         "attempts": [
            {
               "strategy": "Initial attempt",
               "start_time": "2021-11-06T04:20:20.135Z",
               "age_in_seconds": 229032,
               "end_time": "2021-11-06T04:20:27.792Z",
               "state": "completed",
               "success": {
                  "id": 31994,
                  "payment_preimage": "..."
               }
            }
         ]
      }
   ]
}
```

Reported-by: denis2342 on IRC
Changelog-Fixed: JSON-RPC: `paystatus` entries no longer have two identical `amount_msat` entries.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
@rustyrussell rustyrussell force-pushed the remove-paystatus-doubled-amount_msat branch from 105b096 to 9fbcc16 Compare November 15, 2021 04:21
@rustyrussell
Copy link
Contributor Author

Trivial rebase on master.

Ack 9fbcc16

@rustyrussell rustyrussell merged commit cd36436 into ElementsProject:master Nov 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants