URI: 
       thandled conflicted transactions, and wrote tests - electrum-personal-server - Maximally lightweight electrum server for a single user
  HTML git clone https://git.parazyd.org/electrum-personal-server
   DIR Log
   DIR Files
   DIR Refs
   DIR README
       ---
   DIR commit 584002a1643e3366ff8ea36258f54746e3906b95
   DIR parent f33934059b084bc80ad1f2e39a0997114104a604
  HTML Author: chris-belcher <chris-belcher@users.noreply.github.com>
       Date:   Fri, 30 Mar 2018 22:53:49 +0100
       
       handled conflicted transactions, and wrote tests
       
       Diffstat:
         M electrumpersonalserver/transaction… |      27 +++++++++++++++++++++++++++
       
       1 file changed, 27 insertions(+), 0 deletions(-)
       ---
   DIR diff --git a/electrumpersonalserver/transactionmonitor.py b/electrumpersonalserver/transactionmonitor.py
       t@@ -106,6 +106,8 @@ class TransactionMonitor(object):
                            continue
                        if tx["category"] not in ("receive", "send"):
                            continue
       +                if tx["confirmations"] == -1:
       +                    continue #conflicted
                        if tx["txid"] in obtained_txids:
                            continue
                        self.debug("adding obtained tx=" + str(tx["txid"]))
       t@@ -319,6 +321,8 @@ class TransactionMonitor(object):
                        continue
                    if tx["category"] not in ("receive", "send"):
                        continue
       +            if tx["confirmations"] == -1:
       +                continue #conflicted
                    if tx["txid"] in obtained_txids:
                        continue
                    obtained_txids.add(tx["txid"])
       t@@ -712,6 +716,29 @@ def test():
            assert rpc.get_imported_addresses()[0] == test_spk_to_address(
                test_spk9_imported)
        
       +    ###conflicted transaction
       +    test_spk10 = "deadbeefdeadbeefcccc"
       +    test_paying_in_tx10 = {
       +        "txid": "placeholder-test-txid10",
       +        "vin": [{"txid": "placeholder-unknown-input-txid", "vout": 0}],
       +        "vout": [{"value": 1, "scriptPubKey": {"hex": test_spk10}}],
       +        "address": test_spk_to_address(test_spk10),
       +        "category": "receive",
       +        "confirmations": -1,
       +        "hex": "placeholder-test-txhex10"
       +    }
       +    rpc = TestJsonRpc([test_paying_in_tx10], [], {})
       +    txmonitor10 = TransactionMonitor(rpc, deterministic_wallets, debugf, logf)
       +    assert txmonitor10.build_address_history([test_spk10])
       +    assert len(txmonitor10.address_history) == 1
       +    assert len(txmonitor10.get_electrum_history(hashes.script_to_scripthash(
       +        test_spk10))) == 0 #shouldnt show up after build history
       +    rpc.add_transaction(test_paying_in_tx10)
       +    assert len(list(txmonitor10.check_for_updated_txes())) == 0
       +    assert len(txmonitor10.get_electrum_history(hashes.script_to_scripthash(
       +        test_spk10))) == 0 #shouldnt show up after tx is added
       +
       +
            #other possible stuff to test:
            #finding confirmed and unconfirmed tx, in that order, then both confirm
            #finding unconfirmed and confirmed tx, in that order, then both confirm