description_hash says it accepts Hash(SHA-256) of a description but then fails with error UNKNOWN: description hash is 64 bytes, must be 32 #8230
Unanswered
DimoDonchev
asked this question in
Troubleshooting
Replies: 1 comment
-
A hash is 32 bytes (256bit divided by 8 equals 32byte). But what you have is a hex encoded string, which then has 64 characters. What you need to do is to parse the hex string into raw bytes and use that. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
As far as i know sha-256 result is 64 bytes, but i get the error that the description needs to be 32 bytes. Can someone explain what i should do?
here is my code.
`
// Generate the invoice request
LightningOuterClass.Invoice invoiceRequest = LightningOuterClass.Invoice.newBuilder()
.setValueMsat(100000) // Invoice value in milli-satoshis (1 satoshi = 1000 milli-satoshis)
.setDescriptionHash(ByteString.copyFrom("0004f0d7cf6c4a4d311e48ef6637026718a7d249a1073774a74d1c7c2fffce6b", Charset.defaultCharset()))
.build();
`
and i get this error
Error generating invoice: UNKNOWN: description hash is 64 bytes, must be 32
Beta Was this translation helpful? Give feedback.
All reactions