Skip to content

Commit a61b7ef

Browse files
niftyneirustyrussell
authored andcommitted
bkpr: add new json RPC "bkpr-editdescriptionbypaymentid"
This takes an {payment_id} and {description}. It looks for all chain + channel events that match that {payment_id} and updates the description for those events. We return all the updated events. If no events are updated, an empty list is returned. Changelog-Added: PLUGINS: bookkeeper has a new RPC `bkpr-editdescriptionbypaymentid` which will update the description for any event with matching payment_id
1 parent 4a6e014 commit a61b7ef

File tree

7 files changed

+609
-14
lines changed

7 files changed

+609
-14
lines changed

contrib/msggen/msggen/schema.json

Lines changed: 268 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2605,6 +2605,268 @@
26052605
}
26062606
]
26072607
},
2608+
"lightning-bkpr-editdescriptionbypaymentid.json": {
2609+
"$schema": "../rpc-schema-draft.json",
2610+
"type": "object",
2611+
"additionalProperties": false,
2612+
"rpc": "bkpr-editdescriptionbypaymentid",
2613+
"title": "Command to change the description for events with {payment_id} after they're made",
2614+
"description": [
2615+
"The **bkpr-editdescriptionbypaymentid** RPC command updates all chain and channel events that match the {payment_id} with the provided {description}"
2616+
],
2617+
"request": {
2618+
"required": [
2619+
"payment_id",
2620+
"description"
2621+
],
2622+
"properties": {
2623+
"payment_id": {
2624+
"type": "string",
2625+
"description": [
2626+
"The payment hash (payment_id) to update the description for."
2627+
]
2628+
},
2629+
"description": {
2630+
"type": "string",
2631+
"description": [
2632+
"The description to update to"
2633+
]
2634+
}
2635+
}
2636+
},
2637+
"response": {
2638+
"required": [
2639+
"updated"
2640+
],
2641+
"properties": {
2642+
"updated": {
2643+
"type": "array",
2644+
"items": {
2645+
"type": "object",
2646+
"additionalProperties": true,
2647+
"required": [
2648+
"account",
2649+
"type",
2650+
"tag",
2651+
"credit_msat",
2652+
"debit_msat",
2653+
"currency",
2654+
"timestamp",
2655+
"description"
2656+
],
2657+
"properties": {
2658+
"account": {
2659+
"type": "string",
2660+
"description": [
2661+
"The account name. If the account is a channel, the channel_id."
2662+
]
2663+
},
2664+
"type": {
2665+
"type": "string",
2666+
"enum": [
2667+
"chain",
2668+
"channel"
2669+
],
2670+
"description": [
2671+
"Coin movement type."
2672+
]
2673+
},
2674+
"tag": {
2675+
"type": "string",
2676+
"description": [
2677+
"Description of movement."
2678+
]
2679+
},
2680+
"credit_msat": {
2681+
"type": "msat",
2682+
"description": [
2683+
"Amount credited."
2684+
]
2685+
},
2686+
"debit_msat": {
2687+
"type": "msat",
2688+
"description": [
2689+
"Amount debited."
2690+
]
2691+
},
2692+
"currency": {
2693+
"type": "string",
2694+
"description": [
2695+
"Human-readable bech32 part for this coin type."
2696+
]
2697+
},
2698+
"timestamp": {
2699+
"type": "u32",
2700+
"description": [
2701+
"Timestamp this event was recorded by the node. For consolidated events such as onchain_fees, the most recent timestamp."
2702+
]
2703+
},
2704+
"description": {
2705+
"type": "string",
2706+
"description": [
2707+
"The description of this event"
2708+
]
2709+
}
2710+
},
2711+
"allOf": [
2712+
{
2713+
"if": {
2714+
"properties": {
2715+
"type": {
2716+
"type": "string",
2717+
"enum": [
2718+
"chain"
2719+
]
2720+
}
2721+
}
2722+
},
2723+
"then": {
2724+
"properties": {
2725+
"account": {},
2726+
"type": {},
2727+
"tag": {},
2728+
"credit_msat": {},
2729+
"debit_msat": {},
2730+
"currency": {},
2731+
"timestamp": {},
2732+
"outpoint": {
2733+
"type": "string",
2734+
"description": [
2735+
"The txid:outnum for this event."
2736+
]
2737+
},
2738+
"blockheight": {
2739+
"type": "u32",
2740+
"description": [
2741+
"For chain events, blockheight this occured at."
2742+
]
2743+
},
2744+
"origin": {
2745+
"type": "string",
2746+
"description": [
2747+
"The account this movement originated from."
2748+
]
2749+
},
2750+
"payment_id": {
2751+
"type": "hex",
2752+
"description": [
2753+
"Lightning payment identifier. For an htlc, this will be the preimage."
2754+
]
2755+
},
2756+
"txid": {
2757+
"type": "txid",
2758+
"description": [
2759+
"The txid of the transaction that created this event."
2760+
]
2761+
}
2762+
},
2763+
"required": [
2764+
"outpoint",
2765+
"blockheight"
2766+
],
2767+
"additionalProperties": false
2768+
}
2769+
},
2770+
{
2771+
"if": {
2772+
"properties": {
2773+
"type": {
2774+
"type": "string",
2775+
"enum": [
2776+
"onchain_fee"
2777+
]
2778+
}
2779+
}
2780+
},
2781+
"then": {
2782+
"properties": {
2783+
"account": {},
2784+
"type": {},
2785+
"tag": {},
2786+
"credit_msat": {},
2787+
"debit_msat": {},
2788+
"currency": {},
2789+
"timestamp": {},
2790+
"description": {},
2791+
"txid": {
2792+
"type": "txid",
2793+
"description": [
2794+
"The txid of the transaction that created this event."
2795+
]
2796+
}
2797+
},
2798+
"required": [
2799+
"txid"
2800+
],
2801+
"additionalProperties": false
2802+
}
2803+
},
2804+
{
2805+
"if": {
2806+
"properties": {
2807+
"type": {
2808+
"type": "string",
2809+
"enum": [
2810+
"channel"
2811+
]
2812+
}
2813+
}
2814+
},
2815+
"then": {
2816+
"properties": {
2817+
"account": {},
2818+
"type": {},
2819+
"tag": {},
2820+
"credit_msat": {},
2821+
"debit_msat": {},
2822+
"currency": {},
2823+
"timestamp": {},
2824+
"description": {},
2825+
"fees_msat": {
2826+
"type": "msat",
2827+
"description": [
2828+
"Amount paid in fees."
2829+
]
2830+
},
2831+
"is_rebalance": {
2832+
"type": "boolean",
2833+
"description": [
2834+
"Is this payment part of a rebalance."
2835+
]
2836+
},
2837+
"payment_id": {
2838+
"type": "hex",
2839+
"description": [
2840+
"Lightning payment identifier. For an htlc, this will be the preimage."
2841+
]
2842+
},
2843+
"part_id": {
2844+
"type": "u32",
2845+
"description": [
2846+
"Counter for multi-part payments."
2847+
]
2848+
}
2849+
},
2850+
"additionalProperties": false
2851+
}
2852+
}
2853+
]
2854+
}
2855+
}
2856+
}
2857+
},
2858+
"author": [
2859+
"Lisa Neigut <<[email protected]>> is mainly responsible."
2860+
],
2861+
"see_also": [
2862+
"lightning-bkpr-listaccountevents(7)",
2863+
"lightning-bkpr-listincome(7)"
2864+
],
2865+
"resources": [
2866+
"Main web site: <https://github.com/ElementsProject/lightning>"
2867+
],
2868+
"examples": []
2869+
},
26082870
"lightning-bkpr-inspect.json": {
26092871
"$schema": "../rpc-schema-draft.json",
26102872
"type": "object",
@@ -2999,6 +3261,12 @@
29993261
"debit_msat": {},
30003262
"currency": {},
30013263
"timestamp": {},
3264+
"description": {
3265+
"type": "string",
3266+
"description": [
3267+
"The description of this event."
3268+
]
3269+
},
30023270
"outpoint": {
30033271
"type": "string",
30043272
"description": [
@@ -3028,12 +3296,6 @@
30283296
"description": [
30293297
"The txid of the transaction that created this event."
30303298
]
3031-
},
3032-
"description": {
3033-
"type": "string",
3034-
"description": [
3035-
"The description of this event."
3036-
]
30373299
}
30383300
},
30393301
"required": [

0 commit comments

Comments
 (0)