Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Electrum 4.0.3 upgrade and 1.0 release #17

Merged
merged 14 commits into from
Sep 28, 2020
Merged

Electrum 4.0.3 upgrade and 1.0 release #17

merged 14 commits into from
Sep 28, 2020

Conversation

MrNaif2018
Copy link
Member

@MrNaif2018 MrNaif2018 commented Sep 12, 2020

This PR makes necessary changes to SDK to work with electrum 4.0
Daemon PR: bitcart/bitcart#123

Some changes in SDK in this PR:

  • onchain_history now doesn't need to be json.load'ed, this bug was fixed. SDK update will make it seamless
  • addinvoice renamed to add_invoice (breaking)
  • poll_updates timeout before re-fetching new updates decreased from 2 to 1 second

Breaking changes since last electrum version, documented here:

  • pay_to/pay_to_many, with broadcast=False now returns str instead of a dict, removing redundant keys. It now returns raw transaction directly.
  • add_invoice now returns a dictionary instead of str
    Before it returned lightning invoice itself, now it returns payment request dict for lightning, where invoice is in invoice key
    dict structure:
    {
        "is_lightning": True,
        "amount_BTC": "0.5",
        "message": "test description",
        "expiration": 3600,
        "status": 0,
        "status_str": "Expires in about 1 hour",
        "amount_msat": 50000000000,
        "can_receive": False,
    }
    
    plus timestamp key (int), rhash (str) and invoice (str)
  • On non-segwit wallets, errors.LightningUnsupportedError will be raised now
  • add_request/get_request structure changed:
    • memo key renamed to message (payment request description)
    • amount key to amount_sat (amount in satoshis)
    • new is_lightning key, which will be False on payment requests
  • get_tx output format changed:
    • removed partial and segwit_ser keys
    • lockTime renamed to locktime
    • inputs format changes:
      • added coinbase key (bool)
      • renamed sequence to nsequence
      • removed type, address and num_sig keys
    • outputs format changes:
      • scriptPubKey renamed to scriptpubkey
      • value renamed to value_sats
      • removed prevout_n and type keys
  • list_channels output format changed:
    • items are now ordered, last channel is last in the list
    • channel format changes:
      • channel_id renamed to short_channel_id
      • full_channel_id renamed to channel_id
      • added new peer_state key (str)
      • removed local_htlcs and remote_htlcs
      • added local_reserve (int), remote_reserve (int), local_unsettled_sent (int) and remote_unsettled_sent (int) keys
  • lnpay output changed:
    • It doesn't raise NoPathFoundError or any other errors anymore
    • It now returns a dict with keys success (bool), preimage (Optional[str]) and log (list of lists of strings)

Some current issues:

  • After many pay_to, open_channel seems to be not working at all, large sleep interval > 5 seconds is needed. It returns insufficient funds even when there are enough funds. (done)
  • close_channel raises error Failed to verify our signature, only force-close works. (done)

TODO:

@codecov
Copy link

codecov bot commented Sep 12, 2020

Codecov Report

Merging #17 into master will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master       #17   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           11        11           
  Lines          336       330    -6     
=========================================
- Hits           336       330    -6     
Impacted Files Coverage Δ
bitcart/errors.py 100.00% <ø> (ø)
bitcart/coins/btc.py 100.00% <100.00%> (ø)
bitcart/event_delivery.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a83d70a...40bf4f0. Read the comment docs.

@MrNaif2018 MrNaif2018 changed the title Electrum 4.0.3 upgrade Electrum 4.0.3 upgrade and 1.0 release Sep 27, 2020
@MrNaif2018
Copy link
Member Author

Breaking changes since last electrum version, documented here (for changelog):

  • pay_to/pay_to_many, with broadcast=False now returns str instead of a dict, removing redundant keys. It now returns raw transaction directly.
  • add_invoice now returns a dictionary instead of str
    Before it returned lightning invoice itself, now it returns payment request dict for lightning, where invoice is in invoice key
    dict structure:
    {
        "is_lightning": True,
        "amount_BTC": "0.5",
        "message": "test description",
        "expiration": 3600,
        "status": 0,
        "status_str": "Expires in about 1 hour",
        "amount_msat": 50000000000,
        "can_receive": False,
    }
    
    plus timestamp key (int), rhash (str) and invoice (str)
  • On non-segwit wallets, errors.LightningUnsupportedError will be raised now
  • add_request/get_request structure changed:
    • memo key renamed to message (payment request description)
    • amount key to amount_sat (amount in satoshis)
    • new is_lightning key, which will be False on payment requests
  • get_tx output format changed:
    • removed partial and segwit_ser keys
    • lockTime renamed to locktime
    • inputs format changes:
      • added coinbase key (bool)
      • renamed sequence to nsequence
      • removed type, address and num_sig keys
    • outputs format changes:
      • scriptPubKey renamed to scriptpubkey
      • value renamed to value_sats
      • removed prevout_n and type keys
  • list_channels output format changed:
    • items are now ordered, last channel is last in the list
    • channel format changes:
      • channel_id renamed to short_channel_id
      • full_channel_id renamed to channel_id
      • added new peer_state key (str)
      • removed local_htlcs and remote_htlcs
      • added local_reserve (int), remote_reserve (int), local_unsettled_sent (int) and remote_unsettled_sent (int) keys
  • lnpay output changed:
    • It doesn't raise NoPathFoundError or any other errors anymore
    • It now returns a dict with keys success (bool), preimage (Optional[str]) and log (list of lists of strings)

@MrNaif2018 MrNaif2018 merged commit 1810cba into master Sep 28, 2020
@MrNaif2018 MrNaif2018 deleted the electrum-4.0.3 branch September 28, 2020 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants