HomePhabricator

[chronik] Electrum: gracefully error when the message is too big to be…

Description

[chronik] Electrum: gracefully error when the message is too big to be serialized

Summary: Don't panic in this case.

Test Plan:
On terminal 1

ninja && ./src/bitcoind -debug=chronik -chronik -chronikscripthashindex -chronikelectrumbind="127.0.0.1:50001:t"

On terminal 2

echo '{"jsonrpc": "2.0", "method": "blockchain.scripthash.get_history", "params": ["44f2ccb974231cfc9d13e4badc782868e1248e8d6dbb202a3a3b854484628dd2"], "id": "test"}' | nc 127.0.0.1 50001 | jq

Check that terminal 1 does not print this message

thread 'tokio-runtime-worker' panicked at chronik/chronik-http/src/electrum_codec.rs:26:12:
range end index 15220560 out of range for slice of length 1048576
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Reproduced on master, fixed with this diff.

Reviewers: #bitcoin_abc, PiRK

Reviewed By: #bitcoin_abc, PiRK

Subscribers: PiRK

Differential Revision: https://reviews.bitcoinabc.org/D18114

Details

Provenance
FabienAuthored on Mon, May 19, 15:22
FabienPushed on Tue, May 20, 21:42
Reviewer
Restricted Project
Differential Revision
D18114: [chronik] Electrum: gracefully error when the message is too big to be serialized
Parents
rABCaf085ec01ace: [ecash-lib] Add `PkcAlgo` to verify common elliptic curve and RSA signatures
Branches
Unknown
Tags
Unknown