mirror of
https://github.com/bitcoin-s/bitcoin-s.git
synced 2024-11-19 01:40:55 +01:00
parent
9e61e9bab7
commit
613e19c281
@ -132,14 +132,14 @@ val chainApi = new ChainQueryApi {
|
||||
|
||||
/** Gets the hash of the block that is what we consider "best" */
|
||||
override def getBestBlockHash(): Future[DoubleSha256DigestBE] = {
|
||||
bitcoind.getBestBlockHash
|
||||
bitcoind.getBestBlockHash()
|
||||
}
|
||||
|
||||
/** Gets number of confirmations for the given block hash */
|
||||
override def getNumberOfConfirmations(
|
||||
blockHash: DoubleSha256DigestBE): Future[Option[Int]] = {
|
||||
for {
|
||||
tip <- bitcoind.getBlockCount
|
||||
tip <- bitcoind.getBlockCount()
|
||||
block <- bitcoind.getBlock(blockHash)
|
||||
} yield {
|
||||
Some(tip - block.height + 1)
|
||||
@ -150,7 +150,7 @@ val chainApi = new ChainQueryApi {
|
||||
override def getFilterCount(): Future[Int] = {
|
||||
// since bitcoind should have the filter for
|
||||
// every block we can just return the block height
|
||||
bitcoind.getBlockCount
|
||||
bitcoind.getBlockCount()
|
||||
}
|
||||
|
||||
/** Returns the block height of the given block stamp */
|
||||
|
@ -81,7 +81,7 @@ val syncedChainApiF = for {
|
||||
val syncResultF = syncedChainApiF.flatMap { chainApi =>
|
||||
chainApi.getBlockCount().map(count => println(s"chain api blockcount=${count}"))
|
||||
|
||||
rpcCli.getBlockCount.map(count => println(s"bitcoind blockcount=${count}"))
|
||||
rpcCli.getBlockCount().map(count => println(s"bitcoind blockcount=${count}"))
|
||||
}
|
||||
|
||||
syncResultF.onComplete { case result =>
|
||||
|
@ -674,7 +674,7 @@ object ConditionalSigner extends ConditionalSigner
|
||||
We must now add the new signing functionality from the previous step to the general-purpose signing functions by adding a new `case` for your new `InputInfo` type in the `match` within `BitcoinSigner.sign`. In the case of `P2PKWithTimeout`, this looks like:
|
||||
|
||||
```scala mdoc:compile-only
|
||||
spendingInfoToSatisfy match {
|
||||
spendingInfoToSatisfy.inputInfo match {
|
||||
//...
|
||||
case p2pKWithTimeout: P2PKWithTimeoutInputInfo =>
|
||||
P2PKWithTimeoutSigner.sign(spendingInfo,
|
||||
|
@ -139,10 +139,10 @@ The `DLCStatus` object also contains many useful utility functions to extract an
|
||||
val descriptor = NumericContractDescriptor(curve, numDigits = 15, roundTo100)
|
||||
|
||||
val announcements = 0.until(5).toVector.map { _ =>
|
||||
val oraclePrivKey = ECPrivateKey.freshPrivateKey
|
||||
val nonces = 0.until(15).toVector.map(_ => ECPrivateKey.freshPrivateKey.schnorrNonce)
|
||||
val orderedNonces = OrderedNonces.fromUnsorted(nonces)
|
||||
OracleAnnouncementV0TLV.dummyForKeys(oraclePrivKey, orderedNonces)
|
||||
val oraclePrivKey = ECPrivateKey.freshPrivateKey
|
||||
val nonces = 0.until(15).toVector.map(_ => ECPrivateKey.freshPrivateKey.schnorrNonce)
|
||||
val orderedNonces = OrderedNonces.fromUnsorted(nonces)
|
||||
OracleAnnouncementV0TLV.dummyForKeys(oraclePrivKey, orderedNonces)
|
||||
}
|
||||
val oracleInfo = NumericMultiOracleInfo(
|
||||
threshold = 3,
|
||||
|
@ -50,7 +50,7 @@ val bitcoindRpcClientF = BitcoindRpcTestUtil.startedBitcoindRpcClient(Some(insta
|
||||
//let's just grab the block count for an example
|
||||
val blockCountF = for {
|
||||
bitcoind <- bitcoindRpcClientF
|
||||
count <- bitcoind.getBlockCount
|
||||
count <- bitcoind.getBlockCount()
|
||||
} yield {
|
||||
//run a test against the block count
|
||||
assert(count > 0, s"Block count was not more than zero!")
|
||||
|
@ -103,7 +103,7 @@ val bitcoindRpcClientF: Future[BitcoindRpcClient] = client.start()
|
||||
//wait for bitcoind to get started
|
||||
val bitcoind = Await.result(bitcoindRpcClientF, 10.seconds)
|
||||
|
||||
val getBestBlockHashFunc = () => bitcoind.getBestBlockHash
|
||||
val getBestBlockHashFunc = () => bitcoind.getBestBlockHash()
|
||||
|
||||
val getBlockHeaderFunc = { (hash: DoubleSha256DigestBE) => bitcoind.getBlockHeaderRaw(hash) }
|
||||
|
||||
|
@ -122,7 +122,7 @@ val bitcoind = BitcoindRpcClient(bitcoindInstance)
|
||||
// peer
|
||||
val syncF: Future[ChainApi] = configF.flatMap { _ =>
|
||||
val getBestBlockHashFunc = { () =>
|
||||
bitcoind.getBestBlockHash
|
||||
bitcoind.getBestBlockHash()
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user