Merge #7812: Tiny refactor of IsRBFOptIn, avoid exception

4f7c959 Refactor IsRBFOptIn, avoid exception (Jonas Schnelli)
This commit is contained in:
Wladimir J. van der Laan
2016-04-14 16:32:41 +02:00
3 changed files with 19 additions and 16 deletions

View File

@@ -82,15 +82,11 @@ void WalletTxToJSON(const CWalletTx& wtx, UniValue& entry)
std::string rbfStatus = "no";
if (confirms <= 0) {
LOCK(mempool.cs);
if (!mempool.exists(hash)) {
if (SignalsOptInRBF(wtx)) {
rbfStatus = "yes";
} else {
rbfStatus = "unknown";
}
} else if (IsRBFOptIn(*mempool.mapTx.find(hash), mempool)) {
RBFTransactionState rbfState = IsRBFOptIn(wtx, mempool);
if (rbfState == RBF_TRANSACTIONSTATE_UNKNOWN)
rbfStatus = "unknown";
else if (rbfState == RBF_TRANSACTIONSTATE_REPLACEABLE_BIP125)
rbfStatus = "yes";
}
}
entry.push_back(Pair("bip125-replaceable", rbfStatus));