[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
2022-02-17 23:39:11 +01:00
parent 128c37595c
commit bfd0d13779
2 changed files with 47 additions and 2 deletions

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;
}
}
}