wallet: throw error at conflicting tx versions in pre-selected inputs
This commit is contained in:
1 parent
cc155226fe
commit
0804fc3cb1
1 file changed
+8
@@ -283,6 +283,14 @@ util::Result<PreSelectedInputs> FetchSelectedInputs(const CWallet& wallet, const
|
|||||||
if (input_bytes == -1) {
|
if (input_bytes == -1) {
|
||||||
input_bytes = CalculateMaximumSignedInputSize(txout, &wallet, &coin_control);
|
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 {
|
} else {
|
||||||
// The input is external. We did not find the tx in mapWallet.
|
// The input is external. We did not find the tx in mapWallet.
|
||||||
const auto out{coin_control.GetExternalOutput(outpoint)};
|
const auto out{coin_control.GetExternalOutput(outpoint)};
|
||||||
|
|||||||
Reference in new issue
Block a user