From: Matt Corallo Date: Fri, 9 Oct 2020 01:25:25 +0000 (-0400) Subject: [bindings] Make Transaction::data *mut instead of *const X-Git-Tag: v0.0.12~4^2~9 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=78b4598ff6144d83fef941f86394c185dc30c82c;p=rust-lightning [bindings] Make Transaction::data *mut instead of *const When the only reference to the transaction bytes is via Transaction::data, my understanding of the C const rules is that it would then be invalid to write to it. While its unlikely this would ever pose an issue, its not hard to simply make it *mut, so we do that here. --- diff --git a/lightning-c-bindings/src/c_types/mod.rs b/lightning-c-bindings/src/c_types/mod.rs index d14fe6fc7..840bd7a44 100644 --- a/lightning-c-bindings/src/c_types/mod.rs +++ b/lightning-c-bindings/src/c_types/mod.rs @@ -100,7 +100,8 @@ impl Secp256k1Error { /// set. Similarly, while it may change in the future, all `Transaction`s you pass to Rust may have /// `data_is_owned` either set or unset at your discretion. pub struct Transaction { - pub data: *const u8, + /// This is non-const for your convenience, an object passed to Rust is never written to. + pub data: *mut u8, pub datalen: usize, pub data_is_owned: bool, }