aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/rpc/util.cpp
diff options
context:
space:
mode:
authorHarris <brakmic@gmail.com>2020-04-27 10:45:03 +0200
committerAurèle Oulès <aurele@oules.com>2023-04-26 16:07:47 +0200
commit710b83938ab5bbc4bd324d8b2e69461a2a1d2eec (patch)
treee78465394ff8286c4969d565209f18bd8252c5a3 /src/wallet/rpc/util.cpp
parent91ccb62faab21b2b52b089cc04f3a5c1bf6989cc (diff)
rpc: return block hash & height in getbalances, gettransaction & getwalletinfo JSONs
Co-authored-by: Aurèle Oulès <aurele@oules.com>
Diffstat (limited to 'src/wallet/rpc/util.cpp')
-rw-r--r--src/wallet/rpc/util.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/wallet/rpc/util.cpp b/src/wallet/rpc/util.cpp
index 4d82e0a41f..4ff44b84b0 100644
--- a/src/wallet/rpc/util.cpp
+++ b/src/wallet/rpc/util.cpp
@@ -177,4 +177,14 @@ void HandleWalletError(const std::shared_ptr<CWallet> wallet, DatabaseStatus& st
throw JSONRPCError(code, error.original);
}
}
+
+void AppendLastProcessedBlock(UniValue& entry, const CWallet& wallet) EXCLUSIVE_LOCKS_REQUIRED(wallet.cs_wallet)
+{
+ AssertLockHeld(wallet.cs_wallet);
+ UniValue lastprocessedblock{UniValue::VOBJ};
+ lastprocessedblock.pushKV("hash", wallet.GetLastBlockHash().GetHex());
+ lastprocessedblock.pushKV("height", wallet.GetLastBlockHeight());
+ entry.pushKV("lastprocessedblock", lastprocessedblock);
+}
+
} // namespace wallet