A channel can exist without a short_channel_id, in the CHANNELD_AWAITING_LOCKIN state, while the funding transaction is sent but not yet included in a block.
Running `rebalanceall` while opening a channel could throw an exception:
```
2021-02-14T09:31:39 UNUSUAL plugin-rebalance.py: Exception in thread Thread-5:
2021-02-14T09:31:39 UNUSUAL plugin-rebalance.py: Traceback (most recent call last):
2021-02-14T09:31:39 UNUSUAL plugin-rebalance.py: File \"/usr/lib/python3.6/threading.py\", line 916, in _bootstrap_inner
2021-02-14T09:31:39 UNUSUAL plugin-rebalance.py: self.run()
2021-02-14T09:31:39 UNUSUAL plugin-rebalance.py: File \"/usr/lib/python3.6/threading.py\", line 864, in run
2021-02-14T09:31:39 UNUSUAL plugin-rebalance.py: self._target(*self._args, **self._kwargs)
2021-02-14T09:31:39 UNUSUAL plugin-rebalance.py: File \"/home/user/plugins/rebalance/rebalance.py\", line 475, in rebalanceall_thread
2021-02-14T09:31:39 UNUSUAL plugin-rebalance.py: result = maybe_rebalance_once(plugin, failed_pairs)
2021-02-14T09:31:39 UNUSUAL plugin-rebalance.py: File \"/home/user/plugins/rebalance/rebalance.py\", line 443, in maybe_rebalance_once
2021-02-14T09:31:39 UNUSUAL plugin-rebalance.py: result = maybe_rebalance_pairs(plugin, ch1, ch2, failed_pairs)
2021-02-14T09:31:39 UNUSUAL plugin-rebalance.py: File \"/home/user/plugins/rebalance/rebalance.py\", line 425, in maybe_rebalance_pairs
2021-02-14T09:31:39 UNUSUAL plugin-rebalance.py: wait_for_htlcs(plugin, [scid1, scid2])
2021-02-14T09:31:39 UNUSUAL plugin-rebalance.py: File \"/home/user/plugins/rebalance/rebalance.py\", line 384, in wait_for_htlcs
2021-02-14T09:31:39 UNUSUAL plugin-rebalance.py: if scids is not None and channel['short_channel_id'] not in scids:
2021-02-14T09:31:39 UNUSUAL plugin-rebalance.py: KeyError: 'short_channel_id'
```
Support the bracketed `socket:[::]:1234` syntax for IPv6 addresses.
Also, add factor out the socket URI parsing to a function and add
tests for it. As a forward compatibility measure, reject query strings
(`?a=b`) because I intend to use these for parameters such as SOCKS5
proxy (for Tor) in a future patch.
Additional checking was added that a file exists when `create=False`,
this runs into an error with the `test_rewrite()` test. Update the test
to use dummy backend for the test, as it tests a method on the base
class, not any specific backend.
This is a rather long option, and if `lightning-cli` is configured
correctly we should be able to extract this information directly from
it without problems. This adds auto-discovery based on `lightning-cli`
which will to the right thing™
Compaction for the FileBackend involves restoring the DB from the
backup, up to the penultimate state, then taking a snapshot of the
restored DB, and then appending the last change to the backup. The new
backup is then atomically swapped with the old backup.
The special treatment for the last change is necessary as usual due to
the rewind functionality, otherwise we'd be in an un-rewindable state,
which can cause trouble if c-lightning died without committing the
last change.