jsonrpc: Return an error if funding amount is too large

Fixes #516

Reported-by: @instagibbs
Signed-off-by: Christian Decker <decker.christian@gmail.com>
This commit is contained in:
Christian Decker
2018-01-12 19:40:09 +01:00
parent dbef4a1827
commit 351718e90f
2 changed files with 6 additions and 0 deletions

View File

@@ -2559,6 +2559,11 @@ static void json_fund_channel(struct command *cmd,
return; return;
} }
if (fc->funding_satoshi >= MAX_FUNDING_MSATOSHI) {
command_fail(cmd, "Funding msatoshi must be < %d", MAX_FUNDING_MSATOSHI);
return;
}
/* FIXME: Support push_msat? */ /* FIXME: Support push_msat? */
fc->push_msat = 0; fc->push_msat = 0;

View File

@@ -14,6 +14,7 @@
#include <wire/peer_wire.h> #include <wire/peer_wire.h>
#define ANNOUNCE_MIN_DEPTH 6 #define ANNOUNCE_MIN_DEPTH 6
#define MAX_FUNDING_MSATOSHI (1 << 24)
struct crypto_state; struct crypto_state;