diff --git a/monero/backends/jsonrpc.py b/monero/backends/jsonrpc.py index 82ec4fb..529f13e 100644 --- a/monero/backends/jsonrpc.py +++ b/monero/backends/jsonrpc.py @@ -310,6 +310,12 @@ class JSONRPCWallet(object): except exceptions.TransactionNotFound: continue pmts.extend(_pmts['transfers']) + # Issue #71: incoming payments to self will have excess 'destinations' key. Remove. + for pmt in pmts: + try: + del pmt['destinations'] + except KeyError: + pass else: # NOTE: the API uses (min, max] range which is confusing params['min_block_height'] = (pmtfilter.min_height or 1) - 1 diff --git a/tests/test_jsonrpcwallet.py b/tests/test_jsonrpcwallet.py index 87039fa..5223bca 100644 --- a/tests/test_jsonrpcwallet.py +++ b/tests/test_jsonrpcwallet.py @@ -1229,3 +1229,15 @@ class JSONRPCWalletTestCase(JSONTestCase): self.assertEqual( self.wallet.import_key_images(kimgs), (125578, Decimal('322.437994530000'), Decimal('0'))) + + @responses.activate + def test_incoming_from_self__issue_71(self): + responses.add(responses.POST, self.jsonrpc_url, + json=self._read('test_incoming_from_self__issue_71-00-get_accounts.json'), + status=200) + responses.add(responses.POST, self.jsonrpc_url, + json=self._read('test_incoming_from_self__issue_71-1a75f-get_transfer_by_txid.json'), + status=200) + self.wallet = Wallet(JSONRPCWallet()) + pmts = self.wallet.incoming(tx_id='1a75f3aa57f7912313e90ab1188b7a102dbb619a324c3db51bb856a2f40503f1') + self.assertEqual(len(pmts), 1)