@@ -410,7 +410,7 @@ object Sphinx extends Logging {
410410 val previousAttribution = previousAttribution_opt.getOrElse(ByteVector .low(totalLength))
411411 val previousHmacs = getHmacs(previousAttribution).dropRight(1 ).map(_.drop(1 ))
412412 val mac = Hmac256 (generateKey(" um" , sharedSecret))
413- val holdTimes = uint32.encode(holdTime.toMillis).require.bytes ++ previousAttribution.take((maxNumHops - 1 ) * holdTimeLength)
413+ val holdTimes = uint32.encode(holdTime.toMillis / 100 ).require.bytes ++ previousAttribution.take((maxNumHops - 1 ) * holdTimeLength)
414414 val hmacs = computeHmacs(mac, failurePacket_opt.getOrElse(ByteVector .empty), holdTimes, previousHmacs, 0 ) +: previousHmacs
415415 cipher(holdTimes ++ ByteVector .concat(hmacs.map(ByteVector .concat(_))), sharedSecret)
416416 }
@@ -421,7 +421,7 @@ object Sphinx extends Logging {
421421 */
422422 def unwrap (encrypted : ByteVector , failurePacket : ByteVector , sharedSecret : ByteVector32 , minNumHop : Int ): Option [(FiniteDuration , ByteVector )] = {
423423 val bytes = cipher(encrypted, sharedSecret)
424- val holdTime = uint32.decode(bytes.take(holdTimeLength).bits).require.value.milliseconds
424+ val holdTime = ( uint32.decode(bytes.take(holdTimeLength).bits).require.value * 100 ) .milliseconds
425425 val hmacs = getHmacs(bytes)
426426 val mac = Hmac256 (generateKey(" um" , sharedSecret))
427427 if (computeHmacs(mac, failurePacket, bytes.take(maxNumHops * holdTimeLength), hmacs.drop(1 ), minNumHop) == hmacs.head.drop(minNumHop)) {
0 commit comments