Create a compressed onion, decompress it at the RV node and then forward normally.
(directory, oniontool)
| 52 | |
| 53 | |
| 54 | def test_rendezvous_onion(directory, oniontool): |
| 55 | """Create a compressed onion, decompress it at the RV node and then forward normally. |
| 56 | """ |
| 57 | tempfile = os.path.join(directory, 'onion') |
| 58 | out = subprocess.check_output( |
| 59 | [oniontool, '--rendezvous-id', pubkeys[0], 'generate'] + pubkeys |
| 60 | ).decode('ASCII').strip().split('\n') |
| 61 | assert(len(out) == 2) |
| 62 | compressed = out[0].split(' ')[-1] |
| 63 | uncompressed = out[1] |
| 64 | |
| 65 | assert(len(compressed) < len(uncompressed)) |
| 66 | |
| 67 | # Now decompress the onion to get back the original onion |
| 68 | out2 = subprocess.check_output( |
| 69 | [oniontool, 'decompress', privkeys[0], compressed] |
| 70 | ).decode('ASCII').strip().split('\n') |
| 71 | decompressed = out2[-1].split(' ')[-1] |
| 72 | |
| 73 | assert(uncompressed == decompressed) |
| 74 | |
| 75 | # And now just for safety make sure the following nodes can still process |
| 76 | # and forward the onion. |
| 77 | def store_onion(o): |
| 78 | with open(tempfile, 'w') as f: |
| 79 | f.write(o) |
| 80 | |
| 81 | store_onion(decompressed) |
| 82 | |
| 83 | for i, pk in enumerate(privkeys): |
| 84 | out = subprocess.check_output([oniontool, 'decode', tempfile, pk]).decode('ASCII').strip().split('\n') |
| 85 | store_onion(out[-1][5:]) |
| 86 | |
| 87 | # Final payload: |
| 88 | # amt_to_forward=4,outgoing_cltv_value=4 |
| 89 | assert(out == ['payload=06020104040104']) |
nothing calls this directly
no test coverage detected