mirror of
https://github.com/ACINQ/eclair.git
synced 2025-02-23 14:40:34 +01:00
Merge pull request #2 from ACINQ/wip-keys
random nodeid, commit and final keys
This commit is contained in:
commit
b530a15cf7
3 changed files with 10 additions and 6 deletions
|
@ -25,6 +25,9 @@ object Boot extends App with Logging {
|
|||
implicit val formats = org.json4s.DefaultFormats
|
||||
implicit val ec = ExecutionContext.Implicits.global
|
||||
|
||||
logger.info(s"hello!")
|
||||
logger.info(s"nodeid=${Globals.node_id.pub}")
|
||||
|
||||
val config = ConfigFactory.load()
|
||||
val chain = Await.result(bitcoin_client.invoke("getblockchaininfo").map(json => (json \ "chain").extract[String]), 10 seconds)
|
||||
assert(chain == "testnet" || chain == "regtest", "you should be on testnet or regtest")
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package fr.acinq.eclair
|
||||
|
||||
import com.typesafe.config.ConfigFactory
|
||||
import fr.acinq.bitcoin.{BitcoinJsonRPCClient, Base58Check}
|
||||
import fr.acinq.bitcoin.{Crypto, BitcoinJsonRPCClient}
|
||||
import fr.acinq.eclair.channel.OurChannelParams
|
||||
import fr.acinq.eclair.crypto.LightningCrypto._
|
||||
import fr.acinq.eclair.crypto.LightningCrypto
|
||||
import lightning.locktime
|
||||
import lightning.locktime.Locktime.Seconds
|
||||
|
||||
|
@ -13,9 +13,10 @@ import lightning.locktime.Locktime.Seconds
|
|||
*/
|
||||
object Globals {
|
||||
val config = ConfigFactory.load()
|
||||
val node_id = KeyPair("0277863c1e40a2d4934ccf18e6679ea949d36bb0d1333fb098e99180df60d0195a","0623a602c7b0c96df445b999de31ca31682f0117ca2bf2fb149b9e09287d5d47")
|
||||
val commit_priv = Base58Check.decode("cQPmcNr6pwBQPyGfab3SksE9nTCtx9ism9T4dkS9dETNU2KKtJHk")._2
|
||||
val final_priv = Base58Check.decode("cUrAtLtV7GGddqdkhUxnbZVDWGJBTducpPoon3eKp9Vnr1zxs6BG")._2
|
||||
|
||||
val node_id = LightningCrypto.randomKeyPair()
|
||||
val commit_priv = Crypto.sha256(node_id.priv) // TODO : just for testing
|
||||
val final_priv = Crypto.sha256(commit_priv) // TODO : just for testing
|
||||
|
||||
val default_locktime = locktime(Seconds(86400))
|
||||
val default_mindepth = 3
|
||||
|
|
|
@ -68,7 +68,7 @@ class AuthHandler(them: ActorRef, blockchain: ActorRef, our_params: OurChannelPa
|
|||
stay using s.copy(totlen_in = new_totlen_in, acc_in = rest)
|
||||
|
||||
case Event(pkt(Auth(auth)), s: SessionData) =>
|
||||
log.info(s"their_nodeid: ${BinaryData(auth.nodeId.key.toByteArray)}")
|
||||
log.info(s"their_nodeid=${BinaryData(auth.nodeId.key.toByteArray)}")
|
||||
assert(Crypto.verifySignature(Crypto.hash256(session_key.pub), signature2bin(auth.sessionSig), pubkey2bin(auth.nodeId)), "auth failed")
|
||||
val channel = context.actorOf(Channel.props(self, blockchain, our_params), name = "channel")
|
||||
goto(IO_NORMAL) using Normal(channel, s)
|
||||
|
|
Loading…
Add table
Reference in a new issue