1
0
Fork 0
mirror of https://github.com/ACINQ/eclair.git synced 2025-03-15 04:11:33 +01:00

Update single-address wallet to accept a public key instead of an address (#1780)

This will allow us to use this key as our static payment point for static-remote-key channels.
We use the BIP84 address for this key as our single address.
This commit is contained in:
Fabrice Drouin 2021-04-26 19:25:08 +02:00 committed by GitHub
parent 2e250b640f
commit 0294429e05
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 8 deletions

View file

@ -21,7 +21,7 @@
<parent> <parent>
<groupId>fr.acinq.eclair</groupId> <groupId>fr.acinq.eclair</groupId>
<artifactId>eclair_2.11</artifactId> <artifactId>eclair_2.11</artifactId>
<version>0.4.10-android-phoenix</version> <version>0.4.11-android-phoenix-SNAPSHOT</version>
</parent> </parent>
<artifactId>eclair-core_2.11</artifactId> <artifactId>eclair-core_2.11</artifactId>

View file

@ -16,23 +16,27 @@
package fr.acinq.eclair.blockchain.singleaddress package fr.acinq.eclair.blockchain.singleaddress
import fr.acinq.bitcoin.{Crypto, Satoshi, Transaction} import fr.acinq.bitcoin.Crypto.PublicKey
import fr.acinq.bitcoin.{ByteVector32, Crypto, Satoshi, Transaction, computeP2WpkhAddress}
import fr.acinq.eclair.blockchain.{EclairWallet, MakeFundingTxResponse, OnChainBalance} import fr.acinq.eclair.blockchain.{EclairWallet, MakeFundingTxResponse, OnChainBalance}
import scodec.bits.ByteVector import scodec.bits.ByteVector
import scala.concurrent.Future import scala.concurrent.Future
/** /**
* This is a minimal eclair wallet that doesn't manage funds, it can't be used to fund channels * This is a minimal eclair wallet that doesn't manage funds, it can't be used to fund channels. It manages a single public key and will
* @param finalAddress * return the BIP84 (p2wpkh) address for this key.
* @param chainHash chain hash we're on
* @param receiveKey public key that will be used in all scripts and addresses for this wallet
*/ */
class SingleAddressEclairWallet(finalAddress: String) extends EclairWallet { class SingleAddressEclairWallet(chainHash: ByteVector32, receiveKey: PublicKey) extends EclairWallet {
val finalAddress = computeP2WpkhAddress(receiveKey, chainHash)
override def getBalance: Future[OnChainBalance] = Future.successful(OnChainBalance(Satoshi(0), Satoshi(0))) override def getBalance: Future[OnChainBalance] = Future.successful(OnChainBalance(Satoshi(0), Satoshi(0)))
override def getReceiveAddress: Future[String] = Future.successful(finalAddress) override def getReceiveAddress: Future[String] = Future.successful(finalAddress)
override def getReceivePubkey(receiveAddress: Option[String]): Future[Crypto.PublicKey] = ??? override def getReceivePubkey(receiveAddress: Option[String]): Future[Crypto.PublicKey] = Future.successful(receiveKey)
override def makeFundingTx(pubkeyScript: ByteVector, amount: Satoshi, feeRatePerKw: Long): Future[MakeFundingTxResponse] = Future.failed(???) override def makeFundingTx(pubkeyScript: ByteVector, amount: Satoshi, feeRatePerKw: Long): Future[MakeFundingTxResponse] = Future.failed(???)

View file

@ -21,7 +21,7 @@
<parent> <parent>
<groupId>fr.acinq.eclair</groupId> <groupId>fr.acinq.eclair</groupId>
<artifactId>eclair_2.11</artifactId> <artifactId>eclair_2.11</artifactId>
<version>0.4.10-android-phoenix</version> <version>0.4.11-android-phoenix-SNAPSHOT</version>
</parent> </parent>
<artifactId>eclair-node_2.11</artifactId> <artifactId>eclair-node_2.11</artifactId>

View file

@ -20,7 +20,7 @@
<groupId>fr.acinq.eclair</groupId> <groupId>fr.acinq.eclair</groupId>
<artifactId>eclair_2.11</artifactId> <artifactId>eclair_2.11</artifactId>
<version>0.4.10-android-phoenix</version> <version>0.4.11-android-phoenix-SNAPSHOT</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<modules> <modules>