1
0
mirror of https://github.com/ACINQ/eclair.git synced 2025-01-19 05:33:59 +01:00

make sure we sign data that is 32 bytes long, with valid private keys

This commit is contained in:
sstone 2017-07-19 16:32:10 +02:00
parent 8c00efb9b6
commit ec1cd2b9ff
3 changed files with 3 additions and 3 deletions

View File

@ -132,7 +132,7 @@ class HtlcGenerationSpec extends FunSuite {
object HtlcGenerationSpec {
val (priv_a, priv_b, priv_c, priv_d, priv_e) = (randomKey, randomKey, randomKey, randomKey, randomKey)
val (a, b, c, d, e) = (priv_a.publicKey, priv_b.publicKey, priv_c.publicKey, priv_d.publicKey, priv_e.publicKey)
val sig = Crypto.encodeSignature(Crypto.sign(BinaryData.empty, priv_a)) :+ 1.toByte
val sig = Crypto.encodeSignature(Crypto.sign(Crypto.sha256(BinaryData.empty), priv_a)) :+ 1.toByte
val defaultChannelUpdate = ChannelUpdate(sig, 0, 0, "0000", 0, 42000, 0, 0)
val channelUpdate_ab = defaultChannelUpdate.copy(shortChannelId = 1, cltvExpiryDelta = 4, feeBaseMsat = 642000, feeProportionalMillionths = 7)
val channelUpdate_bc = defaultChannelUpdate.copy(shortChannelId = 2, cltvExpiryDelta = 5, feeBaseMsat = 153000, feeProportionalMillionths = 4)

View File

@ -62,7 +62,7 @@ class TransactionsSpec extends FunSuite {
val localPaymentPriv = PrivateKey(BinaryData("dd" * 32), compressed = true)
val remotePaymentPriv = PrivateKey(BinaryData("ee" * 32), compressed = true)
val localFinalPriv = PrivateKey(BinaryData("ff" * 32), compressed = true)
val finalPubKeyScript = Script.write(Script.pay2wpkh(PrivateKey(BinaryData("ff" * 32), compressed = true).publicKey))
val finalPubKeyScript = Script.write(Script.pay2wpkh(PrivateKey(BinaryData("fe" * 32), compressed = true).publicKey))
val toLocalDelay = 144
val feeratePerKw = 1000

View File

@ -28,7 +28,7 @@ class LightningMessageCodecsSpec extends FunSuite {
def randomSignature: BinaryData = {
val priv = randomBytes(32)
val data = randomBytes(50)
val data = randomBytes(32)
val (r, s) = Crypto.sign(data, PrivateKey(priv, true))
Crypto.encodeSignature(r, s) :+ fr.acinq.bitcoin.SIGHASH_ALL.toByte
}