Pull over simple syntax changes for {cli,oracleServer,bench,dlcNode,dlcOracle,dlcOracleTest,eclairRpc,lndRpc,lndRpcTest} from #5713 (#5721)

This commit is contained in:
Chris Stewart 2024-10-17 15:41:43 -05:00 committed by GitHub
parent 602725174f
commit 7c07aa0355
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 456 additions and 490 deletions

View File

@ -124,7 +124,7 @@ object CliReaders {
override def arity: Int = 1
override def reads: String => ContractDescriptorTLV = { str =>
upickle.default.read[ContractDescriptorV0TLV](str)(
Picklers.contractDescriptorV0
using Picklers.contractDescriptorV0
)
}
}

View File

@ -148,8 +148,8 @@ case class OracleRoutes(oracle: DLCOracleApi)(implicit
oracle.findEvent(eventName).map {
case Some(event: OracleEvent) =>
val outcomesJson = event.eventDescriptorTLV match {
case enum: EnumEventDescriptorV0TLV =>
enum.outcomes.map(outcome => Str(outcome.normStr))
case e: EnumEventDescriptorV0TLV =>
e.outcomes.map(outcome => Str(outcome.normStr))
case decomp: DigitDecompositionEventDescriptorV0TLV =>
val digits = 0.until(decomp.numDigits.toInt).map { _ =>
0

View File

@ -1,19 +0,0 @@
package org.bitcoins.bench.eclair
import org.bitcoins.bench.eclair.PaymentLog.PaymentLogEntry
import scala.collection.JavaConverters._
object EclairBenchUtil {
def paymentLogValues(): Vector[PaymentLogEntry] = {
PaymentLog.paymentLog
.values()
.asScala
.toVector
}
def convertStrings(strings: Vector[String]): java.util.List[String] = {
strings.asJava
}
}

View File

@ -33,7 +33,7 @@ class DLCServer(
IO(Tcp) ! Tcp.Bind(self, bindAddress)
private[this] var socketOpt: Option[ActorRef] = None
private var socketOpt: Option[ActorRef] = None
override def receive: Receive = LoggingReceive {
case Tcp.Bound(localAddress) =>

View File

@ -30,50 +30,50 @@ class DLCOracleTest extends DLCOracleFixture {
behavior of "DLCOracle"
it must "correctly initialize" in { dlcOracle: DLCOracle =>
it must "correctly initialize" in { dlcOracle =>
dlcOracle.conf.exists().map(assert(_))
}
it must "start with no events" in { dlcOracle: DLCOracle =>
it must "start with no events" in { dlcOracle =>
dlcOracle.listEventDbs().map { events =>
assert(events.isEmpty)
}
}
it must "start with no pending events" in { dlcOracle: DLCOracle =>
it must "start with no pending events" in { dlcOracle =>
dlcOracle.listPendingEventDbs().map { events =>
assert(events.isEmpty)
}
}
it must "not find an event it doesn't have" in { dlcOracle: DLCOracle =>
it must "not find an event it doesn't have" in { dlcOracle =>
val dummyEvent = TLVGen.oracleEventV0TLV.sampleSome
dlcOracle.findEvent(dummyEvent).map { eventOpt =>
assert(eventOpt.isEmpty)
}
}
it must "calculate the correct staking address" in { dlcOracle: DLCOracle =>
it must "calculate the correct staking address" in { dlcOracle =>
forAllAsync(ChainParamsGenerator.bitcoinNetworkParams) { network =>
val expected =
Bech32Address(
P2WPKHWitnessSPKV0(dlcOracle.publicKey.publicKey),
P2WPKHWitnessSPKV0(dlcOracle.publicKey().publicKey),
network
)
assert(dlcOracle.stakingAddress(network) == expected)
}
}
it must "correctly sign a message" in { dlcOracle: DLCOracle =>
it must "correctly sign a message" in { dlcOracle =>
val message = "hello world"
val signature = dlcOracle.signMessage(message)
assert(
dlcOracle.publicKey.verify(CryptoUtil.sha256(message).bytes, signature)
dlcOracle.publicKey().verify(CryptoUtil.sha256(message).bytes, signature)
)
}
it must "get the correctly sorted nonces in an announcement " in {
dlcOracle: DLCOracle =>
dlcOracle =>
val eventName = "test"
val descriptorTLV =
DigitDecompositionEventDescriptorV0TLV(
@ -110,8 +110,7 @@ class DLCOracleTest extends DLCOracleFixture {
}
}
it must "have same keys with different network configs" in {
oracleA: DLCOracle =>
it must "have same keys with different network configs" in { oracleA =>
// set to mainnet and give separate db
val newConf = oracleA.conf.newConfigOfType(
Vector(
@ -122,7 +121,7 @@ class DLCOracleTest extends DLCOracleFixture {
newConf.start().flatMap { _ =>
val oracleB = new DLCOracle()(newConf)
assert(oracleA.publicKey == oracleB.publicKey)
assert(oracleA.publicKey() == oracleB.publicKey())
val eventName = "test"
val descriptorTLV =
@ -168,8 +167,7 @@ class DLCOracleTest extends DLCOracleFixture {
}
}
it must "create a new event and list it with pending" in {
dlcOracle: DLCOracle =>
it must "create a new event and list it with pending" in { dlcOracle =>
val time = futureTime
for {
@ -181,8 +179,7 @@ class DLCOracleTest extends DLCOracleFixture {
}
}
it must "create the same event twice and list them" in {
dlcOracle: DLCOracle =>
it must "create the same event twice and list them" in { dlcOracle =>
val time = futureTime
for {
@ -195,8 +192,7 @@ class DLCOracleTest extends DLCOracleFixture {
}
}
it must "create two events and use incrementing key indexes" in {
dlcOracle: DLCOracle =>
it must "create two events and use incrementing key indexes" in { dlcOracle =>
val create1F =
dlcOracle.createNewDigitDecompAnnouncement(
eventName = "test1",
@ -230,8 +226,7 @@ class DLCOracleTest extends DLCOracleFixture {
}
}
it must "fail to create an event with the same name" in {
dlcOracle: DLCOracle =>
it must "fail to create an event with the same name" in { dlcOracle =>
for {
_ <- dlcOracle.createNewAnnouncement("test", futureTime, testDescriptor)
res <- recoverToSucceededIf[IllegalArgumentException](
@ -240,8 +235,7 @@ class DLCOracleTest extends DLCOracleFixture {
} yield res
}
it must "create an enum new event and get its details" in {
dlcOracle: DLCOracle =>
it must "create an enum new event and get its details" in { dlcOracle =>
val time = futureTime
val eventName = "test"
@ -259,7 +253,7 @@ class DLCOracleTest extends DLCOracleFixture {
assert(event.eventName == eventName)
assert(event.eventDescriptorTLV == testDescriptor)
assert(event.signingVersion == SigningVersion.latest)
assert(event.pubkey == dlcOracle.publicKey)
assert(event.pubkey == dlcOracle.publicKey())
assert(event.maturationTime.getEpochSecond == time.getEpochSecond)
val expectedEventTLV =
@ -285,12 +279,12 @@ class DLCOracleTest extends DLCOracleFixture {
SigningVersion.latest.calcAnnouncementHash(event.eventTLV)
assert(
dlcOracle.publicKey.verify(announceBytes, event.announcementSignature)
dlcOracle.publicKey().verify(announceBytes, event.announcementSignature)
)
}
}
it must "create and sign an enum event" in { dlcOracle: DLCOracle =>
it must "create and sign an enum event" in { dlcOracle =>
val descriptor = TLVGen.enumEventDescriptorV0TLV.sampleSome
val outcome = descriptor.outcomes.head
@ -316,7 +310,7 @@ class DLCOracleTest extends DLCOracleFixture {
val hash = SigningVersion.latest.calcOutcomeHash(outcome)
assert(dlcOracle.publicKey.verify(hash, sig))
assert(dlcOracle.publicKey().verify(hash, sig))
assert(
SchnorrDigitalSignature(
completedEvent.nonces.head,
@ -336,7 +330,7 @@ class DLCOracleTest extends DLCOracleFixture {
}
}
it must "create and sign a large range event" in { dlcOracle: DLCOracle =>
it must "create and sign a large range event" in { dlcOracle =>
val outcome = -321L
for {
@ -370,7 +364,7 @@ class DLCOracleTest extends DLCOracleFixture {
// Sign Signature Check
val signHash = SigningVersion.latest.calcOutcomeHash("-")
val signSig = completedEvent.signatures.head
assert(dlcOracle.publicKey.verify(signHash, signSig))
assert(dlcOracle.publicKey().verify(signHash, signSig))
assert(
SchnorrDigitalSignature(
completedEvent.nonces.head,
@ -384,7 +378,7 @@ class DLCOracleTest extends DLCOracleFixture {
DigitDecompositionAttestation(3).bytes
)
val sig100 = completedEvent.signatures(1)
assert(dlcOracle.publicKey.verify(hash100, sig100))
assert(dlcOracle.publicKey().verify(hash100, sig100))
assert(
SchnorrDigitalSignature(
completedEvent.nonces(1),
@ -398,7 +392,7 @@ class DLCOracleTest extends DLCOracleFixture {
DigitDecompositionAttestation(2).bytes
)
val sig10 = completedEvent.signatures(2)
assert(dlcOracle.publicKey.verify(hash10, sig10))
assert(dlcOracle.publicKey().verify(hash10, sig10))
assert(
SchnorrDigitalSignature(
completedEvent.nonces(2),
@ -412,7 +406,7 @@ class DLCOracleTest extends DLCOracleFixture {
DigitDecompositionAttestation(1).bytes
)
val sig1 = completedEvent.signatures(3)
assert(dlcOracle.publicKey.verify(hash1, sig1))
assert(dlcOracle.publicKey().verify(hash1, sig1))
assert(
SchnorrDigitalSignature(
completedEvent.nonces(3),
@ -425,8 +419,7 @@ class DLCOracleTest extends DLCOracleFixture {
}
}
it must "create and sign a non-base 10 large range event" in {
dlcOracle: DLCOracle =>
it must "create and sign a non-base 10 large range event" in { dlcOracle =>
val outcome = -1931L
for {
@ -461,7 +454,7 @@ class DLCOracleTest extends DLCOracleFixture {
val signHash =
SigningVersion.latest.calcOutcomeHash("-")
val signSig = completedEvent.signatures.head
assert(dlcOracle.publicKey.verify(signHash, signSig))
assert(dlcOracle.publicKey().verify(signHash, signSig))
assert(
SchnorrDigitalSignature(
completedEvent.nonces.head,
@ -475,7 +468,7 @@ class DLCOracleTest extends DLCOracleFixture {
DigitDecompositionAttestation(7).bytes
)
val sig100 = completedEvent.signatures(1)
assert(dlcOracle.publicKey.verify(hash100, sig100))
assert(dlcOracle.publicKey().verify(hash100, sig100))
assert(
SchnorrDigitalSignature(
completedEvent.nonces(1),
@ -489,7 +482,7 @@ class DLCOracleTest extends DLCOracleFixture {
DigitDecompositionAttestation(8).bytes
)
val sig10 = completedEvent.signatures(2)
assert(dlcOracle.publicKey.verify(hash10, sig10))
assert(dlcOracle.publicKey().verify(hash10, sig10))
assert(
SchnorrDigitalSignature(
completedEvent.nonces(2),
@ -503,7 +496,7 @@ class DLCOracleTest extends DLCOracleFixture {
DigitDecompositionAttestation(11).bytes
)
val sig1 = completedEvent.signatures(3)
assert(dlcOracle.publicKey.verify(hash1, sig1))
assert(dlcOracle.publicKey().verify(hash1, sig1))
assert(
SchnorrDigitalSignature(
completedEvent.nonces(3),
@ -517,7 +510,7 @@ class DLCOracleTest extends DLCOracleFixture {
}
it must "create and sign a large range event with digits of 0" in {
dlcOracle: DLCOracle =>
dlcOracle =>
val outcome = 2
for {
@ -553,7 +546,7 @@ class DLCOracleTest extends DLCOracleFixture {
DigitDecompositionAttestation(0).bytes
)
val sig100 = completedEvent.signatures.head
assert(dlcOracle.publicKey.verify(hash100, sig100))
assert(dlcOracle.publicKey().verify(hash100, sig100))
assert(
SchnorrDigitalSignature(
completedEvent.nonces.head,
@ -567,7 +560,7 @@ class DLCOracleTest extends DLCOracleFixture {
DigitDecompositionAttestation(1).bytes
)
val sig10 = completedEvent.signatures(1)
assert(dlcOracle.publicKey.verify(hash10, sig10))
assert(dlcOracle.publicKey().verify(hash10, sig10))
assert(
SchnorrDigitalSignature(
completedEvent.nonces(1),
@ -581,7 +574,7 @@ class DLCOracleTest extends DLCOracleFixture {
DigitDecompositionAttestation(0).bytes
)
val sig1 = completedEvent.signatures(2)
assert(dlcOracle.publicKey.verify(hash1, sig1))
assert(dlcOracle.publicKey().verify(hash1, sig1))
assert(
SchnorrDigitalSignature(
completedEvent.nonces(2),
@ -595,7 +588,7 @@ class DLCOracleTest extends DLCOracleFixture {
}
it must "create and sign a decomp event with a large num digits" in {
dlcOracle: DLCOracle =>
dlcOracle =>
// trying make sure we don't regress on
// https://github.com/bitcoin-s/bitcoin-s/issues/3431
@ -629,7 +622,7 @@ class DLCOracleTest extends DLCOracleFixture {
}
}
it must "correctly track pending events" in { dlcOracle: DLCOracle =>
it must "correctly track pending events" in { dlcOracle =>
val outcome = enumOutcomes.head
for {
announcement <-
@ -656,16 +649,14 @@ class DLCOracleTest extends DLCOracleFixture {
}
}
it must "fail to sign an event that doesn't exist" in {
dlcOracle: DLCOracle =>
it must "fail to sign an event that doesn't exist" in { dlcOracle =>
val dummyNonce = SchnorrNonce(ECPublicKey.freshPublicKey.bytes.tail)
recoverToSucceededIf[RuntimeException](
dlcOracle.createAttestation(dummyNonce, EnumAttestation("testOutcomes"))
)
}
it must "fail to sign an enum outcome that doesn't exist" in {
dlcOracle: DLCOracle =>
it must "fail to sign an enum outcome that doesn't exist" in { dlcOracle =>
recoverToSucceededIf[RuntimeException] {
for {
announcement <-
@ -688,7 +679,7 @@ class DLCOracleTest extends DLCOracleFixture {
}
it must "sign a negative number for a unsigned digit decomp event that results in 0" in {
dlcOracle: DLCOracle =>
dlcOracle =>
for {
announcement <-
dlcOracle.createNewDigitDecompAnnouncement(
@ -712,8 +703,7 @@ class DLCOracleTest extends DLCOracleFixture {
}
}
it must "fail to sign an event with an outside nonce" in {
dlcOracle: DLCOracle =>
it must "fail to sign an event with an outside nonce" in { dlcOracle =>
val ecKey = ECPublicKey.freshPublicKey
val publicKey = ecKey.schnorrPublicKey
val nonce = ecKey.schnorrNonce
@ -753,7 +743,7 @@ class DLCOracleTest extends DLCOracleFixture {
}
it must "fail to sign an event with a nonce not in the event db" in {
dlcOracle: DLCOracle =>
dlcOracle =>
val ecKey = ECPublicKey.freshPublicKey
val nonce = ecKey.schnorrNonce
@ -771,29 +761,26 @@ class DLCOracleTest extends DLCOracleFixture {
}
}
it must "fail to create an enum event with no outcomes" in {
dlcOracle: DLCOracle =>
it must "fail to create an enum event with no outcomes" in { dlcOracle =>
assertThrows[IllegalArgumentException] {
dlcOracle.createNewEnumAnnouncement("test", futureTime, Vector.empty)
}
}
it must "fail to create an event with duplicate outcomes" in {
dlcOracle: DLCOracle =>
it must "fail to create an event with duplicate outcomes" in { dlcOracle =>
val outcomes = enumOutcomes :+ enumOutcomes.head
assertThrows[IllegalArgumentException] {
dlcOracle.createNewEnumAnnouncement("test", futureTime, outcomes)
}
}
it must "fail to create an event in the past" in { dlcOracle: DLCOracle =>
it must "fail to create an event in the past" in { dlcOracle =>
assertThrows[IllegalArgumentException] {
dlcOracle.createNewAnnouncement("test", Instant.EPOCH, testDescriptor)
}
}
it must "create and sign a signed digit decomposition event" in {
dlcOracle: DLCOracle =>
it must "create and sign a signed digit decomposition event" in { dlcOracle =>
val eventName = "signed"
val maturationTime = futureTime
val descriptor =
@ -826,7 +813,7 @@ class DLCOracleTest extends DLCOracleFixture {
}
it must "create and sign a unsigned digit decomposition event" in {
dlcOracle: DLCOracle =>
dlcOracle =>
val eventName = "unsigned"
val maturationTime = futureTime
val descriptor =
@ -859,7 +846,7 @@ class DLCOracleTest extends DLCOracleFixture {
}
it must "fail to verify a unsigned digit decomposition event " in {
dlcOracle: DLCOracle =>
dlcOracle =>
val eventName1 = "unsigned1"
val eventName2 = "unsigned2"
val maturationTime = futureTime
@ -917,8 +904,7 @@ class DLCOracleTest extends DLCOracleFixture {
}
}
it must "create and delete signatures for an enum event" in {
dlcOracle: DLCOracle =>
it must "create and delete signatures for an enum event" in { dlcOracle =>
val descriptor = TLVGen.enumEventDescriptorV0TLV.sampleSome
val outcome = descriptor.outcomes.head
@ -954,8 +940,7 @@ class DLCOracleTest extends DLCOracleFixture {
}
}
it must "create and delete signatures for a decomp event" in {
dlcOracle: DLCOracle =>
it must "create and delete signatures for a decomp event" in { dlcOracle =>
val descriptor =
UnsignedDigitDecompositionEventDescriptor(
UInt16(2),
@ -992,7 +977,7 @@ class DLCOracleTest extends DLCOracleFixture {
}
it must "fail to delete signatures for an unsigned enum event" in {
dlcOracle: DLCOracle =>
dlcOracle =>
val descriptor =
UnsignedDigitDecompositionEventDescriptor(
UInt16(2),
@ -1016,7 +1001,7 @@ class DLCOracleTest extends DLCOracleFixture {
}
it must "fail to delete signatures for an unsigned decomp event" in {
dlcOracle: DLCOracle =>
dlcOracle =>
val descriptor = TLVGen.enumEventDescriptorV0TLV.sampleSome
for {
@ -1097,7 +1082,7 @@ class DLCOracleTest extends DLCOracleFixture {
}
it must "delete enum attestation" in { dlcOracle: DLCOracle =>
it must "delete enum attestation" in { dlcOracle =>
val eventName = "test"
val createdF =
dlcOracle.createNewAnnouncement(eventName, futureTime, testDescriptor)
@ -1112,7 +1097,7 @@ class DLCOracleTest extends DLCOracleFixture {
}
}
it must "delete numeric attestations" in { dlcOracle: DLCOracle =>
it must "delete numeric attestations" in { dlcOracle =>
val eventName = "test"
val createdF =
dlcOracle.createNewDigitDecompAnnouncement(
@ -1137,7 +1122,7 @@ class DLCOracleTest extends DLCOracleFixture {
}
it must "delete attestations, and then delete the announcement" in {
dlcOracle: DLCOracle =>
dlcOracle =>
val eventName = "test"
val createdF =
dlcOracle.createNewDigitDecompAnnouncement(
@ -1161,7 +1146,7 @@ class DLCOracleTest extends DLCOracleFixture {
}
}
it must "set and retrieve oracle name" in { dlcOracle: DLCOracle =>
it must "set and retrieve oracle name" in { dlcOracle =>
for {
emptyNameOpt <- dlcOracle.oracleName()
_ <- dlcOracle.setOracleName("test name")
@ -1172,8 +1157,8 @@ class DLCOracleTest extends DLCOracleFixture {
}
}
it must "export staking address wif" in { dlcOracle: DLCOracle =>
val pubKey = dlcOracle.publicKey
it must "export staking address wif" in { dlcOracle =>
val pubKey = dlcOracle.publicKey()
val wif = dlcOracle.exportSigningKeyWIF
val privKey = ECPrivateKeyUtil.fromWIFToPrivateKey(wif)
assert(privKey.toPrivateKey.schnorrPublicKey == pubKey)

View File

@ -11,8 +11,7 @@ class DLCOracleAppConfigTest extends DLCOracleAppConfigFixture {
behavior of "DLCOracleAppConfig"
it must "start the same oracle twice" in {
dlcOracleAppConfig: DLCOracleAppConfig =>
it must "start the same oracle twice" in { dlcOracleAppConfig =>
val started1F = dlcOracleAppConfig.start()
val started2F = started1F.flatMap(_ => dlcOracleAppConfig.start())
for {
@ -21,19 +20,19 @@ class DLCOracleAppConfigTest extends DLCOracleAppConfigFixture {
dlcOracle1 = new DLCOracle()(dlcOracleAppConfig)
dlcOracle2 = new DLCOracle()(dlcOracleAppConfig)
} yield {
assert(dlcOracle1.publicKey == dlcOracle2.publicKey)
assert(dlcOracle1.publicKey() == dlcOracle2.publicKey())
}
}
it must "initialize the oracle, move the seed somewhere else, and then start the oracle again and get the same pubkeys" in {
dlcOracleAppConfig: DLCOracleAppConfig =>
dlcOracleAppConfig =>
val seedFile = dlcOracleAppConfig.seedPath
val startedF = dlcOracleAppConfig.start()
val pubKeyBeforeMoveF = for {
_ <- startedF
dlcOracle = new DLCOracle()(dlcOracleAppConfig)
} yield {
dlcOracle.publicKey
dlcOracle.publicKey()
}
// stop old oracle
@ -69,14 +68,14 @@ class DLCOracleAppConfigTest extends DLCOracleAppConfigFixture {
for {
_ <- stoppedF
pubKey1 <- pubKeyBeforeMoveF
pubKey2 <- dlcOracle2F.map(_.publicKey)
pubKey2 <- dlcOracle2F.map(_.publicKey())
} yield {
assert(pubKey1 == pubKey2)
}
}
it must "fail to start the oracle app config if we have different seeds" in {
dlcOracleAppConfig: DLCOracleAppConfig =>
dlcOracleAppConfig =>
val seedFile = dlcOracleAppConfig.seedPath
val startedF = dlcOracleAppConfig.start()

View File

@ -59,7 +59,7 @@ case class DLCOracle()(implicit val conf: DLCOracleAppConfig)
private val rValueChainIndex = 0
/** The root private key for this oracle */
private[this] val extPrivateKey: ExtPrivateKeyHardened = {
private val extPrivateKey: ExtPrivateKeyHardened = {
WalletStorage.getPrivateKeyFromDisk(
conf.kmConf.seedPath,
SegWitTestNet3Priv,
@ -83,10 +83,10 @@ case class DLCOracle()(implicit val conf: DLCOracleAppConfig)
extPrivateKey.deriveChildPrivKey(path).key
}
override val publicKey: SchnorrPublicKey = signingKey.schnorrPublicKey
override def publicKey(): SchnorrPublicKey = signingKey.schnorrPublicKey
override def stakingAddress(network: BitcoinNetwork): Bech32Address =
Bech32Address(P2WPKHWitnessSPKV0(publicKey.publicKey), network)
Bech32Address(P2WPKHWitnessSPKV0(publicKey().publicKey), network)
protected[bitcoins] val rValueDAO: RValueDAO = RValueDAO()
protected[bitcoins] val eventDAO: EventDAO = EventDAO()
@ -283,7 +283,7 @@ case class DLCOracle()(implicit val conf: DLCOracleAppConfig)
oracleAnnouncement = OracleAnnouncementV0TLV(
announcementSignature = announcementSignature,
publicKey = publicKey,
publicKey = publicKey(),
eventTLV = eventTLV
)
@ -608,7 +608,7 @@ object DLCOracle {
def fromDatadir(path: Path, configs: Vector[Config])(implicit
ec: ExecutionContext
): Future[DLCOracle] = {
implicit val appConfig =
implicit val appConfig: DLCOracleAppConfig =
DLCOracleAppConfig.fromDatadir(datadir = path, configs)
val masterXpubDAO: MasterXPubDAO = MasterXPubDAO()(ec, appConfig)
val oracle = DLCOracle()
@ -617,9 +617,9 @@ object DLCOracle {
_ <- appConfig.start()
_ <- MasterXPubUtil.checkMasterXPub(oracle.getRootXpub, masterXpubDAO)
differentKeyDbs <- oracle.eventDAO.findDifferentPublicKey(
oracle.publicKey
oracle.publicKey()
)
fixedDbs = differentKeyDbs.map(_.copy(pubkey = oracle.publicKey))
fixedDbs = differentKeyDbs.map(_.copy(pubkey = oracle.publicKey()))
_ <- oracle.eventDAO.updateAll(fixedDbs)
} yield oracle
}

View File

@ -102,7 +102,7 @@ class EclairRpcClient(
Seq(
from.map(x => "from" -> x.getEpochSecond.toString),
to.map(x => "to" -> x.getEpochSecond.toString)
).flatten: _*
).flatten*
)
override def channel(channelId: ChannelId): Future[ChannelResult] = {
@ -111,7 +111,7 @@ class EclairRpcClient(
private def channels(nodeId: Option[NodeId]): Future[Vector[ChannelInfo]] = {
val params = Seq(nodeId.map(id => "nodeId" -> id.toString)).flatten
eclairCall[Vector[ChannelInfo]]("channels", params: _*)
eclairCall[Vector[ChannelInfo]]("channels", params*)
}
def channels(): Future[Vector[ChannelInfo]] = channels(nodeId = None)
@ -130,7 +130,7 @@ class EclairRpcClient(
scriptPubKey.map(x => "scriptPubKey" -> BytesUtil.encodeHex(x.asmBytes))
).flatten
eclairCall[ChannelCommandResult]("close", params: _*)
eclairCall[ChannelCommandResult]("close", params*)
}
def close(channelId: ChannelId): Future[ChannelCommandResult] =
@ -193,7 +193,7 @@ class EclairRpcClient(
Some("invoice" -> invoice.toString),
amountMsat.map(x => "amountMsat" -> x.toBigDecimal.toString)
).flatten
eclairCall[Vector[Route]]("findroute", params: _*)
eclairCall[Vector[Route]]("findroute", params*)
}
override def forceClose(
@ -262,7 +262,7 @@ class EclairRpcClient(
// this is unfortunately returned in this format
// created channel 30bdf849eb9f72c9b41a09e38a6d83138c2edf332cb116dd7cf0f0dfb66be395
val call = eclairCall[String]("open", params: _*)
val call = eclairCall[String]("open", params*)
// let's just return the chanId
// format:
// created channel 19e11470b0dd96ed15c56ea8f32e9a3277dcbd570e7392c1c34709adc7ebfdc3 with fundingTxId=c2fdebc7ad0947c3c192730e57bddc77329a2ef3a86ec515ed96ddb07014e119 and fees=24750 sat
@ -413,7 +413,7 @@ class EclairRpcClient(
paymentPreimage.map(x => "paymentPreimage" -> x.hex)
).flatten
val responseF = eclairCall[InvoiceResult]("createinvoice", params: _*)
val responseF = eclairCall[InvoiceResult]("createinvoice", params*)
responseF.flatMap { res =>
Future.fromTry(LnInvoice.fromStringT(res.serialized))
@ -515,7 +515,7 @@ class EclairRpcClient(
externalId.map(x => "externalId" -> x)
).flatten
eclairCall[PaymentId]("payinvoice", params: _*)
eclairCall[PaymentId]("payinvoice", params*)
}
override def getReceivedInfo(
@ -541,7 +541,7 @@ class EclairRpcClient(
case _: JsError => JsSuccess(None)
}
}
eclairCall[Option[IncomingPayment]]("getreceivedinfo", params: _*)(r)
eclairCall[Option[IncomingPayment]]("getreceivedinfo", params*)(r)
}
override def getSentInfo(
@ -575,7 +575,7 @@ class EclairRpcClient(
externalId.map(x => "externalId" -> x)
).flatten
eclairCall[PaymentId]("sendtonode", params: _*)
eclairCall[PaymentId]("sendtonode", params*)
}
def sendToRoute(
@ -603,7 +603,7 @@ class EclairRpcClient(
parentId.map(x => "parentId" -> x.toString),
externalId.map(x => "externalId" -> x)
).flatten
eclairCall[SendToRouteResult]("sendtoroute", params: _*)
eclairCall[SendToRouteResult]("sendtoroute", params*)
}
override def updateRelayFee(
@ -640,7 +640,7 @@ class EclairRpcClient(
Seq(
from.map(x => "from" -> x.toSeconds.toString),
to.map(x => "to" -> x.toSeconds.toString)
).flatten: _*
).flatten*
)
}
@ -676,7 +676,7 @@ class EclairRpcClient(
Seq(
from.map(x => "from" -> x.getEpochSecond.toString),
to.map(x => "to" -> x.getEpochSecond.toString)
).flatten: _*
).flatten*
)
resF.flatMap(xs =>
Future.sequence(
@ -727,7 +727,7 @@ class EclairRpcClient(
private def eclairCall[T](command: String, parameters: (String, String)*)(
implicit reader: Reads[T]
): Future[T] = {
val request = buildRequest(getDaemon, command, parameters: _*)
val request = buildRequest(getDaemon, command, parameters*)
logger.trace(s"eclair rpc call ${request}")
val responseF = sendRequest(request)
@ -810,7 +810,7 @@ class EclairRpcClient(
HttpRequest(
method = HttpMethods.POST,
uri,
entity = FormData(params: _*).toEntity
entity = FormData(params*).toEntity
)
.addCredentials(
HttpCredentials.createBasicHttpCredentials(username, password)

View File

@ -17,7 +17,7 @@ import org.bitcoins.core.wallet.fee._
import org.bitcoins.crypto._
import org.bitcoins.testkit.async.TestAsyncUtil
import org.bitcoins.testkit.fixtures.DualLndFixture
import scodec.bits.{ByteVector, HexStringSyntax}
import scodec.bits.ByteVector
import signrpc.SignMethod
import scala.concurrent.{Await, Future}
@ -439,7 +439,8 @@ class LndRpcClientPairTest extends DualLndFixture with LndUtils {
it must "send and receive a custom message" in { params =>
val (_, lndA, lndB) = params
val customMessage = UnknownTLV(BigSizeUInt(48000), hex"0094355324")
val customMessage =
UnknownTLV(BigSizeUInt(48000), ByteVector.fromValidHex("0094355324"))
val subscribeF = lndA.subscribeCustomMessages().runWith(Sink.head)

View File

@ -142,7 +142,7 @@ case class LndRpcClient(instance: LndInstance, binaryOpt: Option[File] = None)(
// These need to be lazy so we don't try and fetch
// the tls certificate before it is generated
private[this] lazy val certStreamOpt: Option[InputStream] = {
private lazy val certStreamOpt: Option[InputStream] = {
instance.certFileOpt match {
case Some(file) => Some(new FileInputStream(file))
case None =>