From 02f070ba73fd9bc1c1273940c3e6440831ea9d54 Mon Sep 17 00:00:00 2001
From: Moul <moul@moul.re>
Date: Mon, 28 Jan 2019 16:10:02 +0100
Subject: [PATCH] [mod] #184: source: remove check which prevents a bug

- remove variable getting
- change indentation.
---
 silkaj/money.py | 43 ++++++++++++++++---------------------------
 1 file changed, 16 insertions(+), 27 deletions(-)

diff --git a/silkaj/money.py b/silkaj/money.py
index 3ac6c488..74e48fde 100644
--- a/silkaj/money.py
+++ b/silkaj/money.py
@@ -149,38 +149,27 @@ async def get_sources(pubkey):
     history = history["history"]
     pendings = history["sending"] + history["receiving"] + history["pending"]
 
-    head_block = await HeadBlock().head_block
-    last_block_number = head_block["number"]
-
     # add pending output
     for i, pending in enumerate(pendings):
-        blockstamp = pending["blockstamp"]
-        block_number = int(blockstamp.split("-")[0])
-        # if it's not an old transaction (bug in mirror node)
-        if block_number >= last_block_number - 3:
-            identifier = pending["hash"]
-            for output in pending["outputs"]:
-                outputsplited = output.split(":")
-                if outputsplited[2] == "SIG(" + pubkey + ")":
-                    inputgenerated = InputSource(
-                        amount=int(outputsplited[0]),
-                        base=int(outputsplited[1]),
-                        source="T",
-                        origin_id=identifier,
-                        index=i,
-                    )
-                    if inputgenerated not in listinput:
-                        listinput.append(inputgenerated)
+        identifier = pending["hash"]
+        for output in pending["outputs"]:
+            outputsplited = output.split(":")
+            if outputsplited[2] == "SIG(" + pubkey + ")":
+                inputgenerated = InputSource(
+                    amount=int(outputsplited[0]),
+                    base=int(outputsplited[1]),
+                    source="T",
+                    origin_id=identifier,
+                    index=i,
+                )
+                if inputgenerated not in listinput:
+                    listinput.append(inputgenerated)
 
     # remove input already used
     for pending in pendings:
-        blockstamp = pending["blockstamp"]
-        block_number = int(blockstamp.split("-")[0])
-        # if it's not an old transaction (bug in mirror node)
-        if block_number >= last_block_number - 3:
-            for input in pending["inputs"]:
-                if input in listinput:
-                    listinput.remove(input)
+        for input in pending["inputs"]:
+            if input in listinput:
+                listinput.remove(input)
 
     return listinput, amount
 
-- 
GitLab