def check(self, txid=None, amount=None, confirmation_height=None):
    'Verify that listtransactions/listreceivedbyaddress return expected values.'
    txs = self.node.listtransactions(label=self.label, count=10000, include_watchonly=True)
    current_height = self.node.getblockcount()
    assert_equal(len(txs), self.expected_txs)
    addresses = self.node.listreceivedbyaddress(minconf=0, include_watchonly=True, address_filter=self.address['address'])
    if self.expected_txs:
        assert_equal(len(addresses[0]['txids']), self.expected_txs)
    if (txid is not None):
        (tx,) = [tx for tx in txs if (tx['txid'] == txid)]
        assert_equal(tx['label'], self.label)
        assert_equal(tx['address'], self.address['address'])
        assert_equal(tx['amount'], amount)
        assert_equal(tx['category'], 'receive')
        assert_equal(tx['label'], self.label)
        assert_equal(tx['txid'], txid)
        assert_equal(tx['confirmations'], ((1 + current_height) - confirmation_height))
        assert_equal(('trusted' not in tx), True)
        (address,) = [ad for ad in addresses if (txid in ad['txids'])]
        assert_equal(address['address'], self.address['address'])
        assert_equal(address['amount'], self.expected_balance)
        assert_equal(address['confirmations'], ((1 + current_height) - confirmation_height))
        if (self.data != Data.priv):
            assert_equal(address['involvesWatchonly'], True)
        else:
            assert_equal(('involvesWatchonly' not in address), True)
Verify that listtransactions/listreceivedbyaddress return expected values.
def check(self, txid=None, amount=None, confirmation_height=None):
    
    txs = self.node.listtransactions(label=self.label, count=10000, include_watchonly=True)
    current_height = self.node.getblockcount()
    assert_equal(len(txs), self.expected_txs)
    addresses = self.node.listreceivedbyaddress(minconf=0, include_watchonly=True, address_filter=self.address['address'])
    if self.expected_txs:
        assert_equal(len(addresses[0]['txids']), self.expected_txs)
    if (txid is not None):
        (tx,) = [tx for tx in txs if (tx['txid'] == txid)]
        assert_equal(tx['label'], self.label)
        assert_equal(tx['address'], self.address['address'])
        assert_equal(tx['amount'], amount)
        assert_equal(tx['category'], 'receive')
        assert_equal(tx['label'], self.label)
        assert_equal(tx['txid'], txid)
        assert_equal(tx['confirmations'], ((1 + current_height) - confirmation_height))
        assert_equal(('trusted' not in tx), True)
        (address,) = [ad for ad in addresses if (txid in ad['txids'])]
        assert_equal(address['address'], self.address['address'])
        assert_equal(address['amount'], self.expected_balance)
        assert_equal(address['confirmations'], ((1 + current_height) - confirmation_height))
        if (self.data != Data.priv):
            assert_equal(address['involvesWatchonly'], True)
        else:
            assert_equal(('involvesWatchonly' not in address), True)