1
0
Fork 0
mirror of https://github.com/ACINQ/eclair.git synced 2025-03-14 03:48:13 +01:00

Merge branch 'master' into android

This commit is contained in:
sstone 2019-11-14 10:13:34 +01:00
commit 7f7f737381
3 changed files with 5 additions and 6 deletions

View file

@ -2244,7 +2244,7 @@ class Channel(val nodeParams: NodeParams, val wallet: EclairWallet, remoteNodeId
case Upstream.Relayed(u) => Origin.Relayed(u.channelId, u.id, u.amountMsat, c.amount) // this is a relayed payment to an outgoing channel
}
def feePaid(fee: Satoshi, tx: Transaction, desc: String, channelId: ByteVector32): Unit = {
def feePaid(fee: Satoshi, tx: Transaction, desc: String, channelId: ByteVector32): Unit = Try { // this may fail with an NPE in tests because context has been cleaned up, but it's not a big deal
log.info(s"paid feeSatoshi=${fee.toLong} for txid=${tx.txid} desc=$desc")
context.system.eventStream.publish(NetworkFeePaid(self, remoteNodeId, channelId, tx, fee, desc))
}

View file

@ -471,12 +471,11 @@ object PaymentRequest {
val bolt11Data = Codecs.bolt11DataCodec.decode(data).require.value
val signature = ByteVector64(bolt11Data.signature.take(64))
val message: ByteVector = ByteVector.view(hrp.getBytes) ++ data.dropRight(520).toByteVector // we drop the sig bytes
val (pub1, pub2) = Crypto.recoverPublicKey(signature, Crypto.sha256(message))
val recid = bolt11Data.signature.last
val pub = if (recid % 2 != 0) pub2 else pub1
val pub = Crypto.recoverPublicKey(signature, Crypto.sha256(message), recid)
// README: since we use pubkey recovery to compute the node id from the message and signature, we don't check the signature.
// If instead we read the node id from the `n` field (which nobody uses afaict) then we would have to check the signature.
val amount_opt = Amount.decode(hrp.drop(prefix.length))
val validSig = Crypto.verifySignature(Crypto.sha256(message), signature, pub)
require(validSig, "invalid signature")
PaymentRequest(
prefix = prefix,
amount = amount_opt,

View file

@ -67,7 +67,7 @@
<akka.version>2.3.14</akka.version>
<akka.http.version>10.0.11</akka.http.version>
<sttp.version>1.3.9</sttp.version>
<bitcoinlib.version>0.15</bitcoinlib.version>
<bitcoinlib.version>0.16</bitcoinlib.version>
<guava.version>24.0-android</guava.version>
<kamon.version>2.0.0</kamon.version>
</properties>