Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Post v0.10 cleanups #4465

Merged
merged 13 commits into from
Apr 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ CCANDIR := ccan

# Where we keep the BOLT RFCs
BOLTDIR := ../lightning-rfc/
BOLTVERSION := edd45ecf22095ce97c1b5e9136a7d79351bd68cb
DEFAULT_BOLTVERSION := b201efe0546120c14bf154ce5f4e18da7243fe7a
# Can be overridden on cmdline.
BOLTVERSION := $(DEFAULT_BOLTVERSION)

-include config.vars

Expand Down Expand Up @@ -401,11 +403,12 @@ SRC_TO_CHECK := $(filter-out $(ALL_TEST_PROGRAMS:=.c), $(ALL_NONGEN_SOURCES))
check-src-includes: $(SRC_TO_CHECK:%=check-src-include-order/%)
check-hdr-includes: $(ALL_NONGEN_HEADERS:%=check-hdr-include-order/%)

# Experimental quotes quote the exact version.
ifeq ($(EXPERIMENTAL_FEATURES),1)
CHECK_BOLT_PREFIX=--prefix="BOLT-$(BOLTVERSION)"
else
# If you want to check a specific variant of quotes use:
# make check-source-bolt BOLTVERSION=xxx
ifeq ($(BOLTVERSION),$(DEFAULT_BOLTVERSION))
CHECK_BOLT_PREFIX=
else
CHECK_BOLT_PREFIX=--prefix="BOLT-$(BOLTVERSION)"
endif

# Any mention of BOLT# must be followed by an exact quote, modulo whitespace.
Expand Down
3 changes: 2 additions & 1 deletion channeld/test/run-commit_tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,8 @@ int main(int argc, const char *argv[])
*
* To start, common basic parameters for each test vector are defined:
* the HTLCs are not used for the first "simple commitment tx with no
* HTLCs" test.
* HTLCs" test, and HTLCs 5 and 6 are only used in the "same amount and
* preimage" test.
*
* funding_tx_id: 8984484a580b825b9972d7adb15050b3ab624ccd731946b3eeddb92f4e7ef6be
* funding_output_index: 0
Expand Down
3 changes: 2 additions & 1 deletion channeld/test/run-full_channel.c
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,8 @@ int main(int argc, const char *argv[])
*
* To start, common basic parameters for each test vector are defined:
* the HTLCs are not used for the first "simple commitment tx with no
* HTLCs" test.
* HTLCs" test, and HTLCs 5 and 6 are only used in the "same amount and
* preimage" test.
*
* funding_tx_id: 8984484a580b825b9972d7adb15050b3ab624ccd731946b3eeddb92f4e7ef6be
* funding_output_index: 0
Expand Down
2 changes: 1 addition & 1 deletion common/bolt11.c
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ struct bolt11 *bolt11_decode_nosig(const tal_t *ctx, const char *str,
*
* The human-readable part of a Lightning invoice consists of two sections:
* 1. `prefix`: `ln` + BIP-0173 currency prefix (e.g. `lnbc` for Bitcoin mainnet,
* `lntb` for Bitcoin testnet, and `lnbcrt` for Bitcoin regtest)
* `lntb` for Bitcoin testnet, `lntbs` for Bitcoin signet, and `lnbcrt` for Bitcoin regtest)
* 1. `amount`: optional number in that currency, followed by an optional
* `multiplier` letter. The unit encoded here is the 'social' convention of a payment unit -- in the case of Bitcoin the unit is 'bitcoin' NOT satoshis.
*/
Expand Down
2 changes: 1 addition & 1 deletion common/shutdown_scriptpubkey.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* 1. `OP_DUP` `OP_HASH160` `20` 20-bytes `OP_EQUALVERIFY` `OP_CHECKSIG`
* (pay to pubkey hash), OR
* 2. `OP_HASH160` `20` 20-bytes `OP_EQUAL` (pay to script hash), OR
* 3. `OP_0` `20` 20-bytes (version 0 pay to witness pubkey), OR
* 3. `OP_0` `20` 20-bytes (version 0 pay to witness pubkey hash), OR
* 4. `OP_0` `32` 32-bytes (version 0 pay to witness script hash)
*
* A receiving node:
Expand Down
161 changes: 34 additions & 127 deletions contrib/pyln-client/pyln/client/lightning.py
Original file line number Diff line number Diff line change
Expand Up @@ -514,47 +514,19 @@ def check(self, command_to_check, **kwargs):
payload.update({k: v for k, v in kwargs.items()})
return self.call("check", payload)

def _deprecated_close(self, peer_id, force=None, timeout=None):
warnings.warn("close now takes unilateraltimeout arg: expect removal"
" in early 2020",
DeprecationWarning)
payload = {
"id": peer_id,
"force": force,
"timeout": timeout
}
return self.call("close", payload)

def close(self, peer_id, *args, **kwargs):
def close(self, peer_id, unilateraltimeout=None, destination=None, fee_negotiation_step=None):
"""
Close the channel with peer {id}, forcing a unilateral
close after {unilateraltimeout} seconds if non-zero, and
the to-local output will be sent to {destination}.

Deprecated usage has {force} and {timeout} args.
"""

if 'force' in kwargs or 'timeout' in kwargs:
return self._deprecated_close(peer_id, *args, **kwargs)

# Single arg is ambigious.
if len(args) >= 1:
if isinstance(args[0], bool):
return self._deprecated_close(peer_id, *args, **kwargs)
if len(args) == 2:
if args[0] is None and isinstance(args[1], int):
return self._deprecated_close(peer_id, *args, **kwargs)

def _close(peer_id, unilateraltimeout=None, destination=None, fee_negotiation_step=None):
payload = {
"id": peer_id,
"unilateraltimeout": unilateraltimeout,
"destination": destination,
"fee_negotiation_step": fee_negotiation_step
}
return self.call("close", payload)

return _close(peer_id, *args, **kwargs)
payload = {
"id": peer_id,
"unilateraltimeout": unilateraltimeout,
"destination": destination,
"fee_negotiation_step": fee_negotiation_step
}
return self.call("close", payload)

def connect(self, peer_id, host=None, port=None):
"""
Expand Down Expand Up @@ -635,7 +607,7 @@ def dev_memleak(self):
return self.call("dev-memleak")

def dev_pay(self, bolt11, msatoshi=None, label=None, riskfactor=None,
description=None, maxfeepercent=None, retry_for=None,
maxfeepercent=None, retry_for=None,
maxdelay=None, exemptfee=None, use_shadow=True):
"""
A developer version of `pay`, with the possibility to deactivate
Expand All @@ -651,8 +623,6 @@ def dev_pay(self, bolt11, msatoshi=None, label=None, riskfactor=None,
"maxdelay": maxdelay,
"exemptfee": exemptfee,
"use_shadow": use_shadow,
# Deprecated.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit, this isn't related to the other stuff changes, should be part of the next patch?

"description": description,
}
return self.call("pay", payload)

Expand Down Expand Up @@ -722,22 +692,7 @@ def feerates(self, style, urgent=None, normal=None, slow=None):
}
return self.call("feerates", payload)

def _deprecated_fundchannel(self, node_id, satoshi, feerate=None, announce=True, minconf=None, utxos=None):
warnings.warn("fundchannel: the 'satoshi' field is renamed 'amount' : expect removal"
" in Mid-2020",
DeprecationWarning)

payload = {
"id": node_id,
"satoshi": satoshi,
"feerate": feerate,
"announce": announce,
"minconf": minconf,
"utxos": utxos
}
return self.call("fundchannel", payload)

def fundchannel(self, node_id, *args, **kwargs):
def fundchannel(self, node_id, amount, feerate=None, announce=True, minconf=None, utxos=None, push_msat=None, close_to=None):
"""
Fund channel with {id} using {amount} satoshis with feerate
of {feerate} (uses default feerate if unset).
Expand All @@ -747,39 +702,19 @@ def fundchannel(self, node_id, *args, **kwargs):
fund a channel from these specifics utxos.
{close_to} is a valid Bitcoin address.
"""

if 'satoshi' in kwargs:
return self._deprecated_fundchannel(node_id, *args, **kwargs)

def _fundchannel(node_id, amount, feerate=None, announce=True, minconf=None, utxos=None, push_msat=None, close_to=None):
payload = {
"id": node_id,
"amount": amount,
"feerate": feerate,
"announce": announce,
"minconf": minconf,
"utxos": utxos,
"push_msat": push_msat,
"close_to": close_to,
}
return self.call("fundchannel", payload)

return _fundchannel(node_id, *args, **kwargs)

def _deprecated_fundchannel_start(self, node_id, satoshi, feerate=None, announce=True):
warnings.warn("fundchannel_start: the 'satoshi' field is renamed 'amount' : expect removal"
" in Mid-2020",
DeprecationWarning)

payload = {
"id": node_id,
"satoshi": satoshi,
"amount": amount,
"feerate": feerate,
"announce": announce,
"minconf": minconf,
"utxos": utxos,
"push_msat": push_msat,
"close_to": close_to,
}
return self.call("fundchannel_start", payload)
return self.call("fundchannel", payload)

def fundchannel_start(self, node_id, *args, **kwargs):
def fundchannel_start(self, node_id, amount, feerate=None, announce=True, close_to=None):
"""
Start channel funding with {id} for {amount} satoshis
with feerate of {feerate} (uses default feerate if unset).
Expand All @@ -789,21 +724,14 @@ def fundchannel_start(self, node_id, *args, **kwargs):
'fundchannel_complete' to complete channel establishment
with peer.
"""

if 'satoshi' in kwargs:
return self._deprecated_fundchannel_start(node_id, *args, **kwargs)

def _fundchannel_start(node_id, amount, feerate=None, announce=True, close_to=None):
payload = {
"id": node_id,
"amount": amount,
"feerate": feerate,
"announce": announce,
"close_to": close_to,
}
return self.call("fundchannel_start", payload)

return _fundchannel_start(node_id, *args, **kwargs)
payload = {
"id": node_id,
"amount": amount,
"feerate": feerate,
"announce": announce,
"close_to": close_to,
}
return self.call("fundchannel_start", payload)

def fundchannel_cancel(self, node_id):
"""
Expand Down Expand Up @@ -1058,7 +986,7 @@ def newaddr(self, addresstype=None):
return self.call("newaddr", {"addresstype": addresstype})

def pay(self, bolt11, msatoshi=None, label=None, riskfactor=None,
description=None, maxfeepercent=None, retry_for=None,
maxfeepercent=None, retry_for=None,
maxdelay=None, exemptfee=None):
"""
Send payment specified by {bolt11} with {msatoshi}
Expand All @@ -1074,8 +1002,6 @@ def pay(self, bolt11, msatoshi=None, label=None, riskfactor=None,
"retry_for": retry_for,
"maxdelay": maxdelay,
"exemptfee": exemptfee,
# Deprecated.
"description": description,
}
return self.call("pay", payload)

Expand Down Expand Up @@ -1189,40 +1115,21 @@ def plugin_rescan(self):
}
return self.call("plugin", payload)

def _deprecated_sendpay(self, route, payment_hash, description, msatoshi=None):
warnings.warn("sendpay: the 'description' field is renamed 'label' : expect removal"
" in early-2020",
DeprecationWarning)
def sendpay(self, route, payment_hash, label=None, msatoshi=None, bolt11=None, payment_secret=None, partid=None):
"""
Send along {route} in return for preimage of {payment_hash}.
"""
payload = {
"route": route,
"payment_hash": payment_hash,
"label": description,
"label": label,
"msatoshi": msatoshi,
"bolt11": bolt11,
"payment_secret": payment_secret,
"partid": partid,
}
return self.call("sendpay", payload)

def sendpay(self, route, payment_hash, *args, **kwargs):
"""
Send along {route} in return for preimage of {payment_hash}.
"""

if 'description' in kwargs:
return self._deprecated_sendpay(route, payment_hash, *args, **kwargs)

def _sendpay(route, payment_hash, label=None, msatoshi=None, bolt11=None, payment_secret=None, partid=None):
payload = {
"route": route,
"payment_hash": payment_hash,
"label": label,
"msatoshi": msatoshi,
"bolt11": bolt11,
"payment_secret": payment_secret,
"partid": partid,
}
return self.call("sendpay", payload)

return _sendpay(route, payment_hash, *args, **kwargs)

def setchannelfee(self, id, base=None, ppm=None):
"""
Set routing fees for a channel/peer {id} (or 'all'). {base} is a value in millisatoshi
Expand Down
6 changes: 3 additions & 3 deletions devtools/changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
'deprecated',
'fixed',
'removed',
'security',
'experimental',
]

repo = 'ElementsProject/lightning'
Expand Down Expand Up @@ -132,8 +132,8 @@ def commit_date(commitsha):
${group(groups['removed']) | trim}
${h3} Fixed
${group(groups['fixed']) | trim}
${h3} Security
${group(groups['security']) | trim}
${h3} EXPERIMENTAL
${group(groups['experimental']) | trim}

% for l in links:
[${l.ref}]: ${l.url}
Expand Down
2 changes: 1 addition & 1 deletion devtools/mkclose.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ int main(int argc, char *argv[])

fee = commit_tx_base_fee(feerate_per_kw, 0,
option_anchor_outputs);
/* BOLT-a12da24dd0102c170365124782b46d9710950ac1:
/* BOLT #3:
* If `option_anchor_outputs` applies to the commitment
* transaction, also subtract two times the fixed anchor size
* of 330 sats from the funder (either `to_local` or
Expand Down
3 changes: 1 addition & 2 deletions doc/STYLE.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,7 @@ have a line with one of the following prefixes:
not yet removed
- `Changelog-Fixed: ` if a bug has been fixed
- `Changelog-Removed: ` if a (previously deprecated) feature has been removed
- `Changelog-Security: ` if a security issue has been addressed and the users
will need to upgrade in order to stay secure
- `Changelog-Experimental: ` if it only affects --enable-experimental-features builds, or experimental- config options.

In case you think the pull request is small enough not to require a changelog
entry please use `Changelog-None` in one of the commit messages to opt out.
Expand Down
7 changes: 3 additions & 4 deletions doc/lightning-close.7

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions doc/lightning-close.7.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,8 @@ closed if the peer reconnected.

NOTIFICATIONS
-------------
If `allow-deprecated-apis` is false, notifications may be returned
indicating what is going on, especially if the peer is offline and we
are waiting. This will be enabled by default in future!
Notifications may be returned indicating what is going on, especially
if the peer is offline and we are waiting.

RETURN VALUE
------------
Expand Down
Loading