| 90 | } |
| 91 | |
| 92 | static void WalletTxToJSON(const CWalletTx& wtx, UniValue& entry) |
| 93 | { |
| 94 | int confirms = wtx.GetDepthInMainChain(); |
| 95 | entry.pushKV("confirmations", confirms); |
| 96 | if (wtx.IsCoinBase()) |
| 97 | entry.pushKV("generated", true); |
| 98 | if (confirms > 0) |
| 99 | { |
| 100 | entry.pushKV("blockhash", wtx.hashBlock.GetHex()); |
| 101 | entry.pushKV("blockindex", wtx.nIndex); |
| 102 | entry.pushKV("blocktime", LookupBlockIndex(wtx.hashBlock)->GetBlockTime()); |
| 103 | } else { |
| 104 | entry.pushKV("trusted", wtx.IsTrusted()); |
| 105 | } |
| 106 | uint256 hash = wtx.GetHash(); |
| 107 | entry.pushKV("txid", hash.GetHex()); |
| 108 | UniValue conflicts(UniValue::VARR); |
| 109 | for (const uint256& conflict : wtx.GetConflicts()) |
| 110 | conflicts.push_back(conflict.GetHex()); |
| 111 | entry.pushKV("walletconflicts", conflicts); |
| 112 | entry.pushKV("time", wtx.GetTxTime()); |
| 113 | entry.pushKV("timereceived", (int64_t)wtx.nTimeReceived); |
| 114 | |
| 115 | // Add opt-in RBF status |
| 116 | std::string rbfStatus = "no"; |
| 117 | if (confirms <= 0) { |
| 118 | LOCK(mempool.cs); |
| 119 | RBFTransactionState rbfState = IsRBFOptIn(*wtx.tx, mempool); |
| 120 | if (rbfState == RBFTransactionState::UNKNOWN) |
| 121 | rbfStatus = "unknown"; |
| 122 | else if (rbfState == RBFTransactionState::REPLACEABLE_BIP125) |
| 123 | rbfStatus = "yes"; |
| 124 | } |
| 125 | entry.pushKV("bip125-replaceable", rbfStatus); |
| 126 | |
| 127 | for (const std::pair<const std::string, std::string>& item : wtx.mapValue) |
| 128 | entry.pushKV(item.first, item.second); |
| 129 | } |
| 130 | |
| 131 | static std::string LabelFromValue(const UniValue& value) |
| 132 | { |
no test coverage detected