diff --git a/cln-grpc/proto/node.proto b/cln-grpc/proto/node.proto index 7c9def50f..d8f5950a8 100644 --- a/cln-grpc/proto/node.proto +++ b/cln-grpc/proto/node.proto @@ -758,47 +758,15 @@ message ListtransactionsTransactions { } message ListtransactionsTransactionsInputs { - // ListTransactions.transactions[].inputs[].type - enum ListtransactionsTransactionsInputsType { - THEIRS = 0; - DEPOSIT = 1; - WITHDRAW = 2; - CHANNEL_FUNDING = 3; - CHANNEL_MUTUAL_CLOSE = 4; - CHANNEL_UNILATERAL_CLOSE = 5; - CHANNEL_SWEEP = 6; - CHANNEL_HTLC_SUCCESS = 7; - CHANNEL_HTLC_TIMEOUT = 8; - CHANNEL_PENALTY = 9; - CHANNEL_UNILATERAL_CHEAT = 10; - } bytes txid = 1; uint32 index = 2; uint32 sequence = 3; - optional ListtransactionsTransactionsInputsType item_type = 4; - optional string channel = 5; } message ListtransactionsTransactionsOutputs { - // ListTransactions.transactions[].outputs[].type - enum ListtransactionsTransactionsOutputsType { - THEIRS = 0; - DEPOSIT = 1; - WITHDRAW = 2; - CHANNEL_FUNDING = 3; - CHANNEL_MUTUAL_CLOSE = 4; - CHANNEL_UNILATERAL_CLOSE = 5; - CHANNEL_SWEEP = 6; - CHANNEL_HTLC_SUCCESS = 7; - CHANNEL_HTLC_TIMEOUT = 8; - CHANNEL_PENALTY = 9; - CHANNEL_UNILATERAL_CHEAT = 10; - } uint32 index = 1; Amount amount_msat = 6; bytes scriptPubKey = 3; - optional ListtransactionsTransactionsOutputsType item_type = 4; - optional string channel = 5; } message PayRequest { diff --git a/cln-grpc/src/convert.rs b/cln-grpc/src/convert.rs index dbd1b54bf..b94b4f049 100644 --- a/cln-grpc/src/convert.rs +++ b/cln-grpc/src/convert.rs @@ -627,8 +627,6 @@ impl From for pb::Listtransaction txid: hex::decode(&c.txid).unwrap(), // Rule #2 for type txid index: c.index, // Rule #2 for type u32 sequence: c.sequence, // Rule #2 for type u32 - item_type: c.item_type.map(|v| v as i32), - channel: c.channel.map(|v| v.to_string()), // Rule #2 for type short_channel_id? } } } @@ -640,8 +638,6 @@ impl From for pb::Listtransactio index: c.index, // Rule #2 for type u32 amount_msat: Some(c.amount_msat.into()), // Rule #2 for type msat script_pub_key: hex::decode(&c.script_pub_key).unwrap(), // Rule #2 for type hex - item_type: c.item_type.map(|v| v as i32), - channel: c.channel.map(|v| v.to_string()), // Rule #2 for type short_channel_id? } } } diff --git a/cln-rpc/src/model.rs b/cln-rpc/src/model.rs index 2e4a466ce..c9000844f 100644 --- a/cln-rpc/src/model.rs +++ b/cln-rpc/src/model.rs @@ -2601,119 +2601,19 @@ pub mod responses { } } - /// the purpose of this input (*EXPERIMENTAL_FEATURES* only) - #[derive(Copy, Clone, Debug, Deserialize, Serialize)] - pub enum ListtransactionsTransactionsInputsType { - #[serde(rename = "theirs")] - THEIRS, - #[serde(rename = "deposit")] - DEPOSIT, - #[serde(rename = "withdraw")] - WITHDRAW, - #[serde(rename = "channel_funding")] - CHANNEL_FUNDING, - #[serde(rename = "channel_mutual_close")] - CHANNEL_MUTUAL_CLOSE, - #[serde(rename = "channel_unilateral_close")] - CHANNEL_UNILATERAL_CLOSE, - #[serde(rename = "channel_sweep")] - CHANNEL_SWEEP, - #[serde(rename = "channel_htlc_success")] - CHANNEL_HTLC_SUCCESS, - #[serde(rename = "channel_htlc_timeout")] - CHANNEL_HTLC_TIMEOUT, - #[serde(rename = "channel_penalty")] - CHANNEL_PENALTY, - #[serde(rename = "channel_unilateral_cheat")] - CHANNEL_UNILATERAL_CHEAT, - } - - impl TryFrom for ListtransactionsTransactionsInputsType { - type Error = anyhow::Error; - fn try_from(c: i32) -> Result { - match c { - 0 => Ok(ListtransactionsTransactionsInputsType::THEIRS), - 1 => Ok(ListtransactionsTransactionsInputsType::DEPOSIT), - 2 => Ok(ListtransactionsTransactionsInputsType::WITHDRAW), - 3 => Ok(ListtransactionsTransactionsInputsType::CHANNEL_FUNDING), - 4 => Ok(ListtransactionsTransactionsInputsType::CHANNEL_MUTUAL_CLOSE), - 5 => Ok(ListtransactionsTransactionsInputsType::CHANNEL_UNILATERAL_CLOSE), - 6 => Ok(ListtransactionsTransactionsInputsType::CHANNEL_SWEEP), - 7 => Ok(ListtransactionsTransactionsInputsType::CHANNEL_HTLC_SUCCESS), - 8 => Ok(ListtransactionsTransactionsInputsType::CHANNEL_HTLC_TIMEOUT), - 9 => Ok(ListtransactionsTransactionsInputsType::CHANNEL_PENALTY), - 10 => Ok(ListtransactionsTransactionsInputsType::CHANNEL_UNILATERAL_CHEAT), - o => Err(anyhow::anyhow!("Unknown variant {} for enum ListtransactionsTransactionsInputsType", o)), - } - } - } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct ListtransactionsTransactionsInputs { pub txid: String, pub index: u32, pub sequence: u32, - #[serde(skip_serializing_if = "Option::is_none")] - pub item_type: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub channel: Option, } - /// the purpose of this output (*EXPERIMENTAL_FEATURES* only) - #[derive(Copy, Clone, Debug, Deserialize, Serialize)] - pub enum ListtransactionsTransactionsOutputsType { - #[serde(rename = "theirs")] - THEIRS, - #[serde(rename = "deposit")] - DEPOSIT, - #[serde(rename = "withdraw")] - WITHDRAW, - #[serde(rename = "channel_funding")] - CHANNEL_FUNDING, - #[serde(rename = "channel_mutual_close")] - CHANNEL_MUTUAL_CLOSE, - #[serde(rename = "channel_unilateral_close")] - CHANNEL_UNILATERAL_CLOSE, - #[serde(rename = "channel_sweep")] - CHANNEL_SWEEP, - #[serde(rename = "channel_htlc_success")] - CHANNEL_HTLC_SUCCESS, - #[serde(rename = "channel_htlc_timeout")] - CHANNEL_HTLC_TIMEOUT, - #[serde(rename = "channel_penalty")] - CHANNEL_PENALTY, - #[serde(rename = "channel_unilateral_cheat")] - CHANNEL_UNILATERAL_CHEAT, - } - - impl TryFrom for ListtransactionsTransactionsOutputsType { - type Error = anyhow::Error; - fn try_from(c: i32) -> Result { - match c { - 0 => Ok(ListtransactionsTransactionsOutputsType::THEIRS), - 1 => Ok(ListtransactionsTransactionsOutputsType::DEPOSIT), - 2 => Ok(ListtransactionsTransactionsOutputsType::WITHDRAW), - 3 => Ok(ListtransactionsTransactionsOutputsType::CHANNEL_FUNDING), - 4 => Ok(ListtransactionsTransactionsOutputsType::CHANNEL_MUTUAL_CLOSE), - 5 => Ok(ListtransactionsTransactionsOutputsType::CHANNEL_UNILATERAL_CLOSE), - 6 => Ok(ListtransactionsTransactionsOutputsType::CHANNEL_SWEEP), - 7 => Ok(ListtransactionsTransactionsOutputsType::CHANNEL_HTLC_SUCCESS), - 8 => Ok(ListtransactionsTransactionsOutputsType::CHANNEL_HTLC_TIMEOUT), - 9 => Ok(ListtransactionsTransactionsOutputsType::CHANNEL_PENALTY), - 10 => Ok(ListtransactionsTransactionsOutputsType::CHANNEL_UNILATERAL_CHEAT), - o => Err(anyhow::anyhow!("Unknown variant {} for enum ListtransactionsTransactionsOutputsType", o)), - } - } - } #[derive(Clone, Debug, Deserialize, Serialize)] pub struct ListtransactionsTransactionsOutputs { pub index: u32, pub amount_msat: Amount, #[serde(rename = "scriptPubKey")] pub script_pub_key: String, - #[serde(skip_serializing_if = "Option::is_none")] - pub item_type: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub channel: Option, } #[derive(Clone, Debug, Deserialize, Serialize)] diff --git a/contrib/pyln-testing/pyln/testing/grpc2py.py b/contrib/pyln-testing/pyln/testing/grpc2py.py index 1193bd9e0..9f470b63d 100644 --- a/contrib/pyln-testing/pyln/testing/grpc2py.py +++ b/contrib/pyln-testing/pyln/testing/grpc2py.py @@ -489,8 +489,6 @@ def listtransactions_transactions_inputs2py(m): "txid": hexlify(m.txid), # PrimitiveField in generate_composite "index": m.index, # PrimitiveField in generate_composite "sequence": m.sequence, # PrimitiveField in generate_composite - "type": str(m.item_type), # EnumField in generate_composite - "channel": m.channel, # PrimitiveField in generate_composite }) @@ -499,8 +497,6 @@ def listtransactions_transactions_outputs2py(m): "index": m.index, # PrimitiveField in generate_composite "amount_msat": amount2msat(m.amount_msat), # PrimitiveField in generate_composite "script_pub_key": hexlify(m.script_pub_key), # PrimitiveField in generate_composite - "type": str(m.item_type), # EnumField in generate_composite - "channel": m.channel, # PrimitiveField in generate_composite }) diff --git a/doc/Makefile b/doc/Makefile index 5bd7dae50..34b26a8b1 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -237,7 +237,7 @@ schema-added-check: fi schema-removed-check: @if ! test -z $$CI; then git fetch origin master; fi; \ - if git diff origin/master -- doc/schemas | grep -q '^-.*{' && ! git diff origin/master -- doc/schemas | grep -q '^-.*"deprecated"'; then \ + if git diff origin/master -- doc/schemas | grep -q '^-.*{' && ! git diff origin/master -- doc/schemas | grep -q '^-.*"deprecated"' && ! git diff origin/master -- doc/schemas | grep -q '^-.*EXPERIMENTAL_FEATURES'; then \ git diff origin/master -- doc/schemas ; \ echo 'Schema fields must be "deprecated", with version, not removed' >&2; exit 1; \ fi diff --git a/doc/lightning-listtransactions.7.md b/doc/lightning-listtransactions.7.md index 05fce8ea5..cbd7afb53 100644 --- a/doc/lightning-listtransactions.7.md +++ b/doc/lightning-listtransactions.7.md @@ -37,14 +37,10 @@ On success, an object containing **transactions** is returned. It is an array o - **txid** (txid): the transaction id spent - **index** (u32): the output spent - **sequence** (u32): the nSequence value - - **type** (string, optional): the purpose of this input (*EXPERIMENTAL\_FEATURES* only) (one of "theirs", "deposit", "withdraw", "channel\_funding", "channel\_mutual\_close", "channel\_unilateral\_close", "channel\_sweep", "channel\_htlc\_success", "channel\_htlc\_timeout", "channel\_penalty", "channel\_unilateral\_cheat") - - **channel** (short\_channel\_id, optional): the channel this input is associated with (*EXPERIMENTAL\_FEATURES* only) - **outputs** (array of objects): Each output, in order: - **index** (u32): the 0-based output number - **amount\_msat** (msat): the amount of the output - **scriptPubKey** (hex): the scriptPubKey - - **type** (string, optional): the purpose of this output (*EXPERIMENTAL\_FEATURES* only) (one of "theirs", "deposit", "withdraw", "channel\_funding", "channel\_mutual\_close", "channel\_unilateral\_close", "channel\_sweep", "channel\_htlc\_success", "channel\_htlc\_timeout", "channel\_penalty", "channel\_unilateral\_cheat") - - **channel** (short\_channel\_id, optional): the channel this output is associated with (*EXPERIMENTAL\_FEATURES* only) [comment]: # (GENERATE-FROM-SCHEMA-END) @@ -103,4 +99,4 @@ RESOURCES Main web site: -[comment]: # ( SHA256STAMP:525f24511eb9687dc16d5b2156d4d8df28b371e287512a749d2d9dfd5701e093) +[comment]: # ( SHA256STAMP:6431aec91a48a5f9d4632baa6f3aae23dee8607a200b3c359d679028e521b588) diff --git a/doc/lightning-sql.7.md b/doc/lightning-sql.7.md index 632ac8b53..2741ea111 100644 --- a/doc/lightning-sql.7.md +++ b/doc/lightning-sql.7.md @@ -379,16 +379,12 @@ The following tables are currently supported: - `txid` (type `txid`, sqltype `BLOB`) - `idx` (type `u32`, sqltype `INTEGER`, from JSON field `index`) - `sequence` (type `u32`, sqltype `INTEGER`) - - `type` (type `string`, sqltype `TEXT`) - - `channel` (type `short_channel_id`, sqltype `TEXT`) - related table `transactions_outputs` - `row` (reference to `transactions.rowid`, sqltype `INTEGER`) - `arrindex` (index within array, sqltype `INTEGER`) - `idx` (type `u32`, sqltype `INTEGER`, from JSON field `index`) - `amount_msat` (type `msat`, sqltype `INTEGER`) - `scriptPubKey` (type `hex`, sqltype `BLOB`) - - `type` (type `string`, sqltype `TEXT`) - - `channel` (type `short_channel_id`, sqltype `TEXT`) [comment]: # (GENERATE-DOC-END) @@ -514,4 +510,4 @@ RESOURCES --------- Main web site: -[comment]: # ( SHA256STAMP:3eb4e024a1e1a4b40460b48b835354514456558797b8f8ce3c76dcbb9ca79dab) +[comment]: # ( SHA256STAMP:68c72c66bdc8b0515c6d5dddd5ffd14aa0342bd00f17a44929177c48c36a213f) diff --git a/doc/schemas/listtransactions.schema.json b/doc/schemas/listtransactions.schema.json index 0edcb7ba1..067e139e1 100644 --- a/doc/schemas/listtransactions.schema.json +++ b/doc/schemas/listtransactions.schema.json @@ -69,27 +69,6 @@ "sequence": { "type": "u32", "description": "the nSequence value" - }, - "type": { - "type": "string", - "enum": [ - "theirs", - "deposit", - "withdraw", - "channel_funding", - "channel_mutual_close", - "channel_unilateral_close", - "channel_sweep", - "channel_htlc_success", - "channel_htlc_timeout", - "channel_penalty", - "channel_unilateral_cheat" - ], - "description": "the purpose of this input (*EXPERIMENTAL_FEATURES* only)" - }, - "channel": { - "type": "short_channel_id", - "description": "the channel this input is associated with (*EXPERIMENTAL_FEATURES* only)" } } } @@ -117,27 +96,6 @@ "scriptPubKey": { "type": "hex", "description": "the scriptPubKey" - }, - "type": { - "type": "string", - "enum": [ - "theirs", - "deposit", - "withdraw", - "channel_funding", - "channel_mutual_close", - "channel_unilateral_close", - "channel_sweep", - "channel_htlc_success", - "channel_htlc_timeout", - "channel_penalty", - "channel_unilateral_cheat" - ], - "description": "the purpose of this output (*EXPERIMENTAL_FEATURES* only)" - }, - "channel": { - "type": "short_channel_id", - "description": "the channel this output is associated with (*EXPERIMENTAL_FEATURES* only)" } } } diff --git a/tests/test_plugin.py b/tests/test_plugin.py index d53382b6d..3503d6a5b 100644 --- a/tests/test_plugin.py +++ b/tests/test_plugin.py @@ -3914,11 +3914,7 @@ def test_sql(node_factory, bitcoind): {'name': 'idx', 'type': 'u32'}, {'name': 'sequence', - 'type': 'u32'}, - {'name': 'type', - 'type': 'string'}, - {'name': 'channel', - 'type': 'short_channel_id'}]}, + 'type': 'u32'}]}, 'transactions_outputs': { 'columns': [{'name': 'row', 'type': 'u64'}, @@ -3929,11 +3925,7 @@ def test_sql(node_factory, bitcoind): {'name': 'amount_msat', 'type': 'msat'}, {'name': 'scriptPubKey', - 'type': 'hex'}, - {'name': 'type', - 'type': 'string'}, - {'name': 'channel', - 'type': 'short_channel_id'}]}, + 'type': 'hex'}]}, 'bkpr_accountevents': { 'columns': [{'name': 'account', 'type': 'string'}, diff --git a/tests/test_wallet.py b/tests/test_wallet.py index de0e0ace9..d632a2936 100644 --- a/tests/test_wallet.py +++ b/tests/test_wallet.py @@ -5,7 +5,7 @@ from fixtures import TEST_NETWORK from pyln.client import RpcError, Millisatoshi from shutil import copyfile from utils import ( - only_one, wait_for, sync_blockheight, EXPERIMENTAL_FEATURES, + only_one, wait_for, sync_blockheight, VALGRIND, check_coin_moves, TailableProc, scriptpubkey_addr, check_utxos_channel ) @@ -1065,78 +1065,6 @@ def test_txsend(node_factory, bitcoind, chainparams): assert scriptpubkey_addr(decode['vout'][changenum]['scriptPubKey']) in [f['address'] for f in l1.rpc.listfunds()['outputs']] -@unittest.skipIf(TEST_NETWORK != 'regtest', "Fee outputs throw off our output matching logic") -@unittest.skipIf(not EXPERIMENTAL_FEATURES, "Tests annotations which are compiled only with experimental features") -def test_transaction_annotations(node_factory, bitcoind): - l1, l2, l3 = node_factory.get_nodes(3) - l1.fundwallet(10**6) - - # We should now have a transaction that gave us the funds in the - # transactions table... - outputs = l1.rpc.listfunds()['outputs'] - assert(len(outputs) == 1 and outputs[0]['status'] == 'confirmed') - out = outputs[0] - idx = out['output'] - assert(idx in [0, 1] and out['amount_msat'] == Millisatoshi("{}sat".format(10**6))) - - # ... and it should have an annotation on the output reading 'deposit' - txs = l1.rpc.listtransactions()['transactions'] - assert(len(txs) == 1) - tx = txs[0] - output = tx['outputs'][idx] - assert(output['type'] == 'deposit' and output['amount_msat'] == Millisatoshi(1000000000)) - - # ... and all other output should be change, and have no annotations - types = [] - for i, o in enumerate(tx['outputs']): - if i == idx: - continue - if 'type' in o: - types.append(o['type']) - else: - types.append(None) - - assert(set([None]) == set(types)) - - ########################################################################## - # Let's now open a channel. The opener should get the funding transaction - # annotated as channel open and deposit. - l1.connect(l2) - fundingtx = l1.rpc.fundchannel(l2.info['id'], 10**5) - - # We should have one output unreserved, and it should be unconfirmed - outputs = l1.rpc.listfunds()['outputs'] - assert len(outputs) == 2 - outputs = [o for o in outputs if not o['reserved']] - assert(len(outputs) == 1 and outputs[0]['status'] == 'unconfirmed') - - # It should also match the funding txid: - assert(outputs[0]['txid'] == fundingtx['txid']) - - # Confirm the channel and check that the output changed to confirmed - bitcoind.generate_block(3) - sync_blockheight(bitcoind, [l1, l2]) - outputs = l1.rpc.listfunds()['outputs'] - assert(len(outputs) == 1 and outputs[0]['status'] == 'confirmed') - - # We should have 2 transactions, the second one should be the funding tx - # (we are ordering by blockheight and txindex, so that order should be ok) - txs = l1.rpc.listtransactions()['transactions'] - assert(len(txs) == 2 and txs[1]['hash'] == fundingtx['txid']) - - # Check the annotated types - types = [o['type'] for o in txs[1]['outputs']] - changeidx = 0 if types[0] == 'deposit' else 1 - fundidx = 1 - changeidx - assert(types[changeidx] == 'deposit' and types[fundidx] == 'channel_funding') - - # And check the channel annotation on the funding output - channels = l1.rpc.listpeerchannels()['channels'] - assert(len(channels) == 1) - scid = channels[0]['short_channel_id'] - assert(txs[1]['outputs'][fundidx]['channel'] == scid) - - def write_all(fd, bytestr): """Wrapper, since os.write can do partial writes""" off = 0 diff --git a/wallet/walletrpc.c b/wallet/walletrpc.c index a04613bda..371e20978 100644 --- a/wallet/walletrpc.c +++ b/wallet/walletrpc.c @@ -484,16 +484,6 @@ struct { {TX_CHANNEL_CHEAT, "channel_unilateral_cheat"}, }; -#if EXPERIMENTAL_FEATURES -static const char *txtype_to_string(enum wallet_tx_type t) -{ - for (size_t i = 0; i < ARRAY_SIZE(wallet_tx_type_display_names); i++) - if (t == wallet_tx_type_display_names[i].t) - return wallet_tx_type_display_names[i].name; - return NULL; -} -#endif - static void json_transaction_details(struct json_stream *response, const struct wallet_transaction *tx) { @@ -517,15 +507,6 @@ static void json_transaction_details(struct json_stream *response, json_add_txid(response, "txid", &prevtxid); json_add_u32(response, "index", in->index); json_add_u32(response, "sequence", in->sequence); -#if EXPERIMENTAL_FEATURES - struct tx_annotation *ann = &tx->input_annotations[i]; - const char *txtype = txtype_to_string(ann->type); - if (txtype != NULL) - json_add_string(response, "type", txtype); - if (ann->channel.u64 != 0) - json_add_short_channel_id(response, "channel", &ann->channel); -#endif - json_object_end(response); } json_array_end(response); @@ -547,15 +528,6 @@ static void json_transaction_details(struct json_stream *response, json_add_u32(response, "index", i); json_add_amount_sat_msat(response, "amount_msat", sat); -#if EXPERIMENTAL_FEATURES - struct tx_annotation *ann = &tx->output_annotations[i]; - const char *txtype = txtype_to_string(ann->type); - if (txtype != NULL) - json_add_string(response, "type", txtype); - - if (ann->channel.u64 != 0) - json_add_short_channel_id(response, "channel", &ann->channel); -#endif json_add_hex(response, "scriptPubKey", out->script, out->script_len); json_object_end(response);