mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-08-23 21:32:33 +02:00
wallet: throw error at conflicting tx versions in pre-selected inputs
This commit is contained in:
@@ -283,6 +283,14 @@ util::Result<PreSelectedInputs> FetchSelectedInputs(const CWallet& wallet, const
|
||||
if (input_bytes == -1) {
|
||||
input_bytes = CalculateMaximumSignedInputSize(txout, &wallet, &coin_control);
|
||||
}
|
||||
const CWalletTx& parent_tx = txo->GetWalletTx();
|
||||
if (wallet.GetTxDepthInMainChain(parent_tx) == 0) {
|
||||
if (parent_tx.tx->version == TRUC_VERSION && coin_control.m_version != TRUC_VERSION) {
|
||||
return util::Error{strprintf(_("Can't spend unconfirmed version 3 pre-selected input with a version %d tx"), coin_control.m_version)};
|
||||
} else if (coin_control.m_version == TRUC_VERSION && parent_tx.tx->version != TRUC_VERSION) {
|
||||
return util::Error{strprintf(_("Can't spend unconfirmed version %d pre-selected input with a version 3 tx"), parent_tx.tx->version)};
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// The input is external. We did not find the tx in mapWallet.
|
||||
const auto out{coin_control.GetExternalOutput(outpoint)};
|
||||
|
Reference in New Issue
Block a user