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

Fix byte order of chain hash (#151)

* fix order of chain hash (see https://github.com/lightningnetwork/lightning-rfc/issues/237)
* use known chain hashes instead of querying bitcoind
This commit is contained in:
Fabrice Drouin 2017-09-06 17:29:39 +02:00 committed by Pierre-Marie Padiou
parent a066e0d042
commit 1d29d28a2a
13 changed files with 53 additions and 52 deletions

View File

@ -9,7 +9,7 @@ import akka.pattern.after
import akka.stream.{ActorMaterializer, BindFailedException}
import akka.util.Timeout
import com.typesafe.config.{Config, ConfigFactory}
import fr.acinq.bitcoin.{Base58Check, OP_CHECKSIG, OP_DUP, OP_EQUALVERIFY, OP_HASH160, OP_PUSHDATA, Script}
import fr.acinq.bitcoin.{Base58Check, BinaryData, Block, OP_CHECKSIG, OP_DUP, OP_EQUALVERIFY, OP_HASH160, OP_PUSHDATA, Script}
import fr.acinq.eclair.api.{GetInfoResponse, Service}
import fr.acinq.eclair.blockchain.rpc.BitcoinJsonRPCClient
import fr.acinq.eclair.blockchain.zmq.ZMQActor
@ -59,17 +59,18 @@ class Setup(datadir: File, overrideDefaults: Config = ConfigFactory.empty(), act
chain = (json \ "chain").extract[String]
blockCount = (json \ "blocks").extract[Long]
progress = (json \ "verificationprogress").extract[Double]
chainHash <- bitcoinClient.client.invoke("getblockhash", 0).map(_.extract[String])
bitcoinVersion <- bitcoinClient.client.invoke("getnetworkinfo").map(json => (json \ "version")).map(_.extract[String])
} yield (chain, blockCount, progress, chainHash, bitcoinVersion)
val (chain, blockCount, progress, chainHash, bitcoinVersion) = Try(Await.result(future, 10 seconds)).recover { case _ => throw BitcoinRPCConnectionException }.get
logger.info(s"using chain=$chain chainHash=$chainHash")
assert(progress > 0.99, "bitcoind should be synchronized")
chain match {
case "test" | "regtest" => ()
} yield (chain, blockCount, progress, bitcoinVersion)
val (chain, blockCount, progress, bitcoinVersion) = Try(Await.result(future, 10 seconds)).recover { case _ => throw BitcoinRPCConnectionException }.get
val chainHash = chain match {
case "test" => Block.TestnetGenesisBlock.hash
case "regtest" => Block.RegtestGenesisBlock.hash
case _ => throw new RuntimeException("only regtest and testnet are supported for now")
}
// we use it as final payment address, so that funds are moved to the bitcoind wallet upon channel termination
logger.info(s"using chain=$chain chainHash=$chainHash")
assert(progress > 0.99, "bitcoind should be synchronized")
// we use it as final payment address, so that funds are moved to the bitcoind wallet upon channel termination
val JString(finalAddress) = Await.result(bitcoinClient.client.invoke("getnewaddress"), 10 seconds)
logger.info(s"finaladdress=$finalAddress")
// TODO: we should use p2wpkh instead of p2pkh as soon as bitcoind supports it

View File

@ -37,7 +37,7 @@ case class JsonRPCBody(jsonrpc: String = "1.0", id: String = "scala-client", met
case class Error(code: Int, message: String)
case class JsonRPCRes(result: AnyRef, error: Option[Error], id: String)
case class Status(node_id: String)
case class GetInfoResponse(nodeId: PublicKey, alias: String, port: Int, chainHash: String, blockHeight: Int)
case class GetInfoResponse(nodeId: PublicKey, alias: String, port: Int, chainHash: BinaryData, blockHeight: Int)
case class ChannelInfo(shortChannelId: String, nodeId1: PublicKey , nodeId2: PublicKey)
// @formatter:on

View File

@ -98,9 +98,9 @@ object PaymentRequest {
def apply(chainHash: BinaryData, amount: Option[MilliSatoshi], paymentHash: BinaryData, privateKey: PrivateKey, description: String, fallbackAddress: Option[String] = None, expirySeconds: Option[Long] = None, timestamp: Long = System.currentTimeMillis() / 1000L): PaymentRequest = {
val prefix = chainHash match {
case Block.RegtestGenesisBlock.blockId => "lntb"
case Block.TestnetGenesisBlock.blockId => "lntb"
case Block.LivenetGenesisBlock.blockId => "lnbc"
case Block.RegtestGenesisBlock.hash => "lntb"
case Block.TestnetGenesisBlock.hash => "lntb"
case Block.LivenetGenesisBlock.hash => "lnbc"
}
PaymentRequest(
prefix = prefix,

View File

@ -53,7 +53,7 @@ object TestConstants {
maxFeerateMismatch = 1.5,
updateFeeMinDiffRatio = 0.1,
autoReconnect = false,
chainHash = Block.RegtestGenesisBlock.blockId,
chainHash = Block.RegtestGenesisBlock.hash,
channelFlags = 1)
def id = nodeParams.privateKey.publicKey
def channelParams = Peer.makeChannelParams(
@ -99,7 +99,7 @@ object TestConstants {
maxFeerateMismatch = 1.0,
updateFeeMinDiffRatio = 0.1,
autoReconnect = false,
chainHash = Block.RegtestGenesisBlock.blockId,
chainHash = Block.RegtestGenesisBlock.hash,
channelFlags = 1)
def id = nodeParams.privateKey.publicKey
def channelParams = Peer.makeChannelParams(

View File

@ -47,9 +47,9 @@ class SqliteNetworkDbSpec extends FunSuite {
def sig = Crypto.encodeSignature(Crypto.sign(randomKey.toBin, randomKey)) :+ 1.toByte
val channel_1 = Announcements.makeChannelAnnouncement(Block.RegtestGenesisBlock.blockId, 42, randomKey.publicKey, randomKey.publicKey, randomKey.publicKey, randomKey.publicKey, sig, sig, sig, sig)
val channel_2 = Announcements.makeChannelAnnouncement(Block.RegtestGenesisBlock.blockId, 43, randomKey.publicKey, randomKey.publicKey, randomKey.publicKey, randomKey.publicKey, sig, sig, sig, sig)
val channel_3 = Announcements.makeChannelAnnouncement(Block.RegtestGenesisBlock.blockId, 44, randomKey.publicKey, randomKey.publicKey, randomKey.publicKey, randomKey.publicKey, sig, sig, sig, sig)
val channel_1 = Announcements.makeChannelAnnouncement(Block.RegtestGenesisBlock.hash, 42, randomKey.publicKey, randomKey.publicKey, randomKey.publicKey, randomKey.publicKey, sig, sig, sig, sig)
val channel_2 = Announcements.makeChannelAnnouncement(Block.RegtestGenesisBlock.hash, 43, randomKey.publicKey, randomKey.publicKey, randomKey.publicKey, randomKey.publicKey, sig, sig, sig, sig)
val channel_3 = Announcements.makeChannelAnnouncement(Block.RegtestGenesisBlock.hash, 44, randomKey.publicKey, randomKey.publicKey, randomKey.publicKey, randomKey.publicKey, sig, sig, sig, sig)
assert(db.listChannels().toSet === Set.empty)
db.addChannel(channel_1)
@ -59,9 +59,9 @@ class SqliteNetworkDbSpec extends FunSuite {
db.removeChannel(channel_2.shortChannelId)
assert(db.listChannels().toSet === Set(channel_1, channel_3))
val channel_update_1 = Announcements.makeChannelUpdate(Block.RegtestGenesisBlock.blockId, randomKey, randomKey.publicKey, 42, 5, 7000000, 50000, 100, true)
val channel_update_2 = Announcements.makeChannelUpdate(Block.RegtestGenesisBlock.blockId, randomKey, randomKey.publicKey, 43, 5, 7000000, 50000, 100, true)
val channel_update_3 = Announcements.makeChannelUpdate(Block.RegtestGenesisBlock.blockId, randomKey, randomKey.publicKey, 44, 5, 7000000, 50000, 100, true)
val channel_update_1 = Announcements.makeChannelUpdate(Block.RegtestGenesisBlock.hash, randomKey, randomKey.publicKey, 42, 5, 7000000, 50000, 100, true)
val channel_update_2 = Announcements.makeChannelUpdate(Block.RegtestGenesisBlock.hash, randomKey, randomKey.publicKey, 43, 5, 7000000, 50000, 100, true)
val channel_update_3 = Announcements.makeChannelUpdate(Block.RegtestGenesisBlock.hash, randomKey, randomKey.publicKey, 44, 5, 7000000, 50000, 100, true)
assert(db.listChannelUpdates().toSet === Set.empty)
db.addChannelUpdate(channel_update_1)

View File

@ -270,7 +270,7 @@ class IntegrationSpec extends TestKit(ActorSystem("test")) with FunSuiteLike wit
// first we find out the short channel id for channel C-D, easiest way is to ask D's register which has only one channel
sender.send(nodes("D").register, 'shortIds)
val shortIdCD = sender.expectMsgType[Map[Long, BinaryData]].keys.head
val channelUpdateCD = Announcements.makeChannelUpdate(Block.RegtestGenesisBlock.blockId, nodes("C").nodeParams.privateKey, nodes("D").nodeParams.privateKey.publicKey, shortIdCD, nodes("D").nodeParams.expiryDeltaBlocks + 1, nodes("D").nodeParams.htlcMinimumMsat, nodes("D").nodeParams.feeBaseMsat, nodes("D").nodeParams.feeProportionalMillionth)
val channelUpdateCD = Announcements.makeChannelUpdate(Block.RegtestGenesisBlock.hash, nodes("C").nodeParams.privateKey, nodes("D").nodeParams.privateKey.publicKey, shortIdCD, nodes("D").nodeParams.expiryDeltaBlocks + 1, nodes("D").nodeParams.htlcMinimumMsat, nodes("D").nodeParams.feeBaseMsat, nodes("D").nodeParams.feeProportionalMillionth)
sender.send(nodes("C").relayer, channelUpdateCD)
// first we retrieve a payment hash from D
val amountMsat = MilliSatoshi(4200000)

View File

@ -133,7 +133,7 @@ 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(Crypto.sha256(BinaryData.empty), priv_a)) :+ 1.toByte
val defaultChannelUpdate = ChannelUpdate(sig, Block.RegtestGenesisBlock.blockId, 0, 0, "0000", 0, 42000, 0, 0)
val defaultChannelUpdate = ChannelUpdate(sig, Block.RegtestGenesisBlock.hash, 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)
val channelUpdate_cd = defaultChannelUpdate.copy(shortChannelId = 3, cltvExpiryDelta = 10, feeBaseMsat = 60000, feeProportionalMillionths = 1)

View File

@ -75,9 +75,9 @@ object AnnouncementsBatchValidationSpec {
def makeChannelAnnouncement(c: SimulatedChannel)(implicit extendedBitcoinClient: ExtendedBitcoinClient, ec: ExecutionContext): ChannelAnnouncement = {
val (blockHeight, txIndex) = Await.result(extendedBitcoinClient.getTransactionShortId(c.fundingTx.txid.toString()), 10 seconds)
val shortChannelId = toShortId(blockHeight, txIndex, c.fundingOutputIndex)
val (channelAnnNodeSig1, channelAnnBitcoinSig1) = Announcements.signChannelAnnouncement(Block.RegtestGenesisBlock.blockId, shortChannelId, c.node1Key, c.node2Key.publicKey, c.node1FundingKey, c.node2FundingKey.publicKey, BinaryData(""))
val (channelAnnNodeSig2, channelAnnBitcoinSig2) = Announcements.signChannelAnnouncement(Block.RegtestGenesisBlock.blockId, shortChannelId, c.node2Key, c.node1Key.publicKey, c.node2FundingKey, c.node1FundingKey.publicKey, BinaryData(""))
val channelAnnouncement = Announcements.makeChannelAnnouncement(Block.RegtestGenesisBlock.blockId, shortChannelId, c.node1Key.publicKey, c.node2Key.publicKey, c.node1FundingKey.publicKey, c.node2FundingKey.publicKey, channelAnnNodeSig1, channelAnnNodeSig2, channelAnnBitcoinSig1, channelAnnBitcoinSig2)
val (channelAnnNodeSig1, channelAnnBitcoinSig1) = Announcements.signChannelAnnouncement(Block.RegtestGenesisBlock.hash, shortChannelId, c.node1Key, c.node2Key.publicKey, c.node1FundingKey, c.node2FundingKey.publicKey, BinaryData(""))
val (channelAnnNodeSig2, channelAnnBitcoinSig2) = Announcements.signChannelAnnouncement(Block.RegtestGenesisBlock.hash, shortChannelId, c.node2Key, c.node1Key.publicKey, c.node2FundingKey, c.node1FundingKey.publicKey, BinaryData(""))
val channelAnnouncement = Announcements.makeChannelAnnouncement(Block.RegtestGenesisBlock.hash, shortChannelId, c.node1Key.publicKey, c.node2Key.publicKey, c.node1FundingKey.publicKey, c.node2FundingKey.publicKey, channelAnnNodeSig1, channelAnnNodeSig2, channelAnnBitcoinSig1, channelAnnBitcoinSig2)
channelAnnouncement
}
}

View File

@ -25,9 +25,9 @@ class AnnouncementsSpec extends FunSuite {
test("create valid signed channel announcement") {
val (node_a, node_b, bitcoin_a, bitcoin_b) = (randomKey, randomKey, randomKey, randomKey)
val (node_a_sig, bitcoin_a_sig) = signChannelAnnouncement(Block.RegtestGenesisBlock.blockId, 42, node_a, node_b.publicKey, bitcoin_a, bitcoin_b.publicKey, "")
val (node_b_sig, bitcoin_b_sig) = signChannelAnnouncement(Block.RegtestGenesisBlock.blockId, 42, node_b, node_a.publicKey, bitcoin_b, bitcoin_a.publicKey, "")
val ann = makeChannelAnnouncement(Block.RegtestGenesisBlock.blockId, 42, node_a.publicKey, node_b.publicKey, bitcoin_a.publicKey, bitcoin_b.publicKey, node_a_sig, node_b_sig, bitcoin_a_sig, bitcoin_b_sig)
val (node_a_sig, bitcoin_a_sig) = signChannelAnnouncement(Block.RegtestGenesisBlock.hash, 42, node_a, node_b.publicKey, bitcoin_a, bitcoin_b.publicKey, "")
val (node_b_sig, bitcoin_b_sig) = signChannelAnnouncement(Block.RegtestGenesisBlock.hash, 42, node_b, node_a.publicKey, bitcoin_b, bitcoin_a.publicKey, "")
val ann = makeChannelAnnouncement(Block.RegtestGenesisBlock.hash, 42, node_a.publicKey, node_b.publicKey, bitcoin_a.publicKey, bitcoin_b.publicKey, node_a_sig, node_b_sig, bitcoin_a_sig, bitcoin_b_sig)
assert(checkSigs(ann))
assert(checkSigs(ann.copy(nodeId1 = randomKey.publicKey)) === false)
}
@ -39,7 +39,7 @@ class AnnouncementsSpec extends FunSuite {
}
test("create valid signed channel update announcement") {
val ann = makeChannelUpdate(Block.RegtestGenesisBlock.blockId, Alice.nodeParams.privateKey, randomKey.publicKey, 45561, Alice.nodeParams.expiryDeltaBlocks, Alice.nodeParams.htlcMinimumMsat, Alice.nodeParams.feeBaseMsat, Alice.nodeParams.feeProportionalMillionth)
val ann = makeChannelUpdate(Block.RegtestGenesisBlock.hash, Alice.nodeParams.privateKey, randomKey.publicKey, 45561, Alice.nodeParams.expiryDeltaBlocks, Alice.nodeParams.htlcMinimumMsat, Alice.nodeParams.feeBaseMsat, Alice.nodeParams.feeProportionalMillionth)
assert(checkSig(ann, Alice.nodeParams.privateKey.publicKey))
assert(checkSig(ann, randomKey.publicKey) === false)
}
@ -50,10 +50,10 @@ class AnnouncementsSpec extends FunSuite {
// NB: node1 < node2 (public keys)
assert(isNode1(node1_priv.publicKey.toBin, node2_priv.publicKey.toBin))
assert(!isNode1(node2_priv.publicKey.toBin, node1_priv.publicKey.toBin))
val channelUpdate1 = makeChannelUpdate(Block.RegtestGenesisBlock.blockId, node1_priv, node2_priv.publicKey, 0, 0, 0, 0, 0, enable = true)
val channelUpdate1_disabled = makeChannelUpdate(Block.RegtestGenesisBlock.blockId, node1_priv, node2_priv.publicKey, 0, 0, 0, 0, 0, enable = false)
val channelUpdate2 = makeChannelUpdate(Block.RegtestGenesisBlock.blockId, node2_priv, node1_priv.publicKey, 0, 0, 0, 0, 0, enable = true)
val channelUpdate2_disabled = makeChannelUpdate(Block.RegtestGenesisBlock.blockId, node2_priv, node1_priv.publicKey, 0, 0, 0, 0, 0, enable = false)
val channelUpdate1 = makeChannelUpdate(Block.RegtestGenesisBlock.hash, node1_priv, node2_priv.publicKey, 0, 0, 0, 0, 0, enable = true)
val channelUpdate1_disabled = makeChannelUpdate(Block.RegtestGenesisBlock.hash, node1_priv, node2_priv.publicKey, 0, 0, 0, 0, 0, enable = false)
val channelUpdate2 = makeChannelUpdate(Block.RegtestGenesisBlock.hash, node2_priv, node1_priv.publicKey, 0, 0, 0, 0, 0, enable = true)
val channelUpdate2_disabled = makeChannelUpdate(Block.RegtestGenesisBlock.hash, node2_priv, node1_priv.publicKey, 0, 0, 0, 0, 0, enable = false)
assert(channelUpdate1.flags == BinaryData("0000")) // ....00
assert(channelUpdate1_disabled.flags == BinaryData("0002")) // ....10
assert(channelUpdate2.flags == BinaryData("0001")) // ....01

View File

@ -47,9 +47,9 @@ abstract class BaseRouterSpec extends TestkitBaseClass {
val channelId_ef = toShortId(420000, 4, 0)
def channelAnnouncement(channelId: Long, node1_priv: PrivateKey, node2_priv: PrivateKey, funding1_priv: PrivateKey, funding2_priv: PrivateKey) = {
val (node1_sig, funding1_sig) = signChannelAnnouncement(Block.RegtestGenesisBlock.blockId, channelId, node1_priv, node2_priv.publicKey, funding1_priv, funding2_priv.publicKey, "")
val (node2_sig, funding2_sig) = signChannelAnnouncement(Block.RegtestGenesisBlock.blockId, channelId, node2_priv, node1_priv.publicKey, funding2_priv, funding1_priv.publicKey, "")
makeChannelAnnouncement(Block.RegtestGenesisBlock.blockId, channelId, node1_priv.publicKey, node2_priv.publicKey, funding1_priv.publicKey, funding2_priv.publicKey, node1_sig, node2_sig, funding1_sig, funding2_sig)
val (node1_sig, funding1_sig) = signChannelAnnouncement(Block.RegtestGenesisBlock.hash, channelId, node1_priv, node2_priv.publicKey, funding1_priv, funding2_priv.publicKey, "")
val (node2_sig, funding2_sig) = signChannelAnnouncement(Block.RegtestGenesisBlock.hash, channelId, node2_priv, node1_priv.publicKey, funding2_priv, funding1_priv.publicKey, "")
makeChannelAnnouncement(Block.RegtestGenesisBlock.hash, channelId, node1_priv.publicKey, node2_priv.publicKey, funding1_priv.publicKey, funding2_priv.publicKey, node1_sig, node2_sig, funding1_sig, funding2_sig)
}
val chan_ab = channelAnnouncement(channelId_ab, priv_a, priv_b, priv_funding_a, priv_funding_b)
@ -57,10 +57,10 @@ abstract class BaseRouterSpec extends TestkitBaseClass {
val chan_cd = channelAnnouncement(channelId_cd, priv_c, priv_d, priv_funding_c, priv_funding_d)
val chan_ef = channelAnnouncement(channelId_ef, priv_e, priv_f, priv_funding_e, priv_funding_f)
val channelUpdate_ab = makeChannelUpdate(Block.RegtestGenesisBlock.blockId, priv_a, b, channelId_ab, cltvExpiryDelta = 7, 0, feeBaseMsat = 766000, feeProportionalMillionths = 10)
val channelUpdate_bc = makeChannelUpdate(Block.RegtestGenesisBlock.blockId, priv_b, c, channelId_bc, cltvExpiryDelta = 5, 0, feeBaseMsat = 233000, feeProportionalMillionths = 1)
val channelUpdate_cd = makeChannelUpdate(Block.RegtestGenesisBlock.blockId, priv_c, d, channelId_cd, cltvExpiryDelta = 3, 0, feeBaseMsat = 153000, feeProportionalMillionths = 4)
val channelUpdate_ef = makeChannelUpdate(Block.RegtestGenesisBlock.blockId, priv_e, f, channelId_ef, cltvExpiryDelta = 9, 0, feeBaseMsat = 786000, feeProportionalMillionths = 8)
val channelUpdate_ab = makeChannelUpdate(Block.RegtestGenesisBlock.hash, priv_a, b, channelId_ab, cltvExpiryDelta = 7, 0, feeBaseMsat = 766000, feeProportionalMillionths = 10)
val channelUpdate_bc = makeChannelUpdate(Block.RegtestGenesisBlock.hash, priv_b, c, channelId_bc, cltvExpiryDelta = 5, 0, feeBaseMsat = 233000, feeProportionalMillionths = 1)
val channelUpdate_cd = makeChannelUpdate(Block.RegtestGenesisBlock.hash, priv_c, d, channelId_cd, cltvExpiryDelta = 3, 0, feeBaseMsat = 153000, feeProportionalMillionths = 4)
val channelUpdate_ef = makeChannelUpdate(Block.RegtestGenesisBlock.hash, priv_e, f, channelId_ef, cltvExpiryDelta = 9, 0, feeBaseMsat = 786000, feeProportionalMillionths = 8)
override def withFixture(test: OneArgTest) = {
// the network will be a --(1)--> b ---(2)--> c --(3)--> d and e --(4)--> f (we are a)

View File

@ -148,14 +148,14 @@ class RouteCalculationSpec extends FunSuite {
val DUMMY_SIG = BinaryData("3045022100e0a180fdd0fe38037cc878c03832861b40a29d32bd7b40b10c9e1efc8c1468a002205ae06d1624896d0d29f4b31e32772ea3cb1b4d7ed4e077e5da28dcc33c0e781201")
val uab = ChannelUpdate(DUMMY_SIG, Block.RegtestGenesisBlock.blockId, 1L, 0L, "0000", 1, 42, 2500, 140)
val uba = ChannelUpdate(DUMMY_SIG, Block.RegtestGenesisBlock.blockId, 1L, 1L, "0001", 1, 43, 2501, 141)
val ubc = ChannelUpdate(DUMMY_SIG, Block.RegtestGenesisBlock.blockId, 2L, 1L, "0000", 1, 44, 2502, 142)
val ucb = ChannelUpdate(DUMMY_SIG, Block.RegtestGenesisBlock.blockId, 2L, 1L, "0001", 1, 45, 2503, 143)
val ucd = ChannelUpdate(DUMMY_SIG, Block.RegtestGenesisBlock.blockId, 3L, 1L, "0000", 1, 46, 2504, 144)
val udc = ChannelUpdate(DUMMY_SIG, Block.RegtestGenesisBlock.blockId, 3L, 1L, "0001", 1, 47, 2505, 145)
val ude = ChannelUpdate(DUMMY_SIG, Block.RegtestGenesisBlock.blockId, 4L, 1L, "0000", 1, 48, 2506, 146)
val ued = ChannelUpdate(DUMMY_SIG, Block.RegtestGenesisBlock.blockId, 4L, 1L, "0001", 1, 49, 2507, 147)
val uab = ChannelUpdate(DUMMY_SIG, Block.RegtestGenesisBlock.hash, 1L, 0L, "0000", 1, 42, 2500, 140)
val uba = ChannelUpdate(DUMMY_SIG, Block.RegtestGenesisBlock.hash, 1L, 1L, "0001", 1, 43, 2501, 141)
val ubc = ChannelUpdate(DUMMY_SIG, Block.RegtestGenesisBlock.hash, 2L, 1L, "0000", 1, 44, 2502, 142)
val ucb = ChannelUpdate(DUMMY_SIG, Block.RegtestGenesisBlock.hash, 2L, 1L, "0001", 1, 45, 2503, 143)
val ucd = ChannelUpdate(DUMMY_SIG, Block.RegtestGenesisBlock.hash, 3L, 1L, "0000", 1, 46, 2504, 144)
val udc = ChannelUpdate(DUMMY_SIG, Block.RegtestGenesisBlock.hash, 3L, 1L, "0001", 1, 47, 2505, 145)
val ude = ChannelUpdate(DUMMY_SIG, Block.RegtestGenesisBlock.hash, 4L, 1L, "0000", 1, 48, 2506, 146)
val ued = ChannelUpdate(DUMMY_SIG, Block.RegtestGenesisBlock.hash, 4L, 1L, "0001", 1, 49, 2507, 147)
val updates = Map(
ChannelDesc(1L, a, b) -> uab,

View File

@ -138,7 +138,7 @@ class RouterSpec extends BaseRouterSpec {
assert(res.hops.map(_.nodeId).toList === a :: b :: c :: Nil)
assert(res.hops.last.nextNodeId === d)
val channelUpdate_cd1 = makeChannelUpdate(Block.RegtestGenesisBlock.blockId, priv_c, d, channelId_cd, cltvExpiryDelta = 3, 0, feeBaseMsat = 153000, feeProportionalMillionths = 4, enable = false)
val channelUpdate_cd1 = makeChannelUpdate(Block.RegtestGenesisBlock.hash, priv_c, d, channelId_cd, cltvExpiryDelta = 3, 0, feeBaseMsat = 153000, feeProportionalMillionths = 4, enable = false)
sender.send(router, channelUpdate_cd1)
sender.send(router, RouteRequest(a, d))
sender.expectMsg(Failure(RouteNotFound))

View File

@ -183,9 +183,9 @@ class LightningMessageCodecsSpec extends FunSuite {
val update_fail_malformed_htlc = UpdateFailMalformedHtlc(randomBytes(32), 2, randomBytes(32), 1111)
val commit_sig = CommitSig(randomBytes(32), randomSignature, randomSignature :: randomSignature :: randomSignature :: Nil)
val revoke_and_ack = RevokeAndAck(randomBytes(32), scalar(0), point(1))
val channel_announcement = ChannelAnnouncement(randomSignature, randomSignature, randomSignature, randomSignature, bin(7, 9), Block.RegtestGenesisBlock.blockId, 1, randomKey.publicKey, randomKey.publicKey, randomKey.publicKey, randomKey.publicKey)
val channel_announcement = ChannelAnnouncement(randomSignature, randomSignature, randomSignature, randomSignature, bin(7, 9), Block.RegtestGenesisBlock.hash, 1, randomKey.publicKey, randomKey.publicKey, randomKey.publicKey, randomKey.publicKey)
val node_announcement = NodeAnnouncement(randomSignature, bin(0, 0), 1, randomKey.publicKey, (100.toByte, 200.toByte, 300.toByte), "node-alias", new InetSocketAddress(InetAddress.getByAddress(Array[Byte](192.toByte, 168.toByte, 1.toByte, 42.toByte)), 42000) :: Nil)
val channel_update = ChannelUpdate(randomSignature, Block.RegtestGenesisBlock.blockId, 1, 2, bin(2, 2), 3, 4, 5, 6)
val channel_update = ChannelUpdate(randomSignature, Block.RegtestGenesisBlock.hash, 1, 2, bin(2, 2), 3, 4, 5, 6)
val announcement_signatures = AnnouncementSignatures(randomBytes(32), 42, randomSignature, randomSignature)
val ping = Ping(100, BinaryData("01" * 10))
val pong = Pong(BinaryData("01" * 10))