Commit Graph

79 Commits

Author SHA1 Message Date
SomberNight
968eeebdc0 transaction: follow-up prev
makes more sense to special-case deserialize()
and not invoke the extra logic then
2020-03-01 22:08:18 +01:00
SomberNight
8560930bac transaction: (fix) invalidate ser cache when changing locktime/version
we can keep the same API, using @property,
instead of introducing getters and setters
2020-03-01 09:57:59 +01:00
SomberNight
a32af44ff9 trivial clean-up (typing/imports) 2020-02-28 20:27:35 +01:00
ThomasV
15e91169c5 lnpeer: fix json serialization of funding_inputs 2020-02-27 19:51:16 +01:00
ThomasV
6833adf8b6 simplify previous commit (revert changes on transaction.py) 2020-02-26 14:16:21 +01:00
ThomasV
e85fb25146 lnpeer: verify signature in closing_signed 2020-02-26 12:58:40 +01:00
SomberNight
9ab18ea6c9 transaction.deserialize: more sanity checks
this is mandated by consensus
99813a9745/src/consensus/tx_check.cpp (L13)
2020-02-25 21:14:41 +01:00
SomberNight
6937b87a7c transaction.BCDataStream: minor fixes
- fix read/write_boolean (though unused...)
- sanity check in read_bytes
2020-02-25 20:05:46 +01:00
zebra-lucky
c0be0471f2 fix BCDataStream.read_bytes (#5991)
* fix BCDataStream.read_bytes

* followup fix BCDataStream.read_bytes: fix TestBCDataStream.test_bytes
2020-02-25 18:58:03 +00:00
SomberNight
aaf174ef3e lnpeer: cooperative close: verify scriptpubkey matches templates 2020-02-25 17:54:49 +01:00
SomberNight
18c6451518 json_db: only deserialize transactions on-demand 2020-01-19 05:49:12 +01:00
SomberNight
d2f132738a wallet: only select mature coins by default
this is a regression from #5721

Removed the `TxInput.is_coinbase` method as I think it is a confusing API,
instead we now have `TxInput.is_coinbase_input` and `TxInput.is_coinbase_output`.

related #5872
2020-01-02 00:43:49 +01:00
SomberNight
8cf3587aeb base_encode/base_decode: change to saner API 2019-12-08 06:19:51 +01:00
ThomasV
a6aa97c3e3 Merge pull request #5820 from SomberNight/201912_ecdsa_sig_r_grinding
ECDSA signatures: grind low R to match with Bitcoin Core (take 2)
2019-12-06 20:38:46 +01:00
SomberNight
61aebd0f2d (fix) qt coin selection: signatures for coins would persist in memory
Scenario: select some UTXOs in the 'Coins' tab. Create a tx and sign it.
Close the tx dialog without broadcasting/etc (cancel tx).
Signatures would remain for selected UTXOs.
Create new tx -> invalid sigs.
2019-12-06 19:45:55 +01:00
SomberNight
5b88b8667e also grind ecdsa low R when using libsecp256k1, and fix tests
note: low R grinding would not have to be duplicated if we trusted the caller
to have done it already (as is the case with the classes in ecc.py), and if
we propagated the choice of "random_k" as part of the nonce_function passed
to libsecp256k1 (which is not currently done)
2019-12-05 20:27:55 +01:00
ThomasV
78813dcb7d Pass make_tx function to ConfirmTxDialog
- allow 'spend max' when opening a channel (fixes #5698)
 - display amount minus fee when 'max' buttons are pressed
 - estimate fee of channel funding using a template with dummy address
2019-11-14 10:20:19 +01:00
SomberNight
bf8a58c0b4 tx_from_any: strip whitespaces
see https://github.com/spesmilo/electrum/pull/5721#issuecomment-551876236
2019-11-08 17:51:48 +01:00
SomberNight
85a4811742 transaction.tx_from_any: recognise even more types, and add tests 2019-11-08 15:01:18 +01:00
SomberNight
cd49839bc0 transaction: helpful error msg if user tries to load old partial tx 2019-11-07 07:07:02 +01:00
SomberNight
27df235c26 transactions: reading QR codes: clean-up and accept all encodings 2019-11-07 06:33:15 +01:00
SomberNight
29a6e3c019 psbt: implement PSBT_GLOBAL_VERSION field
based on latest BIP-0174 update: bitcoin/bips#849
2019-11-07 03:43:00 +01:00
SomberNight
83740c1a78 psbt: implement CompactSize key types (previously single-byte types)
based on latest BIP-0174 update: bitcoin/bips#849
2019-11-07 03:27:38 +01:00
SomberNight
aa518c0ea5 psbt: allow insecure signing of legacy UTXOs without full previous tx
When "importing" a psbt, we accept witness utxos even for legacy inputs
(warning shown to user in gui).
When "exporting" a psbt, we follow the spec; except when exporting as a QR code,
in which case we include witness utxos for all inputs.
This makes QR codes for psbts with legacy inputs feasible, just like they
were before, with our custom tx serialization format (with the same risk,
of burning coins as miner fees).
2019-11-07 02:40:10 +01:00
SomberNight
8a7c3447b3 tx dialog: try harder to show fee 2019-11-07 02:24:16 +01:00
SomberNight
955caa7292 transaction: to_json() debug methods display bip32 str (not int) paths 2019-11-05 23:39:50 +01:00
SomberNight
46db33df75 psbt: follow-ups: BCDataStream.read_bytes() should return bytes
This fixes keepkey, as in particular the code in the plugin expected
TxOutpoint.txid to be bytes not a bytearray (and the TxOutpoint named tuple
itself claims txid to be bytes).
2019-11-05 23:35:32 +01:00
SomberNight
cc4f6804b0 psbt: follow-ups: fix trezor 2019-11-05 23:32:00 +01:00
SomberNight
26a5f212cb psbt: cleaner API for serialize* methods 2019-11-04 22:25:16 +01:00
SomberNight
1017fefdc9 psbt: only include xpubs for multisig wallets 2019-11-04 22:25:13 +01:00
SomberNight
90b190bbcd psbt: fix bug re witness_utxo serialization 2019-11-04 22:25:09 +01:00
SomberNight
d872be7f6b psbt: don't put xpubs and full paths into tx by def; only while signing 2019-11-04 22:25:02 +01:00
SomberNight
e6c841d05f psbt: put fake xpubs into globals. keystores handle xfp/der_prefix missing 2019-11-04 22:24:59 +01:00
SomberNight
7eb7eb8674 add support for manual coinjoins 2019-11-04 22:24:55 +01:00
SomberNight
bafe8a2fff integrate PSBT support natively. WIP 2019-11-04 22:24:36 +01:00
SomberNight
b138fff9a5 wallet: txi/txo small clean-up 2019-09-12 04:07:17 +02:00
SomberNight
befa8ea771 transaction: kill "name", "csv_delay", "cltv_expiry" fields 2019-09-09 19:38:35 +02:00
ThomasV
64deb87ade fix #5513 2019-09-09 11:58:32 +02:00
SomberNight
83fcdbd561 lnchannel: handle htlc-address collisions
We were previously generating an incorrect commitment_signed msg if there were
multiple htlcs sharing the same scriptPubKey.
2019-09-07 08:54:41 +02:00
SomberNight
ab76a1fe5b wallet.add_hw_info: also store "is_change" in output_info
as it seems every consumer wants to know this and has its own hacks to
figure it out
2019-09-03 14:34:10 +02:00
SomberNight
44761972cb lnchannel: ctx output-ordering: identical htlcs are ordered by CLTV 2019-08-20 09:03:12 +02:00
Janus
2c1fcb2f54 ln: remove EncumberedTransaction 2019-08-20 09:03:11 +02:00
ThomasV
fde9f91902 lnchannel: store pre-signed sweep transactions after each new commitment 2019-08-20 09:03:11 +02:00
SomberNight
595cfcbb65 move sweeping methods from lnchan.py to new file
also sweep "received" htlcs from "our" ctx
also sweep htlcs from their ctx (non-breach)
extract ctn; included_htlcs_in_their_latest_ctxs
2019-08-20 09:03:11 +02:00
SomberNight
8390da9b7b bitcoin.py: dedupe pubkeyhash_to_p2pkh_script 2019-07-31 01:18:51 +02:00
SomberNight
cc42b4a226 transaction: segwit input signing was doing quadratic hashing
performance improvements are negligible for typical transactions though.
some measurements of wall clock time for Transaction.sign (with libsecp256k1):
  0.11 sec -> 0.08 sec    (  61 p2wpkh-p2sh inputs, 1 output)
  2.48 sec -> 0.75 sec    ( 522 p2wpkh-p2sh inputs, 1 output)
 13.2  sec -> 1.8  sec    (1445 p2wpkh inputs, 1 output)
176.4  sec -> 7.6  sec    (5542 p2wpkh inputs, 1 output)
2019-07-09 17:37:02 +02:00
SomberNight
a14016275b transaction.serialize_preimage: trivial clean-up 2019-07-08 05:58:57 +02:00
SomberNight
aadde9be17 transaction: fix remove_signatures
closes #5491
2019-07-05 21:16:58 +02:00
SomberNight
94b721baa4 wallet: fix type error in _bump_fee_through_decreasing_outputs
fixes #5483
2019-07-04 17:23:34 +02:00
SomberNight
5effaaf428 TxOutput usage: trivial clean-up 2019-06-19 21:59:49 +02:00