mirror of
https://github.com/dashpay/dash.git
synced 2024-12-28 21:42:47 +01:00
move more bumpfee prechecks to feebumper::PreconditionChecks
This commit is contained in:
parent
b5e4b9b510
commit
718f05cab5
@ -65,6 +65,25 @@ static feebumper::Result PreconditionChecks(const CWallet* wallet, const CWallet
|
|||||||
errors.push_back("Transaction has been mined, or is conflicted with a mined transaction");
|
errors.push_back("Transaction has been mined, or is conflicted with a mined transaction");
|
||||||
return feebumper::Result::WALLET_ERROR;
|
return feebumper::Result::WALLET_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!SignalsOptInRBF(*wtx.tx)) {
|
||||||
|
errors.push_back("Transaction is not BIP 125 replaceable");
|
||||||
|
return feebumper::Result::WALLET_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (wtx.mapValue.count("replaced_by_txid")) {
|
||||||
|
errors.push_back(strprintf("Cannot bump transaction %s which was already bumped by transaction %s", wtx.GetHash().ToString(), wtx.mapValue.at("replaced_by_txid")));
|
||||||
|
return feebumper::Result::WALLET_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
// check that original tx consists entirely of our inputs
|
||||||
|
// if not, we can't bump the fee, because the wallet has no way of knowing the value of the other inputs (thus the fee)
|
||||||
|
if (!wallet->IsAllFromMe(*wtx.tx, ISMINE_SPENDABLE)) {
|
||||||
|
errors.push_back("Transaction contains inputs that don't belong to this wallet");
|
||||||
|
return feebumper::Result::WALLET_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return feebumper::Result::OK;
|
return feebumper::Result::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,23 +113,6 @@ Result CreateTransaction(const CWallet* wallet, const uint256& txid, const CCoin
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!SignalsOptInRBF(*wtx.tx)) {
|
|
||||||
errors.push_back("Transaction is not BIP 125 replaceable");
|
|
||||||
return Result::WALLET_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (wtx.mapValue.count("replaced_by_txid")) {
|
|
||||||
errors.push_back(strprintf("Cannot bump transaction %s which was already bumped by transaction %s", txid.ToString(), wtx.mapValue.at("replaced_by_txid")));
|
|
||||||
return Result::WALLET_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
// check that original tx consists entirely of our inputs
|
|
||||||
// if not, we can't bump the fee, because the wallet has no way of knowing the value of the other inputs (thus the fee)
|
|
||||||
if (!wallet->IsAllFromMe(*wtx.tx, ISMINE_SPENDABLE)) {
|
|
||||||
errors.push_back("Transaction contains inputs that don't belong to this wallet");
|
|
||||||
return Result::WALLET_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
// figure out which output was change
|
// figure out which output was change
|
||||||
// if there was no change output or multiple change outputs, fail
|
// if there was no change output or multiple change outputs, fail
|
||||||
int nOutput = -1;
|
int nOutput = -1;
|
||||||
@ -228,6 +230,7 @@ Result CreateTransaction(const CWallet* wallet, const uint256& txid, const CCoin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return Result::OK;
|
return Result::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user