wallet: update stored witness in AddToWallet#11225
Conversation
Replace witness-stripped wallet transactions with full transactions; this can happen when upgrading from a pre-segwit wallet to a segwit- aware wallet.
|
utACK 617c459. |
|
utACK d01a968 This should be backported to 0.15(.1), I think. |
| } | ||
| // If we have a witness-stripped version of this transaction, and we | ||
| // see a new version with a witness, then we must be upgrading a pre-segwit | ||
| // wallet. Store the new version of the transaction with the witness, |
| // wallet. Store the new version of the transaction with the witness, | ||
| // as the stripped-version must be invalid. | ||
| // TODO: Store all versions of the transaction, instead of just one. | ||
| if (wtxIn.tx->HasWitness() && !wtx.tx->HasWitness()) { |
There was a problem hiding this comment.
First check stored transaction:
if (!wtx.tx->HasWitness() && wtxIn.tx->HasWitness()) {|
BTW, remove TODO comment and create an issue since it requires a significant change/discussion? |
|
Wait, do we want to also update if the witness was malleated on its way into a block? |
|
@TheBlueMatt I considered that issue, and decided it was more conservative (at least for now) to not do that, because: b) is pretty edge-case, to be sure, but since the only benefit to storing the actually-confirmed-witness is recordkeeping, which doesn't affect our wallet's behavior, I figure why risk it. IMO we should eventually store both the original version of the transaction and any malleated versions that get confirmed. |
|
Yea, ok, more complexity than I figured, this is clearly better than nothing as-is and anything more looks like it'll take some real rewriting of our malleability handling. |
d01a968 wallet: update stored witness in AddToWallet (Suhas Daftuar) Pull request description: Replace witness-stripped wallet transactions with full transactions; this can happen when upgrading from a pre-segwit wallet to a segwit- aware wallet. Tree-SHA512: a348b16b38ae738fa75cf7d3ff50ebd0d0071d5d6061c9a10dc3325fc34f6bc96a67aea21fde460ca20f6178768ee0af04d6d8785b35647f436a9083c4270b07
Replace witness-stripped wallet transactions with full transactions; this can happen when upgrading from a pre-segwit wallet to a segwit- aware wallet. Github-Pull: bitcoin#11225 Rebased-From: d01a968
Replace witness-stripped wallet transactions with full transactions;
this can happen when upgrading from a pre-segwit wallet to a segwit-
aware wallet.