Skip to content

Commit 27afa06

Browse files
authored
Merge branch 'master' into fix-fee-calculations
2 parents d91f8e3 + 4ed0435 commit 27afa06

File tree

9 files changed

+52
-51
lines changed

9 files changed

+52
-51
lines changed

README.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,6 @@ the lightning network.
106106
There are also numerous plugins available for Core Lightning which add
107107
capabilities: in particular there's a collection at: https://github.com/lightningd/plugins
108108

109-
Including [helpme][helpme-github] which guides you through setting up
110-
your first channels and customizing your node.
111-
112109
For a less reckless experience, you can encrypt the HD wallet seed:
113110
see [HD wallet encryption](#hd-wallet-encryption).
114111

contrib/pyln-testing/pyln/testing/fixtures.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ def is_sat_or_all(checker, instance):
403403
def is_currency(checker, instance):
404404
"""currency including currency code"""
405405
pattern = re.compile(r'^\d+(\.\d+)?[A-Z][A-Z][A-Z]$')
406-
if pattern.match(instance):
406+
if checker.is_type(instance, "string") and pattern.match(instance):
407407
return True
408408
return False
409409

doc/beginners-guide/beginners-guide.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,6 @@ Useful commands:
5757

5858
Once you've started for the first time, there's a script called `contrib/bootstrap-node.sh` which will connect you to other nodes on the lightning network.
5959

60-
There are also numerous plugins available for Core Lightning which add capabilities: see the [Plugins](doc:plugins) guide, and check out the plugin collection at: <https://github.com/lightningd/plugins>, including [helpme](https://github.com/lightningd/plugins/tree/master/helpme) which guides you through setting up your first channels and customising your node.
60+
There are also numerous plugins available for Core Lightning which add capabilities: see the [Plugins](doc:plugins) guide, and check out the plugin collection at: <https://github.com/lightningd/plugins>.
6161

6262
For a less reckless experience, you can encrypt the HD wallet seed: see [HD wallet encryption](doc:backup-and-recovery#hsm-secret-backup).

doc/node-operators-guide/faq.md

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -8,34 +8,6 @@ updatedAt: "2023-07-05T09:42:38.017Z"
88
---
99
# General questions
1010

11-
### I don't know where to start, help me !
12-
13-
There is a Core Lightning plugin specifically for this purpose, it's called [`helpme`](https://github.com/lightningd/plugins/tree/master/helpme).
14-
15-
Assuming you have followed the [installation steps](doc:installation), have `lightningd` up and running, and `lightning-cli` in your `$PATH` you can start the plugin like so:
16-
17-
```shell
18-
# Clone the plugins repository
19-
git clone https://github.com/lightningd/plugins
20-
# Make sure the helpme plugin is executable (git should have already handled this)
21-
chmod +x plugins/helpme/helpme.py
22-
# Install its dependencies (there is only one actually)
23-
pip3 install --user -r plugins/helpme/requirements.txt
24-
# Then just start it :)
25-
lightning-cli plugin start $PWD/plugins/helpme/helpme.py
26-
```
27-
28-
29-
30-
The plugin registers a new command `helpme` which will guide you through the main
31-
components of C-lightning:
32-
33-
```shell
34-
lightning-cli helpme
35-
```
36-
37-
38-
3911
### How to get the balance of each channel ?
4012

4113
You can use the `listfunds` command and take a ratio of `our_amount_msat` over

plugins/examples/cln-plugin-startup.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ async fn main() -> Result<(), anyhow::Error> {
7676
"send a test_custom_notification event",
7777
test_send_custom_notification,
7878
)
79+
.rpcmethod("test-log-levels", "send on all log levels", test_log_levels)
7980
.subscribe("connect", connect_handler)
8081
.subscribe("test_custom_notification", test_receive_custom_notification)
8182
.hook("peer_connected", peer_connected_handler)
@@ -161,3 +162,15 @@ async fn peer_connected_handler(
161162
log::info!("Got a connect hook call: {}", v);
162163
Ok(json!({"result": "continue"}))
163164
}
165+
166+
async fn test_log_levels(
167+
_p: Plugin<()>,
168+
_v: serde_json::Value,
169+
) -> Result<serde_json::Value, Error> {
170+
log::trace!("log::trace! working");
171+
log::debug!("log::debug! working");
172+
log::info!("log::info! working");
173+
log::warn!("log::warn! working");
174+
log::error!("log::error! working");
175+
Ok(json!({}))
176+
}

plugins/src/logging.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ enum LogLevel {
2222
Info,
2323
Warn,
2424
Error,
25+
Trace,
2526
}
2627

2728
impl From<log::Level> for LogLevel {
@@ -30,7 +31,8 @@ impl From<log::Level> for LogLevel {
3031
log::Level::Error => LogLevel::Error,
3132
log::Level::Warn => LogLevel::Warn,
3233
log::Level::Info => LogLevel::Info,
33-
log::Level::Debug | log::Level::Trace => LogLevel::Debug,
34+
log::Level::Debug => LogLevel::Debug,
35+
log::Level::Trace => LogLevel::Trace,
3436
}
3537
}
3638
}
@@ -130,7 +132,7 @@ mod trace {
130132
&Level::ERROR => LogLevel::Error,
131133
&Level::INFO => LogLevel::Info,
132134
&Level::WARN => LogLevel::Warn,
133-
&Level::TRACE => LogLevel::Debug,
135+
&Level::TRACE => LogLevel::Trace,
134136
}
135137
}
136138
}

tests/test_cln_rs.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,20 @@ def test_plugin_options_handle_defaults(node_factory):
105105
assert opts["multi-i64-option-default"] == [-42]
106106

107107

108+
def test_plugin_log_levels(node_factory):
109+
"""Start a minimal plugin and ensure it logs all levels"""
110+
bin_path = Path.cwd() / "target" / RUST_PROFILE / "examples" / "cln-plugin-startup"
111+
l1 = node_factory.get_node(
112+
options={"plugin": str(bin_path)}, broken_log=r"log::error! working"
113+
)
114+
l1.rpc.test_log_levels()
115+
wait_for(lambda: l1.daemon.is_in_log(r"cln-plugin-startup: log::trace! working"))
116+
wait_for(lambda: l1.daemon.is_in_log(r"cln-plugin-startup: log::debug! working"))
117+
wait_for(lambda: l1.daemon.is_in_log(r"cln-plugin-startup: log::info! working"))
118+
wait_for(lambda: l1.daemon.is_in_log(r"cln-plugin-startup: log::warn! working"))
119+
wait_for(lambda: l1.daemon.is_in_log(r"cln-plugin-startup: log::error! working"))
120+
121+
108122
def test_grpc_connect(node_factory):
109123
"""Attempts to connect to the grpc interface and call getinfo"""
110124
# These only exist if we have rust!

tests/test_opening.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2736,15 +2736,19 @@ def censoring_sendrawtx(tx):
27362736
l1.rpc.pay(inv["bolt11"])
27372737
wait_for(lambda: only_one(l2.rpc.listpeerchannels()['channels'])['to_us_msat'] == 1)
27382738

2739-
# We need *another* channel to make it forget the first though!
2739+
# We need *another* channel to make it forget the first though! (One block later, otherwise
2740+
# *this* might be forgotten).
2741+
bitcoind.generate_block(1)
2742+
sync_blockheight(bitcoind, [l2])
2743+
27402744
l3.connect(l2)
27412745
l3.rpc.fundchannel(l2.info["id"], 10**6, mindepth=0)
27422746
bitcoind.generate_block(1)
27432747

27442748
# Now stop, in order to cause catchup and re-evaluate whether to forget the channel
27452749
l2.stop()
27462750

2747-
# Now we generate enough blocks to cause l2 to forget the channel.
2751+
# Now we generate enough blocks to cause l2 consider both channels forgettable.
27482752
bitcoind.generate_block(blocks - 1) # > blocks
27492753
l2.start()
27502754

@@ -2755,16 +2759,14 @@ def censoring_sendrawtx(tx):
27552759
bitcoind.generate_block(1)
27562760
sync_blockheight(bitcoind, [l1, l2])
27572761

2758-
# This may take a moment!
2759-
time.sleep(5)
2760-
2761-
have_forgotten = l2.daemon.is_in_log(
2762-
r"UNUSUAL {}-chan#1: Forgetting channel: It has been 51 blocks without the funding transaction ".format(l1.info['id'])
2763-
)
2764-
2762+
# If we made a payment it will *not* consider there to tbe two forgettable channels.
27652763
if dopay:
2766-
assert not have_forgotten
2764+
# This may take a moment!
2765+
time.sleep(5)
2766+
2767+
assert not l2.daemon.is_in_log('Forgetting channel')
27672768
assert set([c['peer_id'] for c in l2.rpc.listpeerchannels()["channels"]]) == set([l1.info['id'], l3.info['id']])
27682769
else:
2769-
assert have_forgotten
2770+
# It will forget the older one.
2771+
l2.daemon.wait_for_log(r"UNUSUAL {}-chan#1: Forgetting channel: It has been {} blocks without the funding transaction ".format(l1.info['id'], blocks + 1))
27702772
assert [c['peer_id'] for c in l2.rpc.listpeerchannels()["channels"]] == [l3.info['id']]

tests/test_pay.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4737,7 +4737,7 @@ def test_fetchinvoice_disconnected_reply(node_factory, bitcoind):
47374737

47384738
# l2 is already connected to l3, so it can fetch. It specifies a reply
47394739
# path of l1->l2. l3 knows it can simply route reply to l1 via l2.
4740-
l2.rpc.fetchinvoice(offer=offer['bolt12'], dev_reply_path=[l1.info['id'], l2.info['id']])
4740+
l2.rpc.call('fetchinvoice', {'offer': offer['bolt12'], 'dev_reply_path': [l1.info['id'], l2.info['id']]})
47414741
assert l3.rpc.listpeers(l1.info['id']) == {'peers': []}
47424742

47434743

@@ -5709,7 +5709,7 @@ def test_blinded_reply_path_scid(node_factory):
57095709

57105710
chan = only_one(l1.rpc.listpeerchannels()['channels'])
57115711
scidd = "{}/{}".format(chan['short_channel_id'], chan['direction'])
5712-
inv = l1.rpc.fetchinvoice(offer=offer['bolt12'], dev_path_use_scidd=scidd)['invoice']
5712+
inv = l1.rpc.call('fetchinvoice', {'offer': offer['bolt12'], 'dev_path_use_scidd': scidd})['invoice']
57135713

57145714
l1.rpc.pay(inv)
57155715

@@ -5740,9 +5740,10 @@ def test_offer_paths(node_factory, bitcoind):
57405740

57415741
chan = only_one(l1.rpc.listpeerchannels()['channels'])
57425742
scidd = "{}/{}".format(chan['short_channel_id'], chan['direction'])
5743-
offer = l2.rpc.offer(amount='100sat', description='test_offer_paths',
5744-
dev_paths=[[scidd, l2.info['id']],
5745-
[l3.info['id'], l2.info['id']]])
5743+
offer = l2.rpc.call('offer', {'amount': '100sat',
5744+
'description': 'test_offer_paths',
5745+
'dev_paths': [[scidd, l2.info['id']],
5746+
[l3.info['id'], l2.info['id']]]})
57465747

57475748
paths = l1.rpc.decode(offer['bolt12'])['offer_paths']
57485749
assert len(paths) == 2

0 commit comments

Comments
 (0)