clightning4j / esplora_clnd_plugin

Using @blockstream Esplora web explorer to fetch bitcoin data for clightning
8 stars 11 forks source link

esplora error: bad response to getutxout (bad 'amount' field) #15

Closed vincenzopalazzo closed 4 years ago

vincenzopalazzo commented 4 years ago

Hi @lvaccaro,

I try to using esplora plugin to work with lightningd on my desktop to test the plugin.

I run lightnind several time and I receive this error from lightnind at different points.

I will try to resproduce this bug with my personal esplora plugin version, maybe with more debug print :)

/root/github/lightning/lightningd/../plugins/esplora` error: bad response to getutxout (bad 'amount' field), response was {"jsonrpc":"2.0","id":8426,"result":{"script":"00200fb4a46ec4c5"} }
2020-08-16T23:52:07.979Z **BROKEN** lightningd: /root/github/lightning/lightningd/../plugins/esplora error: bad response to getutxout (bad 'amount' field), response was {"jsonrpc":"2.0","id":8426,"result":{"script":"00200fb4a46ec4c5"} }
lightningd: FATAL SIGNAL 6 (version v0.8.2-625-ga3da02a)
0x55b88875dd91 send_backtrace
    common/daemon.c:38
0x55b88875de2b crashdump
    common/daemon.c:51
0x7f2bf1cd820f ???
    ???:0
0x7f2bf1cd818b ???
    ???:0
0x7f2bf1cb7858 ???
    ???:0
0x55b88873e51f fatal
    lightningd/log.c:820
0x55b88872b119 bitcoin_plugin_error
    lightningd/bitcoind.c:119
0x55b88872ba7d getutxout_callback
    lightningd/bitcoind.c:559
0x55b888754322 plugin_response_handle
    lightningd/plugin.c:366
0x55b88875442e plugin_read_json_one
    lightningd/plugin.c:475
0x55b888754569 plugin_read_json
    lightningd/plugin.c:508
0x55b8887a35e1 next_plan
    ccan/ccan/io/io.c:59
0x55b8887a3a8c do_plan
    ccan/ccan/io/io.c:407
0x55b8887a3b29 io_ready
    ccan/ccan/io/io.c:417
0x55b8887a546d io_loop
    ccan/ccan/io/poll.c:445
0x55b888738c9d io_loop_with_timers
    lightningd/io_loop_with_timers.c:24
0x55b88873c459 main
    lightningd/lightningd.c:1014
0x7f2bf1cb90b2 ???
    ???:0
0x55b88872ae6d ???
    ???:0
0xffffffffffffffff ???
    ???:0
2020-08-16T23:52:08.019Z **BROKEN** lightningd: FATAL SIGNAL 6 (version v0.8.2-625-ga3da02a)
2020-08-16T23:52:08.019Z **BROKEN** lightningd: backtrace: common/daemon.c:43 (send_backtrace) 0x55b88875ddd9
2020-08-16T23:52:08.019Z **BROKEN** lightningd: backtrace: common/daemon.c:51 (crashdump) 0x55b88875de2b
2020-08-16T23:52:08.019Z **BROKEN** lightningd: backtrace: (null):0 ((null)) 0x7f2bf1cd820f
2020-08-16T23:52:08.019Z **BROKEN** lightningd: backtrace: (null):0 ((null)) 0x7f2bf1cd818b
2020-08-16T23:52:08.019Z **BROKEN** lightningd: backtrace: (null):0 ((null)) 0x7f2bf1cb7858
2020-08-16T23:52:08.019Z **BROKEN** lightningd: backtrace: lightningd/log.c:820 (fatal) 0x55b88873e51f
2020-08-16T23:52:08.019Z **BROKEN** lightningd: backtrace: lightningd/bitcoind.c:119 (bitcoin_plugin_error) 0x55b88872b119
2020-08-16T23:52:08.019Z **BROKEN** lightningd: backtrace: lightningd/bitcoind.c:559 (getutxout_callback) 0x55b88872ba7d
2020-08-16T23:52:08.019Z **BROKEN** lightningd: backtrace: lightningd/plugin.c:366 (plugin_response_handle) 0x55b888754322
2020-08-16T23:52:08.019Z **BROKEN** lightningd: backtrace: lightningd/plugin.c:475 (plugin_read_json_one) 0x55b88875442e
2020-08-16T23:52:08.019Z **BROKEN** lightningd: backtrace: lightningd/plugin.c:508 (plugin_read_json) 0x55b888754569
2020-08-16T23:52:08.019Z **BROKEN** lightningd: backtrace: ccan/ccan/io/io.c:59 (next_plan) 0x55b8887a35e1
2020-08-16T23:52:08.019Z **BROKEN** lightningd: backtrace: ccan/ccan/io/io.c:407 (do_plan) 0x55b8887a3a8c
2020-08-16T23:52:08.019Z **BROKEN** lightningd: backtrace: ccan/ccan/io/io.c:417 (io_ready) 0x55b8887a3b29
2020-08-16T23:52:08.019Z **BROKEN** lightningd: backtrace: ccan/ccan/io/poll.c:445 (io_loop) 0x55b8887a546d
2020-08-16T23:52:08.019Z **BROKEN** lightningd: backtrace: lightningd/io_loop_with_timers.c:24 (io_loop_with_timers) 0x55b888738c9d
2020-08-16T23:52:08.019Z **BROKEN** lightningd: backtrace: lightningd/lightningd.c:1014 (main) 0x55b88873c459
2020-08-16T23:52:08.020Z **BROKEN** lightningd: backtrace: (null):0 ((null)) 0x7f2bf1cb90b2
2020-08-16T23:52:08.020Z **BROKEN** lightningd: backtrace: (null):0 ((null)) 0x55b88872ae6d
2020-08-16T23:52:08.020Z **BROKEN** lightningd: backtrace: (null):0 ((null)) 0xffffffffffffffff
Log dumped in crash.log.20200816235208
darosior commented 4 years ago

This is weird.. The script isn't even of the right size

darosior commented 4 years ago

Hmm maybe

diff --git a/esplora.c b/esplora.c
index f3dbebf..7ced1b9 100644
--- a/esplora.c
+++ b/esplora.c
@@ -491,7 +491,7 @@ static struct command_result *getutxout(struct command *cmd, const char *buf,
   response = jsonrpc_stream_success(cmd);
   json_add_amount_sat_only(response, "amount", output.amount);
   json_add_string(response, "script",
-                  tal_hexstr(response, output.script, sizeof(output.script)));
+                  tal_hex(response, output.script));

   return command_finished(cmd, response);
 }

fixes it (the weird script len) ?

vincenzopalazzo commented 4 years ago

@darosior I will test the PR today and I will let know the result :-) Thanks!

vincenzopalazzo commented 4 years ago

I think this is fixed :dagger: