diff options
| author | Suhas Daftuar <[email protected]> | 2017-09-03 08:43:35 -0400 |
|---|---|---|
| committer | Suhas Daftuar <[email protected]> | 2017-09-03 08:57:17 -0400 |
| commit | d01a9682b126a5f83c7311e652e6e62f2c2e1d20 (patch) | |
| tree | 488fe400d249d0e1bea2f34bfdb2364ecefbec52 | |
| parent | Merge #11198: [Qt] Fix display of package name on 'open config file' tooltip (diff) | |
| download | discoin-d01a9682b126a5f83c7311e652e6e62f2c2e1d20.tar.xz discoin-d01a9682b126a5f83c7311e652e6e62f2c2e1d20.zip | |
wallet: update stored witness in AddToWallet
Replace witness-stripped wallet transactions with full transactions;
this can happen when upgrading from a pre-segwit wallet to a segwit-
aware wallet.
| -rw-r--r-- | src/wallet/wallet.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index d1d2060b0..4b48735e1 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -914,6 +914,15 @@ bool CWallet::AddToWallet(const CWalletTx& wtxIn, bool fFlushOnClose) wtx.fFromMe = wtxIn.fFromMe; fUpdated = true; } + // 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, + // 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()) { + wtx.SetTx(wtxIn.tx); + fUpdated = true; + } } //// debug print |