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
PSBT(bip174) implementation #4615 #4883
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this. The diff is huge...
I've added some comments (there may be more coming later).
In general, there seems to be a non-negligible amount of code duplication. Maybe that could be reduced?
electrum/wallet.py
Outdated
@@ -592,8 +640,7 @@ def get_unconfirmed_base_tx_for_batching(self) -> Optional[Transaction]: | |||
return tx | |||
return candidate | |||
|
|||
def make_unsigned_transaction(self, coins, outputs, config, fixed_fee=None, | |||
change_addr=None, is_sweep=False): | |||
def make_unsigned_transaction(self, coins, outputs, config, fixed_fee=None, change_addr=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is overridden in trustedcoin.py
and is_sweep
is used there
electrum/electrum/plugins/trustedcoin/trustedcoin.py
Lines 288 to 289 in db89286
def make_unsigned_transaction(self, coins, outputs, config, fixed_fee=None, | |
change_addr=None, is_sweep=False): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can't we get rid of make_unsigned_transaction
in favour of make_psbt
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SomberNight removed together with mktx
Removed all mktx related stuff. |
Offline tests was broken because offline wallet don't know anything about txin, so i've added @SomberNight Any new issues? |
These txns show up in the Where in the code do you specifically need the input/parent transactions? I wonder what side effects of |
Main purpose - |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some more comments
else: | ||
self.add_info_to_psbt(tx) | ||
if self._can_sign(tx): | ||
return True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
watch-only wallets will get here as _can_sign
seems not to be finished.
so e.g. xpub only wallet can click "sign" button in tx dialog
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's ok now?
note: in trace
|
Offline signing with an old electrum seed ( I wrote a test for this in e8a8a17; try to see why that fails. |
Only difference, is compressed public key. I thought that pushing full pubkey shouldn't work. So, now there are full pubkeys, and test works. History tab fixed |
FYI, trezor test fails because import in trezorlib seems to be broken(at least in my environment) |
is it importing mnemonic.py from electrum instead of the global mnemonic package? I've seen that before. pycharm is mangling the PYTHONPATH. maybe see #4907 (comment) |
Looks like there is some serious merge conflicts to resolve here. |
@asfin Thank you for your work. Master now has PSBT support with #5721 In the end we decided to take a different implementation approach, that IMHO makes the code easier to maintain going forward, mainly that
Given that the lightning branch was now merged into master, and mostly due to that this PR had lots of hard to fix conflicts, we decided not to try to rebase this and fix conflicts. This is in large part of course our fault, as this PR should have been reviewed and progressed earlier, before it had developed huge conflicts, but we were focusing on other things, mostly lightning. This PR had seemed a huge task to review and get merged, even at the beginning; and now that I have worked on #5721 for more than a month, I can only tell that indeed it's a lot of work even just to understand the implications and get this kind of change merged. See the design decisions section in the other PR; all of which was not actually discussed here. Rest assured, your work was not wasted, as I had spent several full days just thinking about code architecture, and this PR was a good reference for some of the decisions. |
Support for PSBT serialization format.
Unittests and integration tests provided.
Manually tested(bitcoin testnet) with UI, send to p2sh, p2pkh, p2wsh, p2wpkh. Export to file/qr/buffer works ok.
Resulting PSBT valid for bitcoind
walletprocesspsbt
API, and can be processed and finalized by it.Fixes at least this issues #4615 #4514 #4471
About code:
I think package bip174.py should be renamed, because it doesn't contain BIP174 class.
@SomberNight bip32.py refactoring was conflicted with mine xpubkey_utils.py, so i removed xpubkey_utils.py and just moved rest of it to bip32.py
HW plugins wasn't tested, so if you saw an error, write about it(or just fix).
Some parts of code wasn't properly finalized, because i think that review and some time after merge should find some problems.