mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-26 19:23:26 -03:00
Merge #11225: wallet: update stored witness in AddToWallet
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
This commit is contained in:
commit
dc597bb895
1 changed files with 9 additions and 0 deletions
|
@ -915,6 +915,15 @@ bool CWallet::AddToWallet(const CWalletTx& wtxIn, bool fFlushOnClose)
|
||||||
wtx.fFromMe = wtxIn.fFromMe;
|
wtx.fFromMe = wtxIn.fFromMe;
|
||||||
fUpdated = true;
|
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
|
//// debug print
|
||||||
|
|
Loading…
Add table
Reference in a new issue