[blockchain] Fix sent calculation in the RPC backend

We used to consider a tx input as ours if we had the
tx that creates it in the database.
This commit actually checks if an input is ours before adding
its value to the `sent` field.
This commit is contained in:
Daniela Brozzoni committed 2022-02-18 12:54:51 +01:00
1 parent 128c37595c
commit bfd0d13779
2 files changed
+47 -2

No files matched your search

+3 -1
View File
@@ -257,7 +257,9 @@ impl Blockchain for RpcBlockchain {
for input in tx.input.iter() {
if let Some(previous_output) = db.get_previous_output(&input.previous_output)? {
sent += previous_output.value;
if db.is_mine(&previous_output.script_pubkey)? {
sent += previous_output.value;
}
}
}