|
5 | 5 | from pyln.client import RpcError, Millisatoshi |
6 | 6 | from shutil import copyfile |
7 | 7 | from utils import ( |
8 | | - only_one, wait_for, sync_blockheight, EXPERIMENTAL_FEATURES, |
| 8 | + only_one, wait_for, sync_blockheight, |
9 | 9 | VALGRIND, check_coin_moves, TailableProc, scriptpubkey_addr, |
10 | 10 | check_utxos_channel |
11 | 11 | ) |
@@ -1065,78 +1065,6 @@ def test_txsend(node_factory, bitcoind, chainparams): |
1065 | 1065 | assert scriptpubkey_addr(decode['vout'][changenum]['scriptPubKey']) in [f['address'] for f in l1.rpc.listfunds()['outputs']] |
1066 | 1066 |
|
1067 | 1067 |
|
1068 | | -@unittest.skipIf(TEST_NETWORK != 'regtest', "Fee outputs throw off our output matching logic") |
1069 | | -@unittest.skipIf(not EXPERIMENTAL_FEATURES, "Tests annotations which are compiled only with experimental features") |
1070 | | -def test_transaction_annotations(node_factory, bitcoind): |
1071 | | - l1, l2, l3 = node_factory.get_nodes(3) |
1072 | | - l1.fundwallet(10**6) |
1073 | | - |
1074 | | - # We should now have a transaction that gave us the funds in the |
1075 | | - # transactions table... |
1076 | | - outputs = l1.rpc.listfunds()['outputs'] |
1077 | | - assert(len(outputs) == 1 and outputs[0]['status'] == 'confirmed') |
1078 | | - out = outputs[0] |
1079 | | - idx = out['output'] |
1080 | | - assert(idx in [0, 1] and out['amount_msat'] == Millisatoshi("{}sat".format(10**6))) |
1081 | | - |
1082 | | - # ... and it should have an annotation on the output reading 'deposit' |
1083 | | - txs = l1.rpc.listtransactions()['transactions'] |
1084 | | - assert(len(txs) == 1) |
1085 | | - tx = txs[0] |
1086 | | - output = tx['outputs'][idx] |
1087 | | - assert(output['type'] == 'deposit' and output['amount_msat'] == Millisatoshi(1000000000)) |
1088 | | - |
1089 | | - # ... and all other output should be change, and have no annotations |
1090 | | - types = [] |
1091 | | - for i, o in enumerate(tx['outputs']): |
1092 | | - if i == idx: |
1093 | | - continue |
1094 | | - if 'type' in o: |
1095 | | - types.append(o['type']) |
1096 | | - else: |
1097 | | - types.append(None) |
1098 | | - |
1099 | | - assert(set([None]) == set(types)) |
1100 | | - |
1101 | | - ########################################################################## |
1102 | | - # Let's now open a channel. The opener should get the funding transaction |
1103 | | - # annotated as channel open and deposit. |
1104 | | - l1.connect(l2) |
1105 | | - fundingtx = l1.rpc.fundchannel(l2.info['id'], 10**5) |
1106 | | - |
1107 | | - # We should have one output unreserved, and it should be unconfirmed |
1108 | | - outputs = l1.rpc.listfunds()['outputs'] |
1109 | | - assert len(outputs) == 2 |
1110 | | - outputs = [o for o in outputs if not o['reserved']] |
1111 | | - assert(len(outputs) == 1 and outputs[0]['status'] == 'unconfirmed') |
1112 | | - |
1113 | | - # It should also match the funding txid: |
1114 | | - assert(outputs[0]['txid'] == fundingtx['txid']) |
1115 | | - |
1116 | | - # Confirm the channel and check that the output changed to confirmed |
1117 | | - bitcoind.generate_block(3) |
1118 | | - sync_blockheight(bitcoind, [l1, l2]) |
1119 | | - outputs = l1.rpc.listfunds()['outputs'] |
1120 | | - assert(len(outputs) == 1 and outputs[0]['status'] == 'confirmed') |
1121 | | - |
1122 | | - # We should have 2 transactions, the second one should be the funding tx |
1123 | | - # (we are ordering by blockheight and txindex, so that order should be ok) |
1124 | | - txs = l1.rpc.listtransactions()['transactions'] |
1125 | | - assert(len(txs) == 2 and txs[1]['hash'] == fundingtx['txid']) |
1126 | | - |
1127 | | - # Check the annotated types |
1128 | | - types = [o['type'] for o in txs[1]['outputs']] |
1129 | | - changeidx = 0 if types[0] == 'deposit' else 1 |
1130 | | - fundidx = 1 - changeidx |
1131 | | - assert(types[changeidx] == 'deposit' and types[fundidx] == 'channel_funding') |
1132 | | - |
1133 | | - # And check the channel annotation on the funding output |
1134 | | - channels = l1.rpc.listpeerchannels()['channels'] |
1135 | | - assert(len(channels) == 1) |
1136 | | - scid = channels[0]['short_channel_id'] |
1137 | | - assert(txs[1]['outputs'][fundidx]['channel'] == scid) |
1138 | | - |
1139 | | - |
1140 | 1068 | def write_all(fd, bytestr): |
1141 | 1069 | """Wrapper, since os.write can do partial writes""" |
1142 | 1070 | off = 0 |
|
0 commit comments