mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 07:04:22 +01:00
MAX_FUNDING_SATOSHI: clean up def to be max, fix name, share with openingd.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
committed by
Christian Decker
parent
351718e90f
commit
904a3e4ae3
@@ -2559,8 +2559,9 @@ static void json_fund_channel(struct command *cmd,
|
||||
return;
|
||||
}
|
||||
|
||||
if (fc->funding_satoshi >= MAX_FUNDING_MSATOSHI) {
|
||||
command_fail(cmd, "Funding msatoshi must be < %d", MAX_FUNDING_MSATOSHI);
|
||||
if (fc->funding_satoshi > MAX_FUNDING_SATOSHI) {
|
||||
command_fail(cmd, "Funding satoshi must be <= %d",
|
||||
MAX_FUNDING_SATOSHI);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
#include <wire/peer_wire.h>
|
||||
|
||||
#define ANNOUNCE_MIN_DEPTH 6
|
||||
#define MAX_FUNDING_MSATOSHI (1 << 24)
|
||||
|
||||
struct crypto_state;
|
||||
|
||||
|
||||
@@ -284,10 +284,7 @@ static u8 *funder_channel(struct state *state,
|
||||
|
||||
temporary_channel_id(&state->channel_id);
|
||||
|
||||
/* BOLT #2:
|
||||
*
|
||||
* The sender MUST set `funding_satoshis` to less than 2^24 satoshi. */
|
||||
if (state->funding_satoshis >= 1 << 24)
|
||||
if (state->funding_satoshis > MAX_FUNDING_SATOSHI)
|
||||
status_failed(STATUS_FAIL_MASTER_IO,
|
||||
"funding_satoshis must be < 2^24, not %"PRIu64,
|
||||
state->funding_satoshis);
|
||||
@@ -581,7 +578,7 @@ static u8 *fundee_channel(struct state *state,
|
||||
*
|
||||
* The receiving node ... MUST fail the channel if `funding-satoshis`
|
||||
* is greater than or equal to 2^24 */
|
||||
if (state->funding_satoshis >= 1 << 24)
|
||||
if (state->funding_satoshis > MAX_FUNDING_SATOSHI)
|
||||
peer_failed(PEER_FD, &state->cs, &state->channel_id,
|
||||
"funding_satoshis %"PRIu64" too large",
|
||||
state->funding_satoshis);
|
||||
|
||||
@@ -44,6 +44,12 @@ bool extract_channel_id(const u8 *in_pkt, struct channel_id *channel_id);
|
||||
*/
|
||||
#define LOCALFEATURES_INITIAL_ROUTING_SYNC 0x08
|
||||
|
||||
/* BOLT #2:
|
||||
*
|
||||
* The sender MUST set `funding_satoshis` to less than 2^24 satoshi.
|
||||
*/
|
||||
#define MAX_FUNDING_SATOSHI ((1 << 24) - 1)
|
||||
|
||||
/* Compare two short_channel_ids and return true if they are the equal */
|
||||
bool short_channel_id_eq(const struct short_channel_id *a,
|
||||
const struct short_channel_id *b);
|
||||
|
||||
Reference in New Issue
Block a user