Skip to content

Commit 6a94683

Browse files
rustyrussellmadelinevibes
authored andcommitted
hsmd: don't assert that our own locktime is > 0.
By policy, our stub hsmd accepts everything: openingd is supposed to sort this out (or use VLS for a real HSM implementation!). Signed-off-by: Rusty Russell <[email protected]> Changelog-Fixed: Config: the node no longer crashes if you set `watchtime-blocks` to 0 (which is fine for testing: don't do this on mainnet!).
1 parent e6b14da commit 6a94683

File tree

2 files changed

+0
-18
lines changed

2 files changed

+0
-18
lines changed

hsmd/libhsmd.c

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -352,15 +352,6 @@ static u8 *handle_new_channel(struct hsmd_client *c, const u8 *msg_in)
352352
return towire_hsmd_new_channel_reply(NULL);
353353
}
354354

355-
static bool mem_is_zero(const void *mem, size_t len)
356-
{
357-
size_t i;
358-
for (i = 0; i < len; ++i)
359-
if (((const unsigned char *)mem)[i])
360-
return false;
361-
return true;
362-
}
363-
364355
/* ~This stub implementation is overriden by fully validating signers
365356
* that need the unchanging channel parameters. */
366357
static u8 *handle_setup_channel(struct hsmd_client *c, const u8 *msg_in)
@@ -377,7 +368,6 @@ static u8 *handle_setup_channel(struct hsmd_client *c, const u8 *msg_in)
377368
struct pubkey remote_funding_pubkey;
378369
u16 remote_to_self_delay;
379370
u8 *remote_shutdown_script;
380-
struct amount_msat value_msat;
381371
struct channel_type *channel_type;
382372

383373
if (!fromwire_hsmd_setup_channel(tmpctx, msg_in, &is_outbound,
@@ -394,13 +384,6 @@ static u8 *handle_setup_channel(struct hsmd_client *c, const u8 *msg_in)
394384

395385
/* Stub implementation */
396386

397-
/* Fail fast if any values are uninitialized or obviously wrong. */
398-
assert(amount_sat_greater(channel_value, AMOUNT_SAT(0)));
399-
assert(amount_sat_to_msat(&value_msat, channel_value));
400-
assert(!mem_is_zero(&funding_txid, sizeof(funding_txid)));
401-
assert(local_to_self_delay > 0);
402-
assert(remote_to_self_delay > 0);
403-
404387
return towire_hsmd_setup_channel_reply(NULL);
405388
}
406389

tests/test_misc.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4974,7 +4974,6 @@ def test_tracing(node_factory):
49744974
assert 'parentId' in res[0]
49754975

49764976

4977-
@pytest.mark.xfail(strict=True)
49784977
def test_zero_locktime_blocks(node_factory, bitcoind):
49794978
"""Ensure our node "works" even if locktime set to 0."""
49804979
l1, l2, l3 = node_factory.line_graph(3, opts=[{}, {'watchtime-blocks': 0}, {}], wait_for_announce=True)

0 commit comments

Comments
 (0)