wallet: rename enum wallet_payment_status to payment_status.

We use it everywhere, the wallet_ prefix is weird.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2023-07-12 05:11:17 +09:30
parent 19669d886b
commit c7026e56a4
3 changed files with 18 additions and 18 deletions

View File

@@ -37,7 +37,7 @@ struct sendpay_command {
};
static bool string_to_payment_status(const char *status_str, size_t len,
enum wallet_payment_status *status)
enum payment_status *status)
{
if (memeqstr(status_str, len, "complete")) {
*status = PAYMENT_COMPLETE;
@@ -52,7 +52,7 @@ static bool string_to_payment_status(const char *status_str, size_t len,
return false;
}
static const char *payment_status_to_string(const enum wallet_payment_status status)
static const char *payment_status_to_string(const enum payment_status status)
{
switch (status) {
case PAYMENT_COMPLETE:
@@ -1534,9 +1534,9 @@ static struct command_result *param_payment_status(struct command *cmd,
const char *name,
const char *buffer,
const jsmntok_t *tok,
enum wallet_payment_status **status)
enum payment_status **status)
{
*status = tal(cmd, enum wallet_payment_status);
*status = tal(cmd, enum payment_status);
if (string_to_payment_status(buffer + tok->start,
tok->end - tok->start,
*status))
@@ -1555,7 +1555,7 @@ static struct command_result *json_listsendpays(struct command *cmd,
struct json_stream *response;
struct sha256 *rhash;
const char *invstring;
enum wallet_payment_status *status;
enum payment_status *status;
if (!param(cmd, buffer, params,
/* FIXME: parameter should be invstring now */
@@ -1622,7 +1622,7 @@ param_payment_status_nopending(struct command *cmd,
const char *name,
const char *buffer,
const jsmntok_t *tok,
enum wallet_payment_status **status)
enum payment_status **status)
{
struct command_result *res;
@@ -1646,10 +1646,10 @@ static struct command_result *json_delpay(struct command *cmd,
const jsmntok_t *obj UNNEEDED,
const jsmntok_t *params)
{
const enum wallet_payment_status *found_status = NULL;
const enum payment_status *found_status = NULL;
struct json_stream *response;
const struct wallet_payment **payments;
enum wallet_payment_status *status;
enum payment_status *status;
struct sha256 *payment_hash;
u64 *groupid, *partid;
bool found;

View File

@@ -3352,7 +3352,7 @@ u64 wallet_payment_get_groupid(struct wallet *wallet,
void wallet_payment_delete(struct wallet *wallet,
const struct sha256 *payment_hash,
const u64 *groupid, const u64 *partid,
const enum wallet_payment_status *status)
const enum payment_status *status)
{
struct db_stmt *stmt;
@@ -3516,7 +3516,7 @@ wallet_payment_by_hash(const tal_t *ctx, struct wallet *wallet,
void wallet_payment_set_status(struct wallet *wallet,
const struct sha256 *payment_hash,
u64 partid, u64 groupid,
const enum wallet_payment_status newstatus,
const enum payment_status newstatus,
const struct preimage *preimage)
{
struct db_stmt *stmt;
@@ -3538,7 +3538,7 @@ void wallet_payment_set_status(struct wallet *wallet,
SQL("UPDATE payments SET status=?, completed_at=? "
"WHERE payment_hash=? AND partid=? AND groupid=?"));
db_bind_int(stmt, 0, wallet_payment_status_in_db(newstatus));
db_bind_int(stmt, 0, payment_status_in_db(newstatus));
if (completed_at != 0) {
db_bind_u64(stmt, 1, completed_at);
} else {

View File

@@ -292,14 +292,14 @@ struct wallet_shachain {
struct shachain chain;
};
/* Possible states for a wallet_payment. Payments start in
/* Possible states for a payment. Payments start in
* `PENDING`. Outgoing payments are set to `PAYMENT_COMPLETE` once we
* get the preimage matching the rhash, or to
* `PAYMENT_FAILED`. */
/* /!\ This is a DB ENUM, please do not change the numbering of any
* already defined elements (adding is ok but you should append the
* test case test_wallet_payment_status_enum() ) /!\ */
enum wallet_payment_status {
* test case test_payment_status_enum() ) /!\ */
enum payment_status {
PAYMENT_PENDING = 0,
PAYMENT_COMPLETE = 1,
PAYMENT_FAILED = 2
@@ -310,7 +310,7 @@ struct tx_annotation {
struct short_channel_id channel;
};
static inline enum wallet_payment_status wallet_payment_status_in_db(enum wallet_payment_status w)
static inline enum payment_status payment_status_in_db(enum payment_status w)
{
switch (w) {
case PAYMENT_PENDING:
@@ -342,7 +342,7 @@ struct wallet_payment {
u64 partid;
u64 groupid;
enum wallet_payment_status status;
enum payment_status status;
/* The destination may not be known if we used `sendonion` */
struct node_id *destination;
@@ -1115,7 +1115,7 @@ void wallet_payment_store(struct wallet *wallet,
void wallet_payment_delete(struct wallet *wallet,
const struct sha256 *payment_hash,
const u64 *groupid, const u64 *partid,
const enum wallet_payment_status *status);
const enum payment_status *status);
/**
* wallet_local_htlc_out_delete - Remove a local outgoing failed HTLC
@@ -1157,7 +1157,7 @@ u64 wallet_payment_get_groupid(struct wallet *wallet,
void wallet_payment_set_status(struct wallet *wallet,
const struct sha256 *payment_hash,
u64 partid, u64 groupid,
const enum wallet_payment_status newstatus,
const enum payment_status newstatus,
const struct preimage *preimage);
/**