mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 21:35:11 +01:00
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>
This commit is contained in:
parent
ab331f79a0
commit
8ee21bc352
@ -1,4 +1,3 @@
|
|||||||
/* FIXME: We don't relay from gossipd at all here. */
|
|
||||||
#include <bitcoin/script.h>
|
#include <bitcoin/script.h>
|
||||||
#include <closingd/gen_closing_wire.h>
|
#include <closingd/gen_closing_wire.h>
|
||||||
#include <common/close_tx.h>
|
#include <common/close_tx.h>
|
||||||
@ -337,8 +336,6 @@ static uint64_t receive_offer(struct crypto_state *cs,
|
|||||||
struct feerange {
|
struct feerange {
|
||||||
enum side higher_side;
|
enum side higher_side;
|
||||||
u64 min, max;
|
u64 min, max;
|
||||||
|
|
||||||
bool allow_mistakes;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static void init_feerange(struct feerange *feerange,
|
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).
|
* in [BOLT #3](03-transactions.md#fee-calculation).
|
||||||
*/
|
*/
|
||||||
feerange->max = commitment_fee;
|
feerange->max = commitment_fee;
|
||||||
feerange->allow_mistakes = false;
|
|
||||||
|
|
||||||
if (offer[LOCAL] > offer[REMOTE])
|
if (offer[LOCAL] > offer[REMOTE])
|
||||||
feerange->higher_side = LOCAL;
|
feerange->higher_side = LOCAL;
|
||||||
@ -371,18 +367,6 @@ static void adjust_feerange(struct crypto_state *cs,
|
|||||||
struct feerange *feerange,
|
struct feerange *feerange,
|
||||||
u64 offer, enum side side)
|
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:
|
/* BOLT #2:
|
||||||
*
|
*
|
||||||
* - MUST propose a value "strictly between" the received
|
* - MUST propose a value "strictly between" the received
|
||||||
@ -444,7 +428,6 @@ int main(int argc, char *argv[])
|
|||||||
bool reconnected;
|
bool reconnected;
|
||||||
u64 next_index[NUM_SIDES], revocations_received;
|
u64 next_index[NUM_SIDES], revocations_received;
|
||||||
enum side whose_turn;
|
enum side whose_turn;
|
||||||
bool deprecated_api;
|
|
||||||
u8 *channel_reestablish;
|
u8 *channel_reestablish;
|
||||||
|
|
||||||
subdaemon_setup(argc, argv);
|
subdaemon_setup(argc, argv);
|
||||||
@ -470,7 +453,6 @@ int main(int argc, char *argv[])
|
|||||||
&next_index[LOCAL],
|
&next_index[LOCAL],
|
||||||
&next_index[REMOTE],
|
&next_index[REMOTE],
|
||||||
&revocations_received,
|
&revocations_received,
|
||||||
&deprecated_api,
|
|
||||||
&channel_reestablish))
|
&channel_reestablish))
|
||||||
master_badmsg(WIRE_CLOSING_INIT, msg);
|
master_badmsg(WIRE_CLOSING_INIT, msg);
|
||||||
|
|
||||||
@ -537,9 +519,6 @@ int main(int argc, char *argv[])
|
|||||||
/* Apply (and check) funder offer now. */
|
/* Apply (and check) funder offer now. */
|
||||||
adjust_feerange(&cs, &channel_id, &feerange, offer[funder], funder);
|
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. */
|
/* Now any extra rounds required. */
|
||||||
while (offer[LOCAL] != offer[REMOTE]) {
|
while (offer[LOCAL] != offer[REMOTE]) {
|
||||||
/* Still don't agree: adjust feerange based on previous offer */
|
/* Still don't agree: adjust feerange based on previous offer */
|
||||||
|
@ -23,8 +23,6 @@ closing_init,,reconnected,bool
|
|||||||
closing_init,,next_index_local,u64
|
closing_init,,next_index_local,u64
|
||||||
closing_init,,next_index_remote,u64
|
closing_init,,next_index_remote,u64
|
||||||
closing_init,,revocations_received,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_len,u16
|
||||||
closing_init,,channel_reestablish,channel_reestablish_len*u8
|
closing_init,,channel_reestablish,channel_reestablish_len*u8
|
||||||
|
|
||||||
|
|
@ -214,7 +214,6 @@ void peer_start_closingd(struct channel *channel,
|
|||||||
channel->next_index[LOCAL],
|
channel->next_index[LOCAL],
|
||||||
channel->next_index[REMOTE],
|
channel->next_index[REMOTE],
|
||||||
num_revocations,
|
num_revocations,
|
||||||
deprecated_apis,
|
|
||||||
channel_reestablish);
|
channel_reestablish);
|
||||||
|
|
||||||
/* We don't expect a response: it will give us feedback on
|
/* We don't expect a response: it will give us feedback on
|
||||||
|
Loading…
Reference in New Issue
Block a user