-
Notifications
You must be signed in to change notification settings - Fork 112
Proposal: implement custom TLV records for spontaneous payments #273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
fbb04e4
bd1459b
9708a42
f545a42
7638cec
02f0000
9f68aee
d79b8ae
1cf74c6
84ecc24
0396fc5
b052f15
cdeeb7f
059ff2d
3ae80be
71b1d3c
a624501
4564ec1
9be82cc
c49c3d7
ba28a8d
c566fd5
0bf24c8
e3dc93a
872579f
9c8be40
2d9fe95
77c538b
640a1fd
be43848
9f27fcb
4d7c9f3
e14b70e
b784f0b
38eb21e
5e502e6
a78ed43
7cd8a72
51e2580
1fab656
b7c4862
c418c7d
6dec002
daf20e3
d912a99
246775d
278a849
7c9216e
2d70e65
9a3f169
8a67d7e
962476a
1e522d0
5361d9f
d57f67f
82b85c1
9990e51
0285b55
1eab306
a2691e7
db1b373
1952802
5ba1b35
1887af8
0aaa8f1
436f2e4
2562f52
5418cc8
35e4968
de73ddc
a503eb5
9dba3ac
accd3c8
9c44041
3a328d4
ddc6430
dc5d00e
0e02969
bc1fac3
4201760
41a7955
07d020c
018a5b6
be6e8c2
d5709b7
74943cd
a678c5e
b180a65
80d24c3
e3279d7
fd4b33f
82ab9ac
f58f00f
746014c
02e4b3f
b0a1dfc
d67a3af
de69c75
0a0ccb1
5095d42
f839015
ca44721
2b8ca85
8680d07
bd9bd68
182bc21
66fec69
28d2d77
37db97d
caa08d7
047b167
f708737
1dda9c7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -456,3 +456,12 @@ impl Default for ChannelConfig { | |
LdkChannelConfig::default().into() | ||
} | ||
} | ||
|
||
/// Custom TLV entry. | ||
pub struct TlvEntry { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the protocol the TLV entry is defined with a length Whats the reason of not including it here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see that LDK is expecting type and value to set the tlv. I guess then the length is set by ldk when sending the message. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The length of the data buffer is used for that. I shall see if we can improve the representation, though |
||
/// Type number. | ||
pub r#type: u64, | ||
|
||
/// Serialized value. | ||
pub value: Vec<u8>, | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
|
||
use ldk_node::io::sqlite_store::SqliteStore; | ||
use ldk_node::{ | ||
Builder, Config, Event, LogLevel, Node, NodeError, PaymentDirection, PaymentStatus, | ||
Builder, Config, Event, LogLevel, Node, NodeError, PaymentDirection, PaymentStatus, TlvEntry, | ||
}; | ||
|
||
use lightning::ln::msgs::SocketAddress; | ||
|
@@ -490,8 +490,11 @@ pub(crate) fn do_channel_full_cycle<K: KVStore + Sync + Send, E: ElectrumApi>( | |
// Test spontaneous/keysend payments | ||
println!("\nA send_spontaneous_payment"); | ||
let keysend_amount_msat = 2500_000; | ||
let keysend_payment_hash = | ||
node_a.send_spontaneous_payment(keysend_amount_msat, node_b.node_id()).unwrap(); | ||
let tlv1 = TlvEntry { r#type: 131073, value: vec![0x00, 0x11, 0x22, 0x33] }; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. does this test validate that the counter-party node received the message? |
||
let tlv2 = TlvEntry { r#type: 131075, value: vec![0xaa, 0xbb] }; | ||
let keysend_payment_hash = node_a | ||
.send_spontaneous_payment(keysend_amount_msat, node_b.node_id(), vec![tlv1, tlv2]) | ||
.unwrap(); | ||
expect_event!(node_a, PaymentSuccessful); | ||
let received_keysend_amount = match node_b.wait_next_event() { | ||
ref e @ Event::PaymentReceived { amount_msat, .. } => { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are the
custom_tlvs
required in order to send a spontaneous payment?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really required but may be useful. But I see the point, we'll probably take tnull's suggestion to base this change off PR 270; probably once it's merged