Generate a 5 hop onion and then decode it.
(directory, oniontool)
| 28 | |
| 29 | |
| 30 | def test_onion(directory, oniontool): |
| 31 | """ Generate a 5 hop onion and then decode it. |
| 32 | """ |
| 33 | tempfile = os.path.join(directory, 'onion') |
| 34 | out = subprocess.check_output( |
| 35 | [oniontool, 'generate'] + pubkeys |
| 36 | ).decode('ASCII').strip().split('\n') |
| 37 | assert(len(out) == 1) |
| 38 | |
| 39 | def store_onion(o): |
| 40 | with open(tempfile, 'w') as f: |
| 41 | f.write(o) |
| 42 | |
| 43 | store_onion(out[0]) |
| 44 | |
| 45 | for i, pk in enumerate(privkeys): |
| 46 | out = subprocess.check_output([oniontool, 'decode', tempfile, pk]).decode('ASCII').strip().split('\n') |
| 47 | store_onion(out[-1][5:]) |
| 48 | |
| 49 | # Final payload: |
| 50 | # amt_to_forward=4,outgoing_cltv_value=4 |
| 51 | assert(out == ['payload=06020104040104']) |
| 52 | |
| 53 | |
| 54 | def test_rendezvous_onion(directory, oniontool): |
nothing calls this directly
no test coverage detected