|
1 | 1 | #!/usr/bin/env python3
|
2 |
| -""" A simple implementation of a LSPS2 compatible policy plugin. It is the job |
| 2 | +"""A simple implementation of a LSPS2 compatible policy plugin. It is the job |
3 | 3 | of this plugin to deliver a fee options menu to the LSPS2 service plugin.
|
4 | 4 | """
|
5 | 5 |
|
|
12 | 12 |
|
13 | 13 | @plugin.method("dev-lsps2-getpolicy")
|
14 | 14 | def lsps2_getpolicy(request):
|
15 |
| - """ Returns an opening fee menu for the LSPS2 plugin. |
16 |
| - """ |
| 15 | + """Returns an opening fee menu for the LSPS2 plugin.""" |
17 | 16 | now = datetime.now(timezone.utc)
|
18 | 17 |
|
19 | 18 | # Is ISO 8601 format "YYYY-MM-DDThh:mm:ss.uuuZ"
|
20 |
| - valid_until = (now + timedelta(hours=1)).isoformat().replace('+00:00', 'Z') |
21 |
| - |
22 |
| - return { "policy_opening_fee_params_menu": [ |
23 |
| - { |
24 |
| - "min_fee_msat": "1000", |
25 |
| - "proportional": 1000, |
26 |
| - "valid_until": valid_until, |
27 |
| - "min_lifetime": 2000, |
28 |
| - "max_client_to_self_delay": 2016, |
29 |
| - "min_payment_size_msat": "1000", |
30 |
| - "max_payment_size_msat": "100000000", |
31 |
| - }, |
32 |
| - { |
33 |
| - "min_fee_msat": "1092000", |
34 |
| - "proportional": 2400, |
35 |
| - "valid_until": valid_until, |
36 |
| - "min_lifetime": 1008, |
37 |
| - "max_client_to_self_delay": 2016, |
38 |
| - "min_payment_size_msat": "1000", |
39 |
| - "max_payment_size_msat": "1000000", |
40 |
| - } |
41 |
| - ] |
42 |
| -} |
| 19 | + valid_until = (now + timedelta(hours=1)).isoformat().replace("+00:00", "Z") |
| 20 | + |
| 21 | + return { |
| 22 | + "policy_opening_fee_params_menu": [ |
| 23 | + { |
| 24 | + "min_fee_msat": "1000", |
| 25 | + "proportional": 1000, |
| 26 | + "valid_until": valid_until, |
| 27 | + "min_lifetime": 2000, |
| 28 | + "max_client_to_self_delay": 2016, |
| 29 | + "min_payment_size_msat": "1000", |
| 30 | + "max_payment_size_msat": "100000000", |
| 31 | + }, |
| 32 | + { |
| 33 | + "min_fee_msat": "1092000", |
| 34 | + "proportional": 2400, |
| 35 | + "valid_until": valid_until, |
| 36 | + "min_lifetime": 1008, |
| 37 | + "max_client_to_self_delay": 2016, |
| 38 | + "min_payment_size_msat": "1000", |
| 39 | + "max_payment_size_msat": "1000000", |
| 40 | + }, |
| 41 | + ] |
| 42 | + } |
| 43 | + |
43 | 44 |
|
44 | 45 | @plugin.method("dev-lsps2-getchannelcapacity")
|
45 | 46 | def lsps2_getchannelcapacity(request, init_payment_size, scid, opening_fee_params):
|
46 |
| - """ Returns an opening fee menu for the LSPS2 plugin. |
47 |
| - """ |
| 47 | + """Returns an opening fee menu for the LSPS2 plugin.""" |
48 | 48 | now = datetime.now(timezone.utc)
|
49 | 49 |
|
50 | 50 | # Is ISO 8601 format "YYYY-MM-DDThh:mm:ss.uuuZ"
|
51 |
| - valid_until = (now + timedelta(hours=1)).isoformat().replace('+00:00', 'Z') |
| 51 | + valid_until = (now + timedelta(hours=1)).isoformat().replace("+00:00", "Z") |
52 | 52 |
|
53 |
| - return { "channel_capacity_msat": 100000000 } |
| 53 | + return {"channel_capacity_msat": 100000000} |
54 | 54 |
|
55 | 55 |
|
56 | 56 | plugin.run()
|
0 commit comments