~ubuntu-branches/debian/stretch/bitcoin/stretch

« back to all changes in this revision

Viewing changes to contrib/zmq/zmq_sub.py

  • Committer: Package Import Robot
  • Author(s): Anthony Towns
  • Date: 2016-10-21 17:13:13 UTC
  • mfrom: (1.3.2)
  • Revision ID: package-import@ubuntu.com-20161021171313-7eu2ltpbk0xag3q1
Tags: 0.13.0-0.1
* Non-maintainer upload.
* New upstream release.
* Allow compilation with gcc/g++ 6. (Closes: Bug#835963)
* Additional fixes for openssl 1.1 compatibility. (See Bug#828248)
* Check if -latomic is needed (it is on mips*).
* Remove reproducible build patch, since leveldb build system is
  no longer used in 0.13. (See Bug#791834)
* Update description since the blockchain is much more than "several GB"
  now. (Closes: Bug#835809)

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
import array
4
4
import binascii
5
5
import zmq
 
6
import struct
6
7
 
7
8
port = 28332
8
9
 
19
20
        msg = zmqSubSocket.recv_multipart()
20
21
        topic = str(msg[0])
21
22
        body = msg[1]
22
 
 
 
23
        sequence = "Unknown";
 
24
        if len(msg[-1]) == 4:
 
25
          msgSequence = struct.unpack('<I', msg[-1])[-1]
 
26
          sequence = str(msgSequence)
23
27
        if topic == "hashblock":
24
 
            print "- HASH BLOCK -"
 
28
            print '- HASH BLOCK ('+sequence+') -'
25
29
            print binascii.hexlify(body)
26
30
        elif topic == "hashtx":
27
 
            print '- HASH TX -'
 
31
            print '- HASH TX  ('+sequence+') -'
28
32
            print binascii.hexlify(body)
29
33
        elif topic == "rawblock":
30
 
            print "- RAW BLOCK HEADER -"
 
34
            print '- RAW BLOCK HEADER ('+sequence+') -'
31
35
            print binascii.hexlify(body[:80])
32
36
        elif topic == "rawtx":
33
 
            print '- RAW TX -'
 
37
            print '- RAW TX ('+sequence+') -'
34
38
            print binascii.hexlify(body)
35
39
 
36
40
except KeyboardInterrupt: