Merge pull request #146 from TheBlueMatt/main
[ldk-java] / src / main / java / org / ldk / structs / ChannelUpdate.java
index 2063afc497963477401924d46039063a87f46e71..e4b5200543414269352e397cadadc5fad31aacb1 100644 (file)
@@ -9,7 +9,9 @@ import javax.annotation.Nullable;
 
 
 /**
- * A channel_update message to be sent or received from a peer
+ * A [`channel_update`] message to be sent to or received from a peer.
+ * 
+ * [`channel_update`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-channel_update-message
  */
 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
 public class ChannelUpdate extends CommonBase {
@@ -92,6 +94,18 @@ public class ChannelUpdate extends CommonBase {
                return ret_hu_conv;
        }
 
+       /**
+        * Generates a non-cryptographic 64-bit hash of the ChannelUpdate.
+        */
+       public long hash() {
+               long ret = bindings.ChannelUpdate_hash(this.ptr);
+               Reference.reachabilityFence(this);
+               return ret;
+       }
+
+       @Override public int hashCode() {
+               return (int)this.hash();
+       }
        /**
         * Checks if two ChannelUpdates contain equal inner contents.
         * This ignores pointers and is_owned flags and looks at the values in fields.