electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 2aebcc5e26608cbbc7c9f1332268338ca8f6242c
parent fc80f7a8743f14da25b6abdcc11793735144198b
Author: SomberNight <somber.night@protonmail.com>
Date:   Thu,  5 Mar 2020 17:27:43 +0100

commands: gate get_channel_ctx behind --iknowwhatimdoing

Diffstat:
Melectrum/commands.py | 5++++-
Melectrum/tests/regtest/regtest.sh | 8++++----
2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/electrum/commands.py b/electrum/commands.py @@ -1037,8 +1037,11 @@ class Commands: return await coro @command('wn') - async def get_channel_ctx(self, channel_point, wallet: Abstract_Wallet = None): + async def get_channel_ctx(self, channel_point, iknowwhatimdoing=False, wallet: Abstract_Wallet = None): """ return the current commitment transaction of a channel """ + if not iknowwhatimdoing: + raise Exception("WARNING: this command is potentially unsafe.\n" + "To proceed, try again, with the --iknowwhatimdoing option.") txid, index = channel_point.split(':') chan_id, _ = channel_id_from_funding_tx(txid, int(index)) chan = wallet.lnworker.channels[chan_id] diff --git a/electrum/tests/regtest/regtest.sh b/electrum/tests/regtest/regtest.sh @@ -149,7 +149,7 @@ if [[ $1 == "breach" ]]; then echo "alice pays" $alice lnpay $request sleep 2 - ctx=$($alice get_channel_ctx $channel) + ctx=$($alice get_channel_ctx $channel --iknowwhatimdoing) request=$($bob add_lightning_request 0.01 -m "blah2") echo "alice pays again" $alice lnpay $request @@ -219,7 +219,7 @@ if [[ $1 == "breach_with_unspent_htlc" ]]; then echo "enable_htlc_settle did not work, $settled != 0" exit 1 fi - ctx=$($alice get_channel_ctx $channel) + ctx=$($alice get_channel_ctx $channel --iknowwhatimdoing) $bob enable_htlc_settle true settled=$($alice list_channels | jq '.[] | .local_htlcs | .settles | length') if [[ "$settled" != "1" ]]; then @@ -243,7 +243,7 @@ if [[ $1 == "breach_with_spent_htlc" ]]; then echo "alice pays bob" invoice=$($bob add_lightning_request 0.05 -m "test") $alice lnpay $invoice --timeout=1 || true - ctx=$($alice get_channel_ctx $channel) + ctx=$($alice get_channel_ctx $channel --iknowwhatimdoing) settled=$($alice list_channels | jq '.[] | .local_htlcs | .settles | length') if [[ "$settled" != "0" ]]; then echo "enable_htlc_settle did not work, $settled != 0" @@ -307,7 +307,7 @@ if [[ $1 == "watchtower" ]]; then echo "alice pays bob" invoice1=$($bob add_lightning_request 0.01 -m "invoice1") $alice lnpay $invoice1 - ctx=$($alice get_channel_ctx $channel) + ctx=$($alice get_channel_ctx $channel --iknowwhatimdoing) echo "alice pays bob again" invoice2=$($bob add_lightning_request 0.01 -m "invoice2") $alice lnpay $invoice2