Browse Source

Remove deprecated closing support from closingd.

This was changed in the spec in January, and bd1aa935b added it 2018-02-02.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ppa-0.6.1
Rusty Russell 7 years ago
committed by Christian Decker
parent
commit
8ee21bc352
  1. 21
      closingd/closing.c
  2. 2
      closingd/closing_wire.csv
  3. 1
      lightningd/closing_control.c

21
closingd/closing.c

@ -1,4 +1,3 @@
/* FIXME: We don't relay from gossipd at all here. */
#include <bitcoin/script.h>
#include <closingd/gen_closing_wire.h>
#include <common/close_tx.h>
@ -337,8 +336,6 @@ static uint64_t receive_offer(struct crypto_state *cs,
struct feerange {
enum side higher_side;
u64 min, max;
bool allow_mistakes;
};
static void init_feerange(struct feerange *feerange,
@ -354,7 +351,6 @@ static void init_feerange(struct feerange *feerange,
* in [BOLT #3](03-transactions.md#fee-calculation).
*/
feerange->max = commitment_fee;
feerange->allow_mistakes = false;
if (offer[LOCAL] > offer[REMOTE])
feerange->higher_side = LOCAL;
@ -371,18 +367,6 @@ static void adjust_feerange(struct crypto_state *cs,
struct feerange *feerange,
u64 offer, enum side side)
{
if (offer < feerange->min || offer > feerange->max) {
if (!feerange->allow_mistakes || side != REMOTE)
peer_failed(cs, channel_id,
"%s offer %"PRIu64
" not between %"PRIu64" and %"PRIu64,
side == LOCAL ? "local" : "remote",
offer, feerange->min, feerange->max);
status_trace("Allowing deprecated out-of-range fee");
return;
}
/* BOLT #2:
*
* - MUST propose a value "strictly between" the received
@ -444,7 +428,6 @@ int main(int argc, char *argv[])
bool reconnected;
u64 next_index[NUM_SIDES], revocations_received;
enum side whose_turn;
bool deprecated_api;
u8 *channel_reestablish;
subdaemon_setup(argc, argv);
@ -470,7 +453,6 @@ int main(int argc, char *argv[])
&next_index[LOCAL],
&next_index[REMOTE],
&revocations_received,
&deprecated_api,
&channel_reestablish))
master_badmsg(WIRE_CLOSING_INIT, msg);
@ -537,9 +519,6 @@ int main(int argc, char *argv[])
/* Apply (and check) funder offer now. */
adjust_feerange(&cs, &channel_id, &feerange, offer[funder], funder);
/* Older spec clients would make offers independently, so allow */
feerange.allow_mistakes = deprecated_api;
/* Now any extra rounds required. */
while (offer[LOCAL] != offer[REMOTE]) {
/* Still don't agree: adjust feerange based on previous offer */

2
closingd/closing_wire.csv

@ -23,8 +23,6 @@ closing_init,,reconnected,bool
closing_init,,next_index_local,u64
closing_init,,next_index_remote,u64
closing_init,,revocations_received,u64
# This means we allow closing negotiations out of bounds.
closing_init,,deprecated_api,bool
closing_init,,channel_reestablish_len,u16
closing_init,,channel_reestablish,channel_reestablish_len*u8

Can't render this file because it has a wrong number of fields in line 3.

1
lightningd/closing_control.c

@ -214,7 +214,6 @@ void peer_start_closingd(struct channel *channel,
channel->next_index[LOCAL],
channel->next_index[REMOTE],
num_revocations,
deprecated_apis,
channel_reestablish);
/* We don't expect a response: it will give us feedback on

Loading…
Cancel
Save