mirror of
https://github.com/bitcoin-s/bitcoin-s.git
synced 2025-03-13 19:37:30 +01:00
2020 11 02 cleanup (#2233)
* Cleanup a bunch of imports in test * Use @nowarn annotation for testing things that are deprecated * Fix base58 test * Cleanup crypto-test * Use scala collection compat dependency to get access to the @nowarn annotation on scala 2.12.x * Rework more scala 2.13.x compile failures in chain-test and key-manager-test * Optimize imports for entire project * Fix nits
This commit is contained in:
parent
641538440f
commit
8a148357d5
144 changed files with 337 additions and 483 deletions
|
@ -2,8 +2,8 @@ package org.bitcoins.gui
|
|||
|
||||
import scalafx.application.Platform
|
||||
import scalafx.scene.Node
|
||||
import scalafx.scene.control.Alert.AlertType
|
||||
import scalafx.scene.control.Alert
|
||||
import scalafx.scene.control.Alert.AlertType
|
||||
|
||||
/**
|
||||
* Runs a background task disabling the `mainView` and main visible `glassPane`.
|
||||
|
|
|
@ -3,8 +3,8 @@ package org.bitcoins.gui.dlc
|
|||
import org.bitcoins.cli.{CliCommand, ConsoleCli}
|
||||
import org.bitcoins.commons.jsonmodels.dlc.DLCMessage.OracleInfo
|
||||
import org.bitcoins.crypto.ECPrivateKey
|
||||
import org.bitcoins.gui.{GlobalData, TaskRunner}
|
||||
import org.bitcoins.gui.dlc.dialog._
|
||||
import org.bitcoins.gui.{GlobalData, TaskRunner}
|
||||
import scalafx.beans.property.ObjectProperty
|
||||
import scalafx.scene.control.{TextArea, TextField}
|
||||
import scalafx.stage.Window
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package org.bitcoins.gui.dlc.dialog
|
||||
|
||||
import org.bitcoins.cli.CliCommand.ClaimDLCPenaltyFunds
|
||||
import org.bitcoins.crypto.Sha256DigestBE
|
||||
import org.bitcoins.core.protocol.transaction.Transaction
|
||||
import org.bitcoins.crypto.Sha256DigestBE
|
||||
import scalafx.scene.control.TextField
|
||||
|
||||
object PunishDLCDialog
|
||||
|
|
|
@ -7,15 +7,8 @@ import akka.http.scaladsl.server.ValidationRejection
|
|||
import akka.http.scaladsl.testkit.ScalatestRouteTest
|
||||
import org.bitcoins.core.Core
|
||||
import org.bitcoins.core.api.chain.ChainApi
|
||||
import org.bitcoins.core.api.wallet.db._
|
||||
import org.bitcoins.core.api.wallet.{AddressInfo, CoinSelectionAlgo}
|
||||
import org.bitcoins.core.api.wallet.db.{
|
||||
AccountDb,
|
||||
AddressDb,
|
||||
AddressTagDb,
|
||||
LegacyAddressDb,
|
||||
SegwitV0SpendingInfo,
|
||||
SpendingInfoDb
|
||||
}
|
||||
import org.bitcoins.core.config.RegTest
|
||||
import org.bitcoins.core.crypto.ExtPublicKey
|
||||
import org.bitcoins.core.currency.{Bitcoins, CurrencyUnit, Satoshis}
|
||||
|
|
|
@ -17,12 +17,12 @@
|
|||
package de.heikoseeberger.akkahttpupickle
|
||||
|
||||
import akka.http.scaladsl.marshalling.{Marshaller, ToEntityMarshaller}
|
||||
import akka.http.scaladsl.model.ContentTypeRange
|
||||
import akka.http.scaladsl.model.MediaType
|
||||
import akka.http.scaladsl.model.{ContentTypeRange, MediaType}
|
||||
import akka.http.scaladsl.model.MediaTypes.`application/json`
|
||||
import akka.http.scaladsl.unmarshalling.{FromEntityUnmarshaller, Unmarshaller}
|
||||
import akka.util.ByteString
|
||||
import upickle.default.{read, write, Reader, Writer}
|
||||
|
||||
import scala.collection.immutable.Seq
|
||||
|
||||
/**
|
||||
|
|
|
@ -9,8 +9,8 @@ import org.bitcoins.core.protocol.ln.currency._
|
|||
import org.bitcoins.testkit.async.TestAsyncUtil
|
||||
import org.bitcoins.testkit.eclair.rpc.EclairRpcTestUtil
|
||||
|
||||
import scala.concurrent.duration.DurationInt
|
||||
import scala.concurrent.Future
|
||||
import scala.concurrent.duration.DurationInt
|
||||
import scala.util.{Failure, Success}
|
||||
|
||||
/**
|
||||
|
|
|
@ -9,8 +9,9 @@ import org.bitcoins.commons.jsonmodels.eclair.WebSocketEvent.{
|
|||
PaymentSent
|
||||
}
|
||||
import org.bitcoins.commons.jsonmodels.eclair.{PaymentId, WebSocketEvent}
|
||||
import org.bitcoins.crypto.Sha256Digest
|
||||
import org.bitcoins.core.seqUtil
|
||||
import org.bitcoins.crypto.Sha256Digest
|
||||
|
||||
import scala.concurrent.Promise
|
||||
|
||||
object PaymentLog {
|
||||
|
|
|
@ -26,7 +26,8 @@ class BitcoindChainHandlerViaZmqTest extends ChainDbUnitTest {
|
|||
|
||||
for {
|
||||
_ <-
|
||||
chainHandler.getBlockCount
|
||||
chainHandler
|
||||
.getBlockCount()
|
||||
.map(count => assert(count == 0))
|
||||
address <- bitcoind.getNewAddress
|
||||
hash +: _ <- bitcoind.generateToAddress(1, address)
|
||||
|
|
|
@ -10,13 +10,12 @@ import org.bitcoins.core.number.{Int32, UInt32}
|
|||
import org.bitcoins.core.p2p.CompactFilterMessage
|
||||
import org.bitcoins.core.protocol.BlockStamp
|
||||
import org.bitcoins.core.protocol.blockchain.BlockHeader
|
||||
import org.bitcoins.core.util.{FutureUtil, TimeUtil}
|
||||
import org.bitcoins.core.util.TimeUtil
|
||||
import org.bitcoins.crypto.{
|
||||
DoubleSha256Digest,
|
||||
DoubleSha256DigestBE,
|
||||
ECPrivateKey
|
||||
}
|
||||
import org.bitcoins.testkit.chain
|
||||
import org.bitcoins.testkit.chain.fixture.ChainFixtureTag
|
||||
import org.bitcoins.testkit.chain.{
|
||||
BlockHeaderHelper,
|
||||
|
@ -24,8 +23,8 @@ import org.bitcoins.testkit.chain.{
|
|||
ChainTestUtil,
|
||||
ChainUnitTest
|
||||
}
|
||||
import org.bitcoins.testkit.util.{FileUtil, ScalaTestUtil}
|
||||
import org.scalatest.{Assertion, FutureOutcome}
|
||||
import org.bitcoins.testkit.util.FileUtil
|
||||
import org.scalatest.FutureOutcome
|
||||
import play.api.libs.json.Json
|
||||
|
||||
import scala.concurrent.{Future, Promise}
|
||||
|
@ -87,7 +86,7 @@ class ChainHandlerTest extends ChainDbUnitTest {
|
|||
|
||||
it must "have an in-order seed" in { _ =>
|
||||
val source = FileUtil.getFileAsSource("block_headers.json")
|
||||
val arrStr = source.getLines.next
|
||||
val arrStr = source.getLines().next()
|
||||
source.close()
|
||||
|
||||
import org.bitcoins.commons.serializers.JsonReaders.BlockHeaderReads
|
||||
|
@ -129,7 +128,7 @@ class ChainHandlerTest extends ChainDbUnitTest {
|
|||
val assertBBestHashF = for {
|
||||
chainHandler <- chainHandlerCF
|
||||
headerB <- newHeaderBF
|
||||
bestHash <- chainHandler.getBestBlockHash
|
||||
bestHash <- chainHandler.getBestBlockHash()
|
||||
} yield {
|
||||
assert(bestHash == headerB.hashBE)
|
||||
}
|
||||
|
@ -218,14 +217,14 @@ class ChainHandlerTest extends ChainDbUnitTest {
|
|||
for {
|
||||
chainHandlerF <- chainHandlerFF
|
||||
headerE <- headerEF
|
||||
bestHash <- chainHandlerF.getBestBlockHash
|
||||
bestHash <- chainHandlerF.getBestBlockHash()
|
||||
} yield assert(bestHash == headerE.hashBE)
|
||||
}
|
||||
|
||||
it must "get the highest filter header" in { chainHandler: ChainHandler =>
|
||||
{
|
||||
for {
|
||||
count <- chainHandler.getFilterHeaderCount
|
||||
count <- chainHandler.getFilterHeaderCount()
|
||||
genesisFilterHeader <- chainHandler.getFilterHeadersAtHeight(count)
|
||||
} yield {
|
||||
assert(genesisFilterHeader.size == 1)
|
||||
|
@ -255,7 +254,7 @@ class ChainHandlerTest extends ChainDbUnitTest {
|
|||
it must "get the highest filter" in { chainHandler: ChainHandler =>
|
||||
{
|
||||
for {
|
||||
count <- chainHandler.getFilterCount
|
||||
count <- chainHandler.getFilterCount()
|
||||
genesisFilter <- chainHandler.getFiltersAtHeight(count)
|
||||
} yield {
|
||||
assert(count == 0)
|
||||
|
@ -382,7 +381,6 @@ class ChainHandlerTest extends ChainDbUnitTest {
|
|||
blockHeaderBatchOpt <- chainHandler.nextBlockHeaderBatchRange(
|
||||
prevStopHash = ChainTestUtil.regTestGenesisHeaderDb.hashBE,
|
||||
batchSize = batchSize)
|
||||
count <- chainHandler.getBlockCount()
|
||||
} yield {
|
||||
assert(blockHeaderBatchOpt.isDefined)
|
||||
val marker = blockHeaderBatchOpt.get
|
||||
|
@ -420,7 +418,6 @@ class ChainHandlerTest extends ChainDbUnitTest {
|
|||
val assert1F = for {
|
||||
rangeOpt <-
|
||||
chainHandler.nextBlockHeaderBatchRange(genesisHeader.hashBE, 1)
|
||||
count <- chainHandler.getBlockCount()
|
||||
} yield {
|
||||
assert(rangeOpt.isEmpty)
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ class MainnetChainHandlerTest extends ChainDbUnitTest {
|
|||
implicit override lazy val appConfig: ChainAppConfig = mainnetAppConfig
|
||||
|
||||
val source: BufferedSource = FileUtil.getFileAsSource("block_headers.json")
|
||||
val arrStr: String = source.getLines.next
|
||||
val arrStr: String = source.getLines().next()
|
||||
source.close()
|
||||
|
||||
import org.bitcoins.commons.serializers.JsonReaders.BlockHeaderReads
|
||||
|
@ -92,7 +92,7 @@ class MainnetChainHandlerTest extends ChainDbUnitTest {
|
|||
|
||||
for {
|
||||
ch <- processedF
|
||||
bestHash <- ch.getBestBlockHash
|
||||
bestHash <- ch.getBestBlockHash()
|
||||
} yield assert(bestHash == blockHeadersToTest.last.hashBE)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ class ChainSyncTest extends ChainDbUnitTest {
|
|||
}
|
||||
|
||||
newChainHandlerF.flatMap { chainHandler =>
|
||||
chainHandler.getBlockCount.map(count => assert(count == 1))
|
||||
chainHandler.getBlockCount().map(count => assert(count == 1))
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ class ChainSyncTest extends ChainDbUnitTest {
|
|||
getBestBlockHashFunc = getBestBlockHashFunc)
|
||||
|
||||
newChainHandlerF.flatMap { chainHandler =>
|
||||
chainHandler.getBlockCount.map(count => assert(count == 0))
|
||||
chainHandler.getBlockCount().map(count => assert(count == 0))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -23,8 +23,8 @@ class FilterSyncTest extends ChainDbUnitTest {
|
|||
it must "sync 1 filter header from an external data source" in { fixture =>
|
||||
val BitcoindV19ChainHandler(bitcoind, chainHandler) = fixture
|
||||
|
||||
val initFilterCountF = chainHandler.getFilterCount
|
||||
val initFilterHeaderCountF = chainHandler.getFilterHeaderCount
|
||||
val initFilterCountF = chainHandler.getFilterCount()
|
||||
val initFilterHeaderCountF = chainHandler.getFilterHeaderCount()
|
||||
val initAssertionsF = for {
|
||||
initFilterCount <- initFilterCountF
|
||||
initFilterHeaderCount <- initFilterHeaderCountF
|
||||
|
|
|
@ -1,17 +1,12 @@
|
|||
package org.bitcoins.chain.models
|
||||
|
||||
import org.bitcoins.core.api.chain.db.{BlockHeaderDb, CompactFilterHeaderDb}
|
||||
import org.bitcoins.core.protocol.blockchain.BlockHeader
|
||||
import org.bitcoins.testkit.chain.{
|
||||
BlockHeaderHelper,
|
||||
ChainDbUnitTest,
|
||||
ChainTestUtil,
|
||||
ChainUnitTest
|
||||
}
|
||||
import org.bitcoins.testkit.core.gen.{
|
||||
BlockchainElementsGenerator,
|
||||
CryptoGenerators
|
||||
ChainTestUtil
|
||||
}
|
||||
import org.bitcoins.testkit.core.gen.CryptoGenerators
|
||||
import org.scalatest.FutureOutcome
|
||||
|
||||
class CompactFilterHeaderDAOTest extends ChainDbUnitTest {
|
||||
|
|
|
@ -4,9 +4,9 @@ import org.bitcoins.chain.ChainVerificationLogger
|
|||
import org.bitcoins.chain.config.ChainAppConfig
|
||||
import org.bitcoins.chain.models._
|
||||
import org.bitcoins.chain.pow.Pow
|
||||
import org.bitcoins.core.api.chain.{ChainApi, FilterSyncMarker}
|
||||
import org.bitcoins.core.api.chain.ChainQueryApi.FilterResponse
|
||||
import org.bitcoins.core.api.chain.db._
|
||||
import org.bitcoins.core.api.chain.{ChainApi, FilterSyncMarker}
|
||||
import org.bitcoins.core.gcs.FilterHeader
|
||||
import org.bitcoins.core.number.UInt32
|
||||
import org.bitcoins.core.p2p.CompactFilterMessage
|
||||
|
|
|
@ -17,7 +17,8 @@ class CallbackTest extends BitcoinSAsyncTest {
|
|||
val f1: Callback[Unit] = _ => {
|
||||
system.scheduler.scheduleOnce(testTimeout) {
|
||||
if (!promise.isCompleted) {
|
||||
promise.complete(fail("2nd callback did not start before timeout"))
|
||||
promise.failure(
|
||||
new RuntimeException("2nd callback did not start before timeout"))
|
||||
}
|
||||
}
|
||||
promise.future.map(_ => ())
|
||||
|
|
|
@ -4,18 +4,12 @@ import org.bitcoins.core.crypto._
|
|||
import org.bitcoins.core.number.UInt32
|
||||
import org.bitcoins.core.protocol.blockchain.Block
|
||||
import org.bitcoins.core.protocol.transaction.{Transaction, TransactionOutPoint}
|
||||
import org.bitcoins.crypto.{
|
||||
CryptoUtil,
|
||||
DoubleSha256Digest,
|
||||
ECPrivateKey,
|
||||
ECPublicKey,
|
||||
Sha256Hash160Digest
|
||||
}
|
||||
import scodec.bits._
|
||||
import org.bitcoins.crypto._
|
||||
import org.bitcoins.testkit.core.gen.BloomFilterGenerator
|
||||
import org.bitcoins.testkit.util.BitcoinSUnitTest
|
||||
import scodec.bits._
|
||||
|
||||
import scala.util.Try
|
||||
import org.bitcoins.testkit.core.gen.BloomFilterGenerator
|
||||
|
||||
class BloomFilterTest extends BitcoinSUnitTest {
|
||||
"BloomFilter" must "create a bloom filter, insert a few elements, then serialize and deserialize it" in {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package org.bitcoins.core.compat
|
||||
|
||||
import org.bitcoins.chain.blockchain.BlockchainUpdate.Successful
|
||||
import org.bitcoins.testkit.util.BitcoinSUnitTest
|
||||
|
||||
import scala.annotation.nowarn
|
||||
import scala.util.{Failure, Success}
|
||||
|
||||
class CompatEitherTest extends BitcoinSUnitTest {
|
||||
|
@ -24,29 +24,29 @@ class CompatEitherTest extends BitcoinSUnitTest {
|
|||
it should "do traverse operations" in {
|
||||
val mappedRight = CompatEither(Right(12)).map(_ => "flower")
|
||||
assert(mappedRight == CompatEither(Right("flower")))
|
||||
val mappedLeft = CompatEither(Left(12)).map(_ => "flower")
|
||||
@nowarn val mappedLeft = CompatEither(Left(12)).map(_ => "flower")
|
||||
assert(mappedLeft == CompatEither(Left(12)))
|
||||
|
||||
val flatmappedRight: CompatEither[Int, String] =
|
||||
CompatEither(Right(12)).flatMap(_ => CompatEither(Right("flower")))
|
||||
assert(flatmappedRight == CompatRight("flower"))
|
||||
val flatmappedLeft =
|
||||
@nowarn val flatmappedLeft =
|
||||
CompatEither(Left(12)).flatMap(_ => CompatEither(Left("21")))
|
||||
assert(flatmappedLeft == CompatLeft(12))
|
||||
|
||||
val foldedRight = CompatEither(Right(12)).fold({ _ =>
|
||||
"left"
|
||||
},
|
||||
{ _ =>
|
||||
"right"
|
||||
})
|
||||
@nowarn val foldedRight = CompatEither(Right(12)).fold({ _ =>
|
||||
"left"
|
||||
},
|
||||
{ _ =>
|
||||
"right"
|
||||
})
|
||||
assert(foldedRight == "right")
|
||||
val foldedLeft = CompatEither(Left(12)).fold({ _ =>
|
||||
"left"
|
||||
},
|
||||
{ _ =>
|
||||
"right"
|
||||
})
|
||||
@nowarn val foldedLeft = CompatEither(Left(12)).fold({ _ =>
|
||||
"left"
|
||||
},
|
||||
{ _ =>
|
||||
"right"
|
||||
})
|
||||
assert(foldedLeft == "left")
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.bitcoins.core.crypto
|
||||
|
||||
import org.bitcoins.testkit.util.BitcoinSUnitTest
|
||||
import org.bitcoins.testkit.core.gen.NumberGenerator
|
||||
import org.bitcoins.testkit.util.BitcoinSUnitTest
|
||||
|
||||
class ChainCodeTest extends BitcoinSUnitTest {
|
||||
behavior of "ChainCode"
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
package org.bitcoins.core.crypto
|
||||
|
||||
import org.bitcoins.testkit.core.gen.CryptoGenerators
|
||||
import org.bitcoins.core.number.UInt32
|
||||
import org.bitcoins.core.util.BitcoinSLogger
|
||||
import org.bitcoins.testkit.core.gen.CryptoGenerators
|
||||
import org.bitcoins.testkit.util.BitcoinSUnitTest
|
||||
import org.scalacheck.{Gen, Prop, Properties}
|
||||
import org.scalacheck.{Gen, Prop}
|
||||
|
||||
import scala.util.Success
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ class ExtKeyTest extends BitcoinSUnitTest {
|
|||
case (Success(_), Success(_)) => succeed
|
||||
case (Failure(exc1), Failure(exc2)) =>
|
||||
assert(exc1.getMessage == exc2.getMessage)
|
||||
case _: (Try[ExtPublicKey], Try[ExtPublicKey]) => fail
|
||||
case _: (Try[ExtPublicKey], Try[ExtPublicKey]) => fail()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ class ExtKeyTest extends BitcoinSUnitTest {
|
|||
forAll(CryptoGenerators.extPublicKey) { pub =>
|
||||
val attempt = ExtPrivateKey.fromStringT(pub.toString)
|
||||
attempt match {
|
||||
case Success(_) => fail
|
||||
case Success(_) => fail()
|
||||
case Failure(exc) => assert(exc.getMessage.contains("expected private"))
|
||||
}
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ class ExtKeyTest extends BitcoinSUnitTest {
|
|||
val pub = priv.extPublicKey
|
||||
val derivedPub = pub.deriveChildPubKey(child.toUInt32)
|
||||
derivedPub match {
|
||||
case Success(_) => fail
|
||||
case Success(_) => fail()
|
||||
case Failure(exc) => assert(exc.getMessage.contains("hardened"))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.bitcoins.core.crypto
|
||||
|
||||
import org.bitcoins.testkit.core.gen.{CryptoGenerators, HDGenerators}
|
||||
import org.bitcoins.testkit.util.{BitcoinSAsyncTest, BitcoinSUnitTest}
|
||||
import org.bitcoins.testkit.util.BitcoinSAsyncTest
|
||||
|
||||
class ExtSignTest extends BitcoinSAsyncTest {
|
||||
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
package org.bitcoins.core.crypto
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode
|
||||
import org.bitcoins.testkit.core.gen.CryptoGenerators
|
||||
import org.bitcoins.testkit.util.BitcoinSUnitTest
|
||||
import org.scalatest.Assertion
|
||||
import play.api.libs.json._
|
||||
import play.api.libs.json.jackson.JacksonJson
|
||||
import scodec.bits.{BinStringSyntax, BitVector, ByteVector}
|
||||
|
||||
import scala.io.Source
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
package org.bitcoins.core.crypto
|
||||
|
||||
import org.bitcoins.testkit.core.gen.TransactionGenerators
|
||||
import org.bitcoins.core.script.PreExecutionScriptProgram
|
||||
import org.bitcoins.core.script.interpreter.ScriptInterpreter
|
||||
import org.bitcoins.core.script.result._
|
||||
import org.bitcoins.core.util.BitcoinSLogger
|
||||
import org.bitcoins.testkit.core.gen.TransactionGenerators
|
||||
import org.scalacheck.{Prop, Properties}
|
||||
|
||||
/**
|
||||
|
@ -89,7 +89,7 @@ class TransactionSignatureCreatorSpec
|
|||
|
||||
property("generate a valid signature for a p2wpkh witness transaction") =
|
||||
Prop.forAllNoShrink(TransactionGenerators.signedP2WPKHTransaction) {
|
||||
case (wtxSigComponent, privKeys) =>
|
||||
case (wtxSigComponent, _) =>
|
||||
val program = PreExecutionScriptProgram(wtxSigComponent)
|
||||
val result = ScriptInterpreter.run(program)
|
||||
result == ScriptOk
|
||||
|
@ -98,7 +98,7 @@ class TransactionSignatureCreatorSpec
|
|||
property(
|
||||
"generate a valid signature for a p2wsh(old scriptPubkey tx) witness transaction") =
|
||||
Prop.forAllNoShrink(TransactionGenerators.signedP2WSHTransaction) {
|
||||
case (wtxSigComponent, privKeys) =>
|
||||
case (wtxSigComponent, _) =>
|
||||
val program = PreExecutionScriptProgram(wtxSigComponent)
|
||||
val result = ScriptInterpreter.run(program)
|
||||
Seq(ScriptErrorPushSize, ScriptOk).contains(result)
|
||||
|
@ -106,7 +106,7 @@ class TransactionSignatureCreatorSpec
|
|||
property(
|
||||
"generate a valid signature from a p2sh(p2wpkh) witness transaction") =
|
||||
Prop.forAllNoShrink(TransactionGenerators.signedP2SHP2WPKHTransaction) {
|
||||
case (wtxSigComponent, privKeys) =>
|
||||
case (wtxSigComponent, _) =>
|
||||
val program = PreExecutionScriptProgram(wtxSigComponent)
|
||||
val result = ScriptInterpreter.run(program)
|
||||
if (result != ScriptOk) logger.warn("Result: " + result)
|
||||
|
@ -116,7 +116,7 @@ class TransactionSignatureCreatorSpec
|
|||
property(
|
||||
"generate a valid signature from a p2sh(p2wsh) witness tranasction") =
|
||||
Prop.forAllNoShrink(TransactionGenerators.signedP2SHP2WSHTransaction) {
|
||||
case (wtxSigComponent, privKeys) =>
|
||||
case (wtxSigComponent, _) =>
|
||||
val program = PreExecutionScriptProgram(wtxSigComponent)
|
||||
val result = ScriptInterpreter.run(program)
|
||||
if (result != ScriptOk) logger.warn("Result: " + result)
|
||||
|
|
|
@ -21,6 +21,7 @@ import org.bitcoins.testkit.core.gen.{CreditingTxGen, ScriptGenerators}
|
|||
import org.bitcoins.testkit.util.{BitcoinSAsyncTest, TransactionTestUtil}
|
||||
import scodec.bits.ByteVector
|
||||
|
||||
import scala.annotation.nowarn
|
||||
import scala.concurrent.Future
|
||||
|
||||
/**
|
||||
|
@ -37,8 +38,9 @@ class TransactionSignatureCreatorTest extends BitcoinSAsyncTest {
|
|||
val rawTx =
|
||||
"01000000021d50bf7c05b6169ea8d8fb5b79dd2978bbd2ac756a656a777279da43b19fd9d9000000006b4830450221008f2c818a55045a1c9dcda54fcd5b6377f5d09723a9ccd8c71df76ee4bdf7c16802201817cbd71d8148a5d53b11d33c9c58ad1086fe7ddf308da2a7cceb7d85df293e01210381c82dc267a958be06f1c920dc635bcd191d698c167e67a45a882a551c57ce1dfeffffffd4a6a37abfe003a9d10155df215e662f88d5b878b908d1a3772a9fbd195d008d010000006a4730440220357864ae2beba3d6ec34c0ce42262c1c12939502f0f8f4bd338c9d8b307593420220656687c327589dc3e464700fa7b784c7efc2b465c627a60c2f1ce402d05fc39d0121036301d848aec3dfc47789a63ee3c85c6d3bf757162ef77cb1580981b422838ed7feffffff0200e1f505000000001976a9146d39bac171d0bf450698fa0ebd93f51e79dcb6ac88ac35a96d00000000001976a914e11753f499ac7a910148e53156ab273557ed517e88acd6090b00"
|
||||
val transaction = Transaction(rawTx)
|
||||
val prevTransaction = Transaction(
|
||||
/*val prevTransaction = Transaction(
|
||||
"01000000018b7dde71a52d40b9f3a03e604eceda72e26e9be2ce17a09ae540d15eddac6d36000000006a473044022069d7be9fcdbc846ff8b24fedf6aeabb1619e3087b4e18b2bb0f8dc174b5a29dc022033fbcb40a9e834ebb051f4a864e00de420ed14b954897280b5f7399971a14b6d012102f81ce897b559c07724a5a52a0e4650f2f43bbf1357f0c1e4c8c238899e9d7523feffffff02dc4c6d0a000000001976a914c23317eae4fcd12cbbae7784fbabbbb6448b4e3d88ac80969800000000001976a914d7b4717a934386601ac3f980d01b48c83b8a0b4b88acf0b60a00")
|
||||
*/
|
||||
val scriptPubKey =
|
||||
ScriptPubKey("1976a914d7b4717a934386601ac3f980d01b48c83b8a0b4b88ac")
|
||||
val txSignatureComponent =
|
||||
|
@ -65,8 +67,9 @@ class TransactionSignatureCreatorTest extends BitcoinSAsyncTest {
|
|||
val rawTx =
|
||||
"0100000001b8a1278696acfa85f1f576836aa30d335207b69bdaff43d9464cc1db40fe19ae000000006a473044022075b4ab08ff34799ee6f8048a5044be98dff493fc5a0b8a36dcaee3bd7a9993ae02207bc532ceab09c10f1d54035d03ff9aad0e1004c3e0325a8b97b6be04b7d6c3a2012102a01aaa27b468ec3fb2ae0c2a9fa1d5dce9b79b35062178f479156d8daa6c0e50feffffff02a0860100000000001976a914775bd9c79a9e988c0d6177a9205a611a50b7229188acb6342900000000001976a914f23a46f930320ab3cc7ad8c1660325f4c434d11688ac63b70d00"
|
||||
val transaction = Transaction(rawTx)
|
||||
val prevTransaction = Transaction(
|
||||
/*val prevTransaction = Transaction(
|
||||
"0100000001e4dbac0d73f4e3a9e99e70596a5f81b35a75f95b0474d051fbfd9dc249a5b67e000000006a4730440220486f112aee12997f6e484754d53d5c2158c18cc6d1d3f13aefcdf0ed19c47b290220136133d934d9e79a57408166c39fbce38e217ea9d417cabc20744134f04f06960121021f8cb5c3d611cf24dd665adff3fd540e4c155a05adaa6b672bfa7897c126d9b6feffffff0293d22a00000000001976a914cd0385f813ec73f8fc340b7069daf566878a0d6b88ac40420f000000000017a91480f7a6c14a8407da3546b4abfc3086876ca9a0668700000000")
|
||||
*/
|
||||
val scriptPubKey =
|
||||
ScriptPubKey("1976a914cd0385f813ec73f8fc340b7069daf566878a0d6b88ac")
|
||||
val txSignatureComponent =
|
||||
|
@ -117,6 +120,7 @@ class TransactionSignatureCreatorTest extends BitcoinSAsyncTest {
|
|||
}
|
||||
|
||||
it should "have old and new createSig functions agree" in {
|
||||
|
||||
forAllAsync(CreditingTxGen.inputsAndOutputs(),
|
||||
ScriptGenerators.scriptPubKey) {
|
||||
case ((creditingTxsInfo, destinations), (changeSPK, _)) =>
|
||||
|
@ -134,11 +138,12 @@ class TransactionSignatureCreatorTest extends BitcoinSAsyncTest {
|
|||
val txSignatureComponent =
|
||||
TxSigComponent(signInfo.inputInfo, spendingTx)
|
||||
|
||||
@nowarn val oldSigF =
|
||||
TransactionSignatureCreator.createSig(txSignatureComponent,
|
||||
signer.signFunction,
|
||||
signInfo.hashType)
|
||||
for {
|
||||
oldSig <-
|
||||
TransactionSignatureCreator.createSig(txSignatureComponent,
|
||||
signer.signFunction,
|
||||
signInfo.hashType)
|
||||
oldSig <- oldSigF
|
||||
newSig <-
|
||||
TransactionSignatureCreator.createSig(spendingTx,
|
||||
signInfo,
|
||||
|
@ -359,7 +364,7 @@ class TransactionSignatureCreatorTest extends BitcoinSAsyncTest {
|
|||
val sign: ByteVector => Future[ECDigitalSignature] = { bytes: ByteVector =>
|
||||
Future(privateKey.sign(bytes))
|
||||
}
|
||||
val txSignature =
|
||||
@nowarn val txSignature =
|
||||
TransactionSignatureCreator.createSig(txSignatureComponent,
|
||||
sign,
|
||||
HashType.sigHashAll)
|
||||
|
|
|
@ -8,7 +8,7 @@ import org.bitcoins.testkit.core.gen.{
|
|||
NumberGenerator
|
||||
}
|
||||
import org.bitcoins.testkit.util.BitcoinSUnitTest
|
||||
import org.scalacheck.{Gen, Shrink}
|
||||
import org.scalacheck.Gen
|
||||
import scodec.bits._
|
||||
|
||||
import scala.util.{Success, Try}
|
||||
|
@ -78,7 +78,7 @@ class BIP32PathTest extends BitcoinSUnitTest {
|
|||
it must "fail to parse a path beginning with the wrong character" in {
|
||||
forAll(HDGenerators.bip32Path, Gen.alphaChar.suchThat(_ != 'm')) {
|
||||
(path, char) =>
|
||||
val badPathString = char + path.toString.drop(1)
|
||||
val badPathString = char.toString + path.toString.drop(1)
|
||||
assertThrows[IllegalArgumentException](
|
||||
BIP32Path.fromString(badPathString))
|
||||
}
|
||||
|
@ -157,7 +157,6 @@ class BIP32PathTest extends BitcoinSUnitTest {
|
|||
}
|
||||
|
||||
it must "have fromString and toString symmetry" in {
|
||||
implicit val noShrink: Shrink[Nothing] = Shrink.shrinkAny
|
||||
forAll(HDGenerators.bip32Path) { path =>
|
||||
val toString = path.toString
|
||||
assert(path == BIP32Path.fromString(toString))
|
||||
|
@ -165,7 +164,6 @@ class BIP32PathTest extends BitcoinSUnitTest {
|
|||
}
|
||||
|
||||
it must "have fromBytes and bytes symmetry" in {
|
||||
implicit val noShrink: Shrink[Nothing] = Shrink.shrinkAny
|
||||
forAll(HDGenerators.bip32Path) { path =>
|
||||
val bytes = path.bytes
|
||||
assert(path == BIP32Path.fromBytes(bytes))
|
||||
|
|
|
@ -1,17 +1,11 @@
|
|||
package org.bitcoins.core.currency
|
||||
|
||||
import org.bitcoins.core.currency._
|
||||
import org.bitcoins.testkit.util.BitcoinSUnitTest
|
||||
import org.bitcoins.core.number.Int64
|
||||
import org.bitcoins.testkit.core.gen.CurrencyUnitGenerator
|
||||
import org.bitcoins.testkit.util.BitcoinSUnitTest
|
||||
import org.scalacheck.Gen
|
||||
|
||||
import scala.util.Try
|
||||
import org.bitcoins.core.number.Int64
|
||||
import org.bitcoins.crypto.CryptoUtil
|
||||
|
||||
import scala.util.Success
|
||||
import scala.util.Failure
|
||||
import org.scalacheck.Gen
|
||||
import org.scalacheck.Shrink
|
||||
|
||||
class CurrencyUnitTest extends BitcoinSUnitTest {
|
||||
|
||||
|
@ -59,7 +53,7 @@ class CurrencyUnitTest extends BitcoinSUnitTest {
|
|||
|
||||
it must "add satoshis" in {
|
||||
forAll(CurrencyUnitGenerator.satoshis, CurrencyUnitGenerator.satoshis) {
|
||||
(num1, num2) => (num1: Satoshis, num2: Satoshis) =>
|
||||
(_, _) => (num1: Satoshis, num2: Satoshis) =>
|
||||
val result: Try[Int64] = Try(Int64(num1.toBigInt + num2.toBigInt))
|
||||
if (
|
||||
result.isSuccess && result.get >= Int64(Satoshis.min.toLong) &&
|
||||
|
|
|
@ -4,13 +4,12 @@ import org.bitcoins.core.config.MainNet
|
|||
import org.bitcoins.core.crypto.{ExtKeyVersion, _}
|
||||
import org.bitcoins.core.protocol.Bech32Address
|
||||
import org.bitcoins.core.protocol.script.P2WPKHWitnessSPKV0
|
||||
import org.bitcoins.crypto.{ECPrivateKey, ECPublicKey}
|
||||
import org.bitcoins.testkit.core.gen.{HDGenerators, NumberGenerator}
|
||||
import org.bitcoins.testkit.util.BitcoinSUnitTest
|
||||
import scodec.bits._
|
||||
|
||||
import scala.util.{Failure, Success}
|
||||
import org.bitcoins.core.protocol.script.WitnessScriptPubKey
|
||||
import org.bitcoins.crypto.{ECPrivateKey, ECPublicKey}
|
||||
|
||||
class HDPathTest extends BitcoinSUnitTest {
|
||||
|
||||
|
@ -125,7 +124,7 @@ class HDPathTest extends BitcoinSUnitTest {
|
|||
attempt match {
|
||||
case None =>
|
||||
succeed
|
||||
case Some(_) => fail
|
||||
case Some(_) => fail()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -136,7 +135,7 @@ class HDPathTest extends BitcoinSUnitTest {
|
|||
val tooShortPath = hd.path.dropRight(1)
|
||||
val attempt = hdApply(tooShortPath)
|
||||
attempt match {
|
||||
case Success(_) => fail
|
||||
case Success(_) => fail()
|
||||
case Failure(exception) =>
|
||||
assert(exception.getMessage.contains("must have five elements"))
|
||||
}
|
||||
|
@ -155,7 +154,7 @@ class HDPathTest extends BitcoinSUnitTest {
|
|||
val badCoinAttempt = hdApply(nonHardenedCoinChildren)
|
||||
|
||||
badCoinAttempt match {
|
||||
case Success(_) => fail
|
||||
case Success(_) => fail()
|
||||
case Failure(exc) =>
|
||||
assert(exc.getMessage.contains("coin type child must be hardened"))
|
||||
}
|
||||
|
@ -169,7 +168,7 @@ class HDPathTest extends BitcoinSUnitTest {
|
|||
val badAccountAttempt = hdApply(nonHardenedAccountChildren)
|
||||
|
||||
badAccountAttempt match {
|
||||
case Success(_) => fail
|
||||
case Success(_) => fail()
|
||||
case Failure(exc) =>
|
||||
assert(exc.getMessage.contains("account child must be hardened"))
|
||||
}
|
||||
|
@ -183,7 +182,7 @@ class HDPathTest extends BitcoinSUnitTest {
|
|||
hdApply(hardenedChainChildren)
|
||||
|
||||
badChainAttempt match {
|
||||
case Success(_) => fail
|
||||
case Success(_) => fail()
|
||||
case Failure(exc) =>
|
||||
assert(exc.getMessage.contains("chain child must not be hardened"))
|
||||
}
|
||||
|
@ -197,7 +196,7 @@ class HDPathTest extends BitcoinSUnitTest {
|
|||
hdApply(hardenedAddressChildren)
|
||||
|
||||
badAddrAttempt match {
|
||||
case Success(_) => fail
|
||||
case Success(_) => fail()
|
||||
case Failure(exc) =>
|
||||
assert(
|
||||
exc.getMessage.contains(
|
||||
|
@ -395,8 +394,8 @@ class HDPathTest extends BitcoinSUnitTest {
|
|||
"KyZpNDKnfs94vbrwhJneDi77V6jF64PWPF8x5cdJb8ifgg2DUc9d")
|
||||
val expectedPub = ECPublicKey(
|
||||
hex"0330d54fd0dd420a6e5f8d3624f5f3482cae350f79d5f0753bf5beef9c2d91af3c")
|
||||
val expectedAddress = Bech32Address.fromStringExn(
|
||||
"bc1qcr8te4kr609gcawutmrza0j4xv80jy8z306fyu")
|
||||
val expectedAddress =
|
||||
Bech32Address.fromString("bc1qcr8te4kr609gcawutmrza0j4xv80jy8z306fyu")
|
||||
|
||||
assert(expectedPriv == derivedPriv)
|
||||
assert(expectedPub == derivedPub)
|
||||
|
@ -415,8 +414,8 @@ class HDPathTest extends BitcoinSUnitTest {
|
|||
"Kxpf5b8p3qX56DKEe5NqWbNUP9MnqoRFzZwHRtsFqhzuvUJsYZCy")
|
||||
val expectedPub = ECPublicKey(
|
||||
hex"03e775fd51f0dfb8cd865d9ff1cca2a158cf651fe997fdc9fee9c1d3b5e995ea77")
|
||||
val expectedAddress = Bech32Address.fromStringExn(
|
||||
"bc1qnjg0jd8228aq7egyzacy8cys3knf9xvrerkf9g")
|
||||
val expectedAddress =
|
||||
Bech32Address.fromString("bc1qnjg0jd8228aq7egyzacy8cys3knf9xvrerkf9g")
|
||||
|
||||
assert(expectedPriv == derivedPriv)
|
||||
assert(expectedPub == derivedPub)
|
||||
|
@ -435,8 +434,8 @@ class HDPathTest extends BitcoinSUnitTest {
|
|||
"KxuoxufJL5csa1Wieb2kp29VNdn92Us8CoaUG3aGtPtcF3AzeXvF")
|
||||
val expectedPub = ECPublicKey(
|
||||
hex"03025324888e429ab8e3dbaf1f7802648b9cd01e9b418485c5fa4c1b9b5700e1a6")
|
||||
val expectedAddress = Bech32Address.fromStringExn(
|
||||
"bc1q8c6fshw2dlwun7ekn9qwf37cu2rn755upcp6el")
|
||||
val expectedAddress =
|
||||
Bech32Address.fromString("bc1q8c6fshw2dlwun7ekn9qwf37cu2rn755upcp6el")
|
||||
|
||||
assert(expectedPriv == derivedPriv)
|
||||
assert(expectedPub == derivedPub)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.bitcoins.core.number
|
||||
|
||||
import org.bitcoins.testkit.core.gen.NumberGenerator
|
||||
import org.bitcoins.core.util.BitcoinSLogger
|
||||
import org.bitcoins.testkit.core.gen.NumberGenerator
|
||||
import org.scalacheck.{Gen, Prop, Properties}
|
||||
|
||||
import scala.util.Try
|
||||
|
|
|
@ -2,7 +2,6 @@ package org.bitcoins.core.number
|
|||
|
||||
import org.bitcoins.testkit.core.gen.NumberGenerator
|
||||
import org.bitcoins.testkit.util.BitcoinSUnitTest
|
||||
import org.slf4j.LoggerFactory
|
||||
|
||||
class UInt5Test extends BitcoinSUnitTest {
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.bitcoins.core.number
|
||||
|
||||
import org.bitcoins.testkit.core.gen.NumberGenerator
|
||||
import org.bitcoins.core.util.BitcoinSLogger
|
||||
import org.bitcoins.testkit.core.gen.NumberGenerator
|
||||
import org.scalacheck.{Gen, Prop, Properties}
|
||||
|
||||
import scala.util.Try
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.bitcoins.core.p2p
|
||||
|
||||
import org.bitcoins.testkit.util.BitcoinSUnitTest
|
||||
import org.bitcoins.testkit.core.gen.p2p.ControlMessageGenerator
|
||||
import org.bitcoins.testkit.util.BitcoinSUnitTest
|
||||
|
||||
class FeeFilterMessageTest extends BitcoinSUnitTest {
|
||||
it must "have serialization symmetry" in {
|
||||
|
|
|
@ -1,14 +1,11 @@
|
|||
package org.bitcoins.core.p2p
|
||||
|
||||
import org.bitcoins.core.bloom.{BloomFilter, BloomUpdateAll}
|
||||
import org.bitcoins.core.number.{UInt32, UInt64}
|
||||
import org.bitcoins.core.protocol.CompactSizeUInt
|
||||
import org.bitcoins.testkit.core.gen.p2p.ControlMessageGenerator
|
||||
import org.bitcoins.testkit.util.BitcoinSUnitTest
|
||||
import org.bitcoins.core.protocol.CompactSizeUInt
|
||||
import org.bitcoins.core.number.UInt64
|
||||
import scodec.bits._
|
||||
import org.bitcoins.core.number.UInt32
|
||||
import org.bitcoins.core.bloom.BloomUpdateAll
|
||||
import org.bitcoins.core.bloom.BloomFlag
|
||||
import org.bitcoins.core.bloom.BloomFilter
|
||||
|
||||
class FilterLoadMessageTest extends BitcoinSUnitTest {
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ package org.bitcoins.core.p2p
|
|||
import org.bitcoins.crypto.DoubleSha256Digest
|
||||
import org.bitcoins.testkit.core.gen.p2p.DataMessageGenerator
|
||||
import org.bitcoins.testkit.util.BitcoinSUnitTest
|
||||
import org.scalacheck.Gen
|
||||
|
||||
class GetDataMessageTest extends BitcoinSUnitTest {
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
package org.bitcoins.core.p2p
|
||||
|
||||
import org.bitcoins.crypto.DoubleSha256Digest
|
||||
import org.bitcoins.testkit.Implicits._
|
||||
import org.bitcoins.testkit.core.gen.CryptoGenerators
|
||||
import org.bitcoins.testkit.core.gen.p2p.DataMessageGenerator
|
||||
import org.bitcoins.testkit.util.BitcoinSUnitTest
|
||||
import org.bitcoins.testkit.core.gen.CryptoGenerators
|
||||
import org.bitcoins.testkit.Implicits._
|
||||
|
||||
class GetHeadersMessageTest extends BitcoinSUnitTest {
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@ import org.bitcoins.crypto.DoubleSha256Digest
|
|||
import org.bitcoins.testkit.core.gen.p2p.DataMessageGenerator
|
||||
import org.bitcoins.testkit.util.BitcoinSUnitTest
|
||||
import scodec.bits._
|
||||
import org.bitcoins.node.networking.P2PClient
|
||||
|
||||
class MerkleBlockMessageTest extends BitcoinSUnitTest {
|
||||
it must "have serialization symmetry" in {
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
package org.bitcoins.core.p2p
|
||||
|
||||
import org.bitcoins.core.config.TestNet3
|
||||
import org.bitcoins.core.config.{MainNet, TestNet3}
|
||||
import org.bitcoins.core.number.UInt32
|
||||
import org.bitcoins.testkit.node.NodeTestUtil
|
||||
import org.bitcoins.testkit.util.BitcoinSUnitTest
|
||||
import org.bitcoins.core.config.MainNet
|
||||
import org.bitcoins.core.util.BytesUtil
|
||||
import org.bitcoins.crypto.CryptoUtil
|
||||
import org.bitcoins.testkit.node.NodeTestUtil
|
||||
import org.bitcoins.testkit.util.BitcoinSUnitTest
|
||||
import scodec.bits.ByteVector
|
||||
|
||||
import scala.util.Random
|
||||
import scodec.bits.ByteVector
|
||||
|
||||
class NetworkHeaderTest extends BitcoinSUnitTest {
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.bitcoins.core.p2p
|
||||
|
||||
import org.bitcoins.testkit.util.BitcoinSUnitTest
|
||||
import org.bitcoins.testkit.core.gen.p2p.P2PGenerator
|
||||
import org.bitcoins.testkit.util.BitcoinSUnitTest
|
||||
|
||||
class NetworkIpAddressTest extends BitcoinSUnitTest {
|
||||
it must "have serialization symmetry" in {
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
package org.bitcoins.core.p2p
|
||||
|
||||
import org.bitcoins.core.config.{MainNet, TestNet3}
|
||||
import org.bitcoins.testkit.node.NodeTestUtil
|
||||
import org.bitcoins.testkit.util.{BitcoinSAsyncTest, BitcoinSUnitTest}
|
||||
import org.bitcoins.core.config.TestNet3
|
||||
import org.bitcoins.testkit.core.gen.p2p.P2PGenerator
|
||||
|
||||
import scala.concurrent.Future
|
||||
import org.bitcoins.testkit.node.NodeTestUtil
|
||||
import org.bitcoins.testkit.util.BitcoinSAsyncTest
|
||||
|
||||
class NetworkPayloadTest extends BitcoinSAsyncTest {
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.bitcoins.core.p2p
|
||||
|
||||
import org.bitcoins.testkit.util.BitcoinSUnitTest
|
||||
import org.bitcoins.testkit.core.gen.p2p.DataMessageGenerator
|
||||
import org.bitcoins.testkit.util.BitcoinSUnitTest
|
||||
|
||||
class NotFoundMessageTest extends BitcoinSUnitTest {
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.bitcoins.core.p2p
|
||||
|
||||
import org.bitcoins.testkit.util.BitcoinSUnitTest
|
||||
import org.bitcoins.testkit.core.gen.p2p.P2PGenerator
|
||||
import org.bitcoins.testkit.util.BitcoinSUnitTest
|
||||
|
||||
class ServiceIdentifierTest extends BitcoinSUnitTest {
|
||||
it must "have serialization symmetry" in {
|
||||
|
|
|
@ -40,7 +40,7 @@ class Bech32Spec extends Properties("Bech32Spec") {
|
|||
property("checksum must not work if we modify a char") = {
|
||||
Prop.forAll(AddressGenerator.bech32Address) { addr: Bech32Address =>
|
||||
val old = addr.value
|
||||
val rand = Math.abs(Random.nextInt)
|
||||
val rand = Math.abs(Random.nextInt())
|
||||
val idx = rand % old.length
|
||||
val (f, l) = old.splitAt(idx)
|
||||
val replacementChar = pickReplacementChar(l.head)
|
||||
|
@ -62,7 +62,7 @@ class Bech32Spec extends Properties("Bech32Spec") {
|
|||
|
||||
@tailrec
|
||||
private def pickReplacementChar(oldChar: Char): Char = {
|
||||
val rand = Math.abs(Random.nextInt)
|
||||
val rand = Math.abs(Random.nextInt())
|
||||
val newChar = Bech32.charset(rand % Bech32.charset.size)
|
||||
//make sure we don't pick the same char we are replacing in the bech32 address
|
||||
if (oldChar == newChar) pickReplacementChar(oldChar)
|
||||
|
@ -71,7 +71,7 @@ class Bech32Spec extends Properties("Bech32Spec") {
|
|||
|
||||
@tailrec
|
||||
private def switchCaseRandChar(addr: String): String = {
|
||||
val rand = Math.abs(Random.nextInt)
|
||||
val rand = Math.abs(Random.nextInt())
|
||||
val idx = rand % addr.length
|
||||
val (f, l) = addr.splitAt(idx)
|
||||
if (l.head.isDigit) {
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
package org.bitcoins.core.protocol
|
||||
|
||||
import org.bitcoins.core.config.TestNet3
|
||||
import org.bitcoins.core.protocol.script.P2SHScriptPubKey
|
||||
import org.bitcoins.crypto.CryptoUtil
|
||||
import org.bitcoins.testkit.core.gen.{
|
||||
AddressGenerator,
|
||||
CryptoGenerators,
|
||||
ScriptGenerators
|
||||
}
|
||||
import org.bitcoins.core.protocol.script.P2SHScriptPubKey
|
||||
import org.bitcoins.crypto.CryptoUtil
|
||||
import org.scalacheck.{Prop, Properties}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,13 +1,7 @@
|
|||
package org.bitcoins.core.protocol
|
||||
|
||||
import org.bitcoins.core.config.{MainNet, RegTest, TestNet3}
|
||||
import org.bitcoins.core.protocol.script.{
|
||||
EmptyScriptPubKey,
|
||||
P2PKHScriptPubKey,
|
||||
P2SHScriptPubKey,
|
||||
P2WPKHWitnessSPKV0,
|
||||
ScriptPubKey
|
||||
}
|
||||
import org.bitcoins.core.protocol.script._
|
||||
import org.bitcoins.crypto.{ECPublicKey, Sha256Hash160Digest}
|
||||
import org.bitcoins.testkit.util.BitcoinSUnitTest
|
||||
|
||||
|
@ -68,7 +62,7 @@ class BitcoinAddressTest extends BitcoinSUnitTest {
|
|||
|
||||
"The empty string" must "not be a valid bitcoin address" in {
|
||||
BitcoinAddress.fromStringT("").isFailure must be(true)
|
||||
Try(BitcoinAddress.fromStringExn("")).isFailure must be(true)
|
||||
Try(BitcoinAddress.fromString("")).isFailure must be(true)
|
||||
}
|
||||
|
||||
"A string that is 25 characters long" must "not be a valid bitcoin address" in {
|
||||
|
|
|
@ -6,8 +6,6 @@ import org.bitcoins.core.protocol.BlockStamp.{BlockHash, BlockHeight, BlockTime}
|
|||
import org.bitcoins.crypto.DoubleSha256DigestBE
|
||||
import org.bitcoins.testkit.util.BitcoinSUnitTest
|
||||
|
||||
import scala.util.Success
|
||||
|
||||
class BlockStampTest extends BitcoinSUnitTest {
|
||||
|
||||
it must "format and parse its string representation" in {
|
||||
|
|
|
@ -12,7 +12,7 @@ class BlockTest extends BitcoinSAsyncTest {
|
|||
|
||||
def timeBlockParsing[R](block: => R): Long = {
|
||||
val t0 = System.currentTimeMillis()
|
||||
val result = block // call-by-name
|
||||
val _ = block // call-by-name
|
||||
val t1 = System.currentTimeMillis()
|
||||
val time = t1 - t0
|
||||
logger.info("Elapsed time: " + time + "ms")
|
||||
|
|
|
@ -4,12 +4,12 @@ import java.math.BigInteger
|
|||
|
||||
import org.bitcoins.core.currency.Satoshis
|
||||
import org.bitcoins.core.protocol.script._
|
||||
import org.bitcoins.core.script.constant._
|
||||
import org.bitcoins.core.protocol.transaction.{
|
||||
CoinbaseInput,
|
||||
TransactionConstants,
|
||||
TransactionOutput
|
||||
}
|
||||
import org.bitcoins.core.script.constant._
|
||||
import org.bitcoins.core.util.BytesUtil
|
||||
import org.bitcoins.crypto.ECPublicKey
|
||||
import org.bitcoins.testkit.util.BitcoinSUnitTest
|
||||
|
|
|
@ -216,7 +216,7 @@ class MerkleBlockTests extends BitcoinSUnitTest {
|
|||
.insert(pubKey)
|
||||
.insert(output)
|
||||
|
||||
val (merkleBlock, loadedFilter) = MerkleBlock(block, filter)
|
||||
val (_, loadedFilter) = MerkleBlock(block, filter)
|
||||
|
||||
//this outpoint is matched because the scriptPubKey contstants match the filter
|
||||
val outPoint = TransactionOutPoint(
|
||||
|
@ -250,7 +250,7 @@ class MerkleBlockTests extends BitcoinSUnitTest {
|
|||
.insert(pubKey)
|
||||
.insert(output)
|
||||
|
||||
val (merkleBlock, loadedFilter) = MerkleBlock(block, filter)
|
||||
val (_, loadedFilter) = MerkleBlock(block, filter)
|
||||
|
||||
//neither of these outpoints match because the BloomUpdateNone flag is set
|
||||
val outPoint = TransactionOutPoint(
|
||||
|
|
|
@ -18,14 +18,7 @@ import org.bitcoins.core.protocol.ln.node.NodeId
|
|||
import org.bitcoins.core.protocol.ln.routing.LnRoute
|
||||
import org.bitcoins.core.protocol.{Bech32Address, P2PKHAddress, P2SHAddress}
|
||||
import org.bitcoins.core.util.Bech32
|
||||
import org.bitcoins.crypto.{
|
||||
CryptoUtil,
|
||||
ECDigitalSignature,
|
||||
ECPrivateKey,
|
||||
ECPublicKey,
|
||||
EmptyDigitalSignature,
|
||||
Sha256Digest
|
||||
}
|
||||
import org.bitcoins.crypto._
|
||||
import org.bitcoins.testkit.core.gen.ln.LnInvoiceGen
|
||||
import org.bitcoins.testkit.util.BitcoinSUnitTest
|
||||
import scodec.bits.ByteVector
|
||||
|
@ -69,8 +62,8 @@ class LnInvoiceUnitTest extends BitcoinSUnitTest {
|
|||
|
||||
val sigData =
|
||||
"6c6e62630b25fe64410d00004080c1014181c20240004080c1014181c20240004080c1014181c202404081a1fa83632b0b9b29031b7b739b4b232b91039bab83837b93a34b733903a3434b990383937b532b1ba0"
|
||||
val hashSigData = Sha256Digest.fromHex(
|
||||
"c3d4e83f646fa79a393d75277b1d858db1d1f7ab7137dcb7835db2ecd518e1c9")
|
||||
/* val hashSigData = Sha256Digest.fromHex(
|
||||
"c3d4e83f646fa79a393d75277b1d858db1d1f7ab7137dcb7835db2ecd518e1c9")*/
|
||||
|
||||
val signature = ECDigitalSignature.fromRS(
|
||||
"38ec6891345e204145be8a3a99de38e98a39d6a569434e1845c8af7205afcfcc7f425fcd1463e93c32881ead0d6e356d467ec8c02553f9aab15e5738b11f127f")
|
||||
|
@ -403,6 +396,7 @@ class LnInvoiceUnitTest extends BitcoinSUnitTest {
|
|||
// TODO uncomment when https://github.com/bitcoin-s/bitcoin-s/issues/1064 is fixed
|
||||
// serialized must be(expected)
|
||||
|
||||
assert(serialized == expected)
|
||||
val deserialized = LnInvoice.fromStringT(serialized)
|
||||
|
||||
deserialized.get.toString must be(serialized)
|
||||
|
@ -549,6 +543,7 @@ class LnInvoiceUnitTest extends BitcoinSUnitTest {
|
|||
val i = LnInvoice.fromStringT(str).get
|
||||
i.toString must be(str)
|
||||
i.nodeId must be(NodeId.fromHex(nodeId))
|
||||
()
|
||||
}
|
||||
testInvoice(
|
||||
"lnbcrt500p1p0zk8umpp5wyc4s0h4jtu5lapsr4p2nevlpck7l5xec6rpjdv2a7r992vx0ctqdq9vehk7xqrrssfs6t6nyfutf4j8wzq6mf82lxefj5zadvw8fnjw6ev38y4578734zl94jfwnsfqdyt67da7g8shvhej0rkysymy260xyjtdv2dvhmvmgpdg6qjw",
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package org.bitcoins.core.protocol.ln
|
||||
|
||||
import org.bitcoins.testkit.core.gen.NumberGenerator
|
||||
import org.bitcoins.core.number.{UInt5, UInt64}
|
||||
import org.bitcoins.core.protocol.ln.util.LnUtil
|
||||
import org.bitcoins.testkit.core.gen.NumberGenerator
|
||||
import org.bitcoins.testkit.util.BitcoinSUnitTest
|
||||
|
||||
class LnUtilTest extends BitcoinSUnitTest {
|
||||
|
|
|
@ -1,15 +1,12 @@
|
|||
package org.bitcoins.core.protocol.ln.currency
|
||||
|
||||
import org.bitcoins.core.protocol.ln.currency._
|
||||
import org.bitcoins.core.currency.Satoshis
|
||||
import org.bitcoins.core.protocol.ln.LnPolicy
|
||||
import org.bitcoins.testkit.util.BitcoinSUnitTest
|
||||
import org.bitcoins.testkit.core.gen.ln.LnCurrencyUnitGen
|
||||
import scala.util.Success
|
||||
import scala.util.Failure
|
||||
import scala.util.Try
|
||||
import org.bitcoins.testkit.util.BitcoinSUnitTest
|
||||
import org.scalacheck.Gen
|
||||
import org.bitcoins.core.number.Int64
|
||||
|
||||
import scala.util.{Failure, Success, Try}
|
||||
|
||||
class LnCurrencyUnitTest extends BitcoinSUnitTest {
|
||||
|
||||
|
@ -28,7 +25,7 @@ class LnCurrencyUnitTest extends BitcoinSUnitTest {
|
|||
assert(PicoBitcoins.min <= result)
|
||||
assert(result <= PicoBitcoins.max)
|
||||
assert(num1 + num2 == result)
|
||||
case Failure(exc) => succeed
|
||||
case Failure(_) => succeed
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -48,7 +45,7 @@ class LnCurrencyUnitTest extends BitcoinSUnitTest {
|
|||
assert(PicoBitcoins.min <= result)
|
||||
assert(result <= PicoBitcoins.max)
|
||||
assert(num1 - num2 == result)
|
||||
case Failure(exc) => succeed
|
||||
case Failure(_) => succeed
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -74,7 +71,7 @@ class LnCurrencyUnitTest extends BitcoinSUnitTest {
|
|||
assert(result >= PicoBitcoins.min)
|
||||
assert(result <= PicoBitcoins.max)
|
||||
assert(num1 * num2 == result)
|
||||
case Failure(exc) => succeed
|
||||
case Failure(_) => succeed
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.bitcoins.core.protocol.script
|
||||
|
||||
import org.bitcoins.testkit.core.gen.CryptoGenerators
|
||||
import org.bitcoins.testkit.Implicits._
|
||||
import org.bitcoins.testkit.core.gen.CryptoGenerators
|
||||
import org.bitcoins.testkit.util.BitcoinSUnitTest
|
||||
|
||||
class P2PKHScriptPubKeyTest extends BitcoinSUnitTest {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.bitcoins.core.protocol.script
|
||||
|
||||
import org.bitcoins.testkit.core.gen.ScriptGenerators
|
||||
import org.bitcoins.core.util.BitcoinSLogger
|
||||
import org.bitcoins.testkit.core.gen.ScriptGenerators
|
||||
import org.scalacheck.{Prop, Properties}
|
||||
|
||||
/**
|
||||
|
|
|
@ -17,7 +17,7 @@ class P2SHScriptSignatureSpec extends Properties("P2SHScriptSignatureSpec") {
|
|||
property(
|
||||
"place a witness scriptPubKey in a p2shScriptSig, then extract the witScriptPubKey again") =
|
||||
Prop.forAll(ScriptGenerators.witnessScriptPubKeyV0) {
|
||||
case (witScriptPubKey, privKeys) =>
|
||||
case (witScriptPubKey, _) =>
|
||||
val p2shScriptSig = P2SHScriptSignature(witScriptPubKey)
|
||||
p2shScriptSig.redeemScript == witScriptPubKey
|
||||
p2shScriptSig.scriptSignatureNoRedeemScript == EmptyScriptSignature
|
||||
|
|
|
@ -5,7 +5,6 @@ import org.bitcoins.core.script.constant.{
|
|||
OP_0,
|
||||
ScriptConstant
|
||||
}
|
||||
import org.bitcoins.core.util.BitcoinSLogger
|
||||
import org.bitcoins.crypto.ECPublicKey
|
||||
import org.bitcoins.testkit.util.{BitcoinSAsyncTest, TestUtil}
|
||||
|
||||
|
|
|
@ -27,8 +27,8 @@ class ScriptPubKeyFactoryTest extends BitcoinSUnitTest {
|
|||
val rawScriptPubKey = TestUtil.rawP2PKScriptPubKey
|
||||
val scriptPubKey = ScriptPubKey(rawScriptPubKey)
|
||||
val result = scriptPubKey match {
|
||||
case script: P2PKScriptPubKey => true
|
||||
case _ => false
|
||||
case _: P2PKScriptPubKey => true
|
||||
case _ => false
|
||||
}
|
||||
result must be(true)
|
||||
|
||||
|
@ -39,7 +39,7 @@ class ScriptPubKeyFactoryTest extends BitcoinSUnitTest {
|
|||
"695221025878e270211662a27181cf4d6ad4d2cf0e69a98a3815c086f587c7e9388d87182103fc85980e3fac1f3d8a5c3223c3ef5bffc1bd42d2cc42add8c3899cc66e7f1906210215b5bd050869166a70a7341b4f216e268b7c6c7504576dcea2cce7d11cc9a35f53af"
|
||||
val scriptPubKey = ScriptPubKey(multiSigRawScriptPubKeyHex)
|
||||
val isMultiSigScriptPubKey: Boolean = scriptPubKey match {
|
||||
case s: MultiSignatureScriptPubKey => true
|
||||
case _: MultiSignatureScriptPubKey => true
|
||||
case _ => false
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ class ScriptSignatureFactoryTest extends BitcoinSUnitTest {
|
|||
val rawScriptSig = TestUtil.rawP2PKScriptSig
|
||||
val scriptSig = ScriptSignature(rawScriptSig)
|
||||
val result = scriptSig match {
|
||||
case s: P2PKScriptSignature => true
|
||||
case _: P2PKScriptSignature => true
|
||||
case _ => false
|
||||
}
|
||||
result must be(true)
|
||||
|
@ -47,7 +47,7 @@ class ScriptSignatureFactoryTest extends BitcoinSUnitTest {
|
|||
|
||||
it must "parse a p2sh scriptSignature from a raw scriptSig" in {
|
||||
val result = TestUtil.p2shInputScript2Of2 match {
|
||||
case s: P2SHScriptSignature => true
|
||||
case _: P2SHScriptSignature => true
|
||||
case y => throw new RuntimeException("Should be p2sh input: " + y)
|
||||
}
|
||||
result must be(true)
|
||||
|
|
|
@ -13,7 +13,7 @@ import org.bitcoins.core.protocol.transaction.{
|
|||
}
|
||||
import org.bitcoins.core.script.crypto.{HashType, SIGHASH_ALL}
|
||||
import org.bitcoins.core.serializers.script.RawScriptSignatureParser
|
||||
import org.bitcoins.core.util.{BitcoinSLogger, BytesUtil}
|
||||
import org.bitcoins.core.util.BytesUtil
|
||||
import org.bitcoins.crypto.{DoubleSha256Digest, ECDigitalSignature}
|
||||
import org.bitcoins.testkit.util.{BitcoinSAsyncTest, TestUtil}
|
||||
import scodec.bits.ByteVector
|
||||
|
@ -137,7 +137,7 @@ class ScriptSignatureTest extends BitcoinSAsyncTest {
|
|||
|
||||
val source = Source.fromURL(this.getClass.getResource("/sighash.json"))
|
||||
val lines =
|
||||
try source.getLines.filterNot(_.isEmpty).map(_.trim).mkString("\n")
|
||||
try source.getLines().filterNot(_.isEmpty).map(_.trim).mkString("\n")
|
||||
finally source.close()
|
||||
val testCases: Seq[SignatureHashTestCase] =
|
||||
lines.parseJson.convertTo[Seq[SignatureHashTestCase]]
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.bitcoins.core.protocol.script
|
||||
|
||||
import org.bitcoins.testkit.core.gen.{ScriptGenerators, WitnessGenerators}
|
||||
import org.bitcoins.core.util.BitcoinSLogger
|
||||
import org.bitcoins.testkit.core.gen.{ScriptGenerators, WitnessGenerators}
|
||||
import org.scalacheck.{Prop, Properties}
|
||||
|
||||
class ScriptWitnessSpec
|
||||
|
|
|
@ -6,14 +6,12 @@ import org.bitcoins.core.protocol.transaction.Transaction
|
|||
import org.bitcoins.core.script.crypto.HashType
|
||||
import org.bitcoins.core.serializers.script.ScriptParser
|
||||
import org.bitcoins.crypto.DoubleSha256Digest
|
||||
import org.slf4j.LoggerFactory
|
||||
import spray.json._
|
||||
|
||||
/**
|
||||
* Created by tom on 7/21/16.
|
||||
*/
|
||||
object SignatureHashTestCaseProtocol extends DefaultJsonProtocol {
|
||||
private val logger = LoggerFactory.getLogger(this.getClass)
|
||||
|
||||
implicit object SignatureTestCaseProtocol
|
||||
extends RootJsonFormat[SignatureHashTestCase] {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.bitcoins.core.protocol.transaction
|
||||
|
||||
import org.bitcoins.testkit.core.gen.TransactionGenerators
|
||||
import org.bitcoins.core.util.BitcoinSLogger
|
||||
import org.bitcoins.testkit.core.gen.TransactionGenerators
|
||||
import org.scalacheck.{Prop, Properties}
|
||||
|
||||
/**
|
||||
|
|
|
@ -168,7 +168,7 @@ class TransactionTest extends BitcoinSUnitTest {
|
|||
|""".stripMargin*/
|
||||
|
||||
val lines =
|
||||
try source.getLines.filterNot(_.isEmpty).map(_.trim) mkString "\n"
|
||||
try source.getLines().filterNot(_.isEmpty).map(_.trim) mkString "\n"
|
||||
finally source.close()
|
||||
val json = lines.parseJson
|
||||
val testCasesOpt: Seq[Option[CoreTransactionTestCase]] =
|
||||
|
@ -252,7 +252,7 @@ class TransactionTest extends BitcoinSUnitTest {
|
|||
|[[[["0000000000000000000000000000000000000000000000000000000000000000",-1,"1"]], "01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff0151ffffffff010000000000000000015100000000", "P2SH"]]
|
||||
""".stripMargin*/
|
||||
val lines =
|
||||
try source.getLines.filterNot(_.isEmpty).map(_.trim) mkString "\n"
|
||||
try source.getLines().filterNot(_.isEmpty).map(_.trim) mkString "\n"
|
||||
finally source.close()
|
||||
val json = lines.parseJson
|
||||
val testCasesOpt: Seq[Option[CoreTransactionTestCase]] =
|
||||
|
@ -272,7 +272,7 @@ class TransactionTest extends BitcoinSUnitTest {
|
|||
val txSigComponent = amountOpt match {
|
||||
case Some(amount) =>
|
||||
scriptPubKey match {
|
||||
case p2sh: P2SHScriptPubKey =>
|
||||
case _: P2SHScriptPubKey =>
|
||||
tx match {
|
||||
case btx: NonWitnessTransaction =>
|
||||
BaseTxSigComponent(
|
||||
|
@ -345,7 +345,7 @@ class TransactionTest extends BitcoinSUnitTest {
|
|||
tx: Transaction,
|
||||
outPoint: TransactionOutPoint): Option[(TransactionInput, Int)] = {
|
||||
tx.inputs.zipWithIndex.find {
|
||||
case (input, index) => input.previousOutput == outPoint
|
||||
case (input, _) => input.previousOutput == outPoint
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.bitcoins.core.protocol.transaction.testprotocol
|
||||
|
||||
import org.bitcoins.core.currency.{CurrencyUnit, Satoshis}
|
||||
import org.bitcoins.core.number.{Int64, UInt32}
|
||||
import org.bitcoins.core.number.UInt32
|
||||
import org.bitcoins.core.protocol.script.ScriptPubKey
|
||||
import org.bitcoins.core.protocol.transaction.{Transaction, TransactionOutPoint}
|
||||
import org.bitcoins.core.script.constant.ScriptToken
|
||||
|
|
|
@ -63,7 +63,7 @@ class ScriptProgramFactoryTest extends BitcoinSUnitTest {
|
|||
inputIndex = UInt32.zero,
|
||||
output = TransactionOutput(CurrencyUnits.zero, TestUtil.scriptPubKey),
|
||||
ScriptFlagFactory.empty)
|
||||
val program = PreExecutionScriptProgram(t)
|
||||
|
||||
val inProgress =
|
||||
ExecutionInProgressScriptProgram(
|
||||
txSignatureComponent = t,
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package org.bitcoins.core.script.arithmetic
|
||||
|
||||
import org.bitcoins.core.script.constant._
|
||||
import org.bitcoins.core.script.flag.ScriptFlag
|
||||
import org.bitcoins.core.script.result._
|
||||
import org.bitcoins.core.script.{
|
||||
ExecutedScriptProgram,
|
||||
|
@ -245,11 +244,6 @@ class ArithmeticInterpreterTest extends BitcoinSUnitTest {
|
|||
newProgram.stack.head must be(OP_FALSE)
|
||||
newProgram.script.isEmpty must be(true)
|
||||
|
||||
val stack1 = List(OP_0, OP_0)
|
||||
val script1 = List(OP_BOOLAND)
|
||||
val program1 =
|
||||
TestUtil.testProgramExecutionInProgress.updateStackAndScript(stack,
|
||||
script)
|
||||
val newProgram1 = AI.opBoolAnd(program)
|
||||
|
||||
newProgram.stackTopIsFalse must be(true)
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package org.bitcoins.core.script.bitwise
|
||||
|
||||
import org.bitcoins.core.script.ExecutedScriptProgram
|
||||
import org.bitcoins.core.script.constant._
|
||||
import org.bitcoins.core.script.result.ScriptErrorInvalidStackOperation
|
||||
import org.bitcoins.core.script.ExecutedScriptProgram
|
||||
import org.bitcoins.testkit.util.{BitcoinSUnitTest, TestUtil}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
package org.bitcoins.core.script.control
|
||||
|
||||
import org.bitcoins.core.script.{
|
||||
ExecutedScriptProgram,
|
||||
ExecutionInProgressScriptProgram,
|
||||
StartedScriptProgram
|
||||
}
|
||||
import org.bitcoins.core.script.arithmetic.OP_ADD
|
||||
import org.bitcoins.core.script.bitwise.OP_EQUAL
|
||||
import org.bitcoins.core.script.constant._
|
||||
|
@ -13,6 +8,11 @@ import org.bitcoins.core.script.result.{
|
|||
ScriptErrorInvalidStackOperation,
|
||||
ScriptErrorOpReturn
|
||||
}
|
||||
import org.bitcoins.core.script.{
|
||||
ExecutedScriptProgram,
|
||||
ExecutionInProgressScriptProgram,
|
||||
StartedScriptProgram
|
||||
}
|
||||
import org.bitcoins.core.serializers.script.ScriptParser
|
||||
import org.bitcoins.core.util._
|
||||
import org.bitcoins.testkit.util.{BitcoinSAsyncTest, TestUtil}
|
||||
|
|
|
@ -9,7 +9,7 @@ import org.bitcoins.core.script._
|
|||
import org.bitcoins.core.script.constant._
|
||||
import org.bitcoins.core.script.flag.{ScriptVerifyDerSig, ScriptVerifyNullDummy}
|
||||
import org.bitcoins.core.script.result._
|
||||
import org.bitcoins.core.util.{BitcoinSLogger, ScriptProgramTestUtil}
|
||||
import org.bitcoins.core.util.ScriptProgramTestUtil
|
||||
import org.bitcoins.testkit.util.{BitcoinSAsyncTest, TestUtil}
|
||||
|
||||
import scala.util.Try
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.bitcoins.core.script.crypto
|
||||
|
||||
import org.bitcoins.testkit.core.gen.NumberGenerator
|
||||
import org.bitcoins.core.util.BitcoinSLogger
|
||||
import org.bitcoins.testkit.core.gen.NumberGenerator
|
||||
import org.scalacheck.{Prop, Properties}
|
||||
|
||||
class HashTypeSpec extends Properties("HashTypeSpec") with BitcoinSLogger {
|
||||
|
|
|
@ -37,7 +37,7 @@ class ScriptInterpreterTest extends BitcoinSUnitTest {
|
|||
| [["0x01 0x80", "DUP BOOLOR", "P2SH,STRICTENC", "EVAL_FALSE", "negative-0 negative-0 BOOLOR"]]
|
||||
""".stripMargin*/
|
||||
val lines =
|
||||
try source.getLines.filterNot(_.isEmpty).map(_.trim) mkString "\n"
|
||||
try source.getLines().filterNot(_.isEmpty).map(_.trim) mkString "\n"
|
||||
finally source.close()
|
||||
val json = lines.parseJson
|
||||
val testCasesOpt: Seq[Option[CoreTestCase]] =
|
||||
|
@ -59,7 +59,7 @@ class ScriptInterpreterTest extends BitcoinSUnitTest {
|
|||
val flags = ScriptFlagFactory.fromList(testCase.flags)
|
||||
val witness = testCase.witness
|
||||
val txSigComponent = witness match {
|
||||
case Some((w, amount)) =>
|
||||
case Some((_, amount)) =>
|
||||
scriptPubKey match {
|
||||
case p2sh: P2SHScriptPubKey =>
|
||||
val output = TransactionOutput(amount, p2sh)
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package org.bitcoins.core.script.interpreter.testprotocol
|
||||
|
||||
import org.bitcoins.core.currency.Satoshis
|
||||
import org.bitcoins.core.number.Int64
|
||||
import org.bitcoins.core.protocol.CompactSizeUInt
|
||||
import org.bitcoins.core.protocol.script._
|
||||
import org.bitcoins.core.script.result.ScriptResult
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package org.bitcoins.core.script.splice
|
||||
|
||||
import org.bitcoins.core.script.ExecutedScriptProgram
|
||||
import org.bitcoins.core.script.constant._
|
||||
import org.bitcoins.core.script.result.ScriptErrorInvalidStackOperation
|
||||
import org.bitcoins.core.script.ExecutedScriptProgram
|
||||
import org.bitcoins.testkit.util.{BitcoinSUnitTest, TestUtil}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package org.bitcoins.core.script.stack
|
||||
|
||||
import org.bitcoins.core.script.ExecutedScriptProgram
|
||||
import org.bitcoins.core.script.constant._
|
||||
import org.bitcoins.core.script.result._
|
||||
import org.bitcoins.core.script.ExecutedScriptProgram
|
||||
import org.bitcoins.core.util.{BytesUtil, ScriptProgramTestUtil}
|
||||
import org.bitcoins.testkit.util.{BitcoinSUnitTest, TestUtil}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.bitcoins.core.serializers
|
||||
|
||||
import org.bitcoins.testkit.core.gen.TransactionGenerators
|
||||
import org.bitcoins.core.protocol.transaction.TransactionOutput
|
||||
import org.bitcoins.testkit.core.gen.TransactionGenerators
|
||||
import org.scalacheck.{Prop, Properties}
|
||||
import scodec.bits.ByteVector
|
||||
|
||||
|
|
|
@ -18,30 +18,30 @@ class RawMerkleBlockSerializerTest extends BitcoinSUnitTest {
|
|||
|
||||
"RawMerkleBlockSerializer" must "serialize a merkle block generated inside of scalacheck" in {
|
||||
|
||||
val (merkleBlock, txIds) = (MerkleBlock(
|
||||
BlockHeader(
|
||||
Int32(49150652),
|
||||
DoubleSha256Digest(
|
||||
"6cf34aac6e3de2bf4b429d114ed4572a7ce4b1c44f2091ae6825ee9774dbae2f"),
|
||||
DoubleSha256Digest(
|
||||
"4487def8ba376b38c1e4e5910d3c9efd27e740cb9be8d452598cbf2e243fad8a"),
|
||||
UInt32(2941790316L),
|
||||
UInt32(1626267458),
|
||||
UInt32(1688549344)
|
||||
),
|
||||
UInt32(1),
|
||||
PartialMerkleTree(
|
||||
Leaf(DoubleSha256Digest(
|
||||
"442abdc8e74ad35ebd9571f88fda91ff511dcda8d241a5aed52cea1e00d69e03")),
|
||||
UInt32(1),
|
||||
BitVector.bits(
|
||||
Vector(false, false, false, false, false,
|
||||
false, false, false)),
|
||||
List(DoubleSha256Digest(
|
||||
"442abdc8e74ad35ebd9571f88fda91ff511dcda8d241a5aed52cea1e00d69e03"))
|
||||
)
|
||||
),
|
||||
List())
|
||||
val (merkleBlock, _) = (MerkleBlock(
|
||||
BlockHeader(
|
||||
Int32(49150652),
|
||||
DoubleSha256Digest(
|
||||
"6cf34aac6e3de2bf4b429d114ed4572a7ce4b1c44f2091ae6825ee9774dbae2f"),
|
||||
DoubleSha256Digest(
|
||||
"4487def8ba376b38c1e4e5910d3c9efd27e740cb9be8d452598cbf2e243fad8a"),
|
||||
UInt32(2941790316L),
|
||||
UInt32(1626267458),
|
||||
UInt32(1688549344)
|
||||
),
|
||||
UInt32(1),
|
||||
PartialMerkleTree(
|
||||
Leaf(DoubleSha256Digest(
|
||||
"442abdc8e74ad35ebd9571f88fda91ff511dcda8d241a5aed52cea1e00d69e03")),
|
||||
UInt32(1),
|
||||
BitVector.bits(
|
||||
Vector(false, false, false, false, false,
|
||||
false, false, false)),
|
||||
List(DoubleSha256Digest(
|
||||
"442abdc8e74ad35ebd9571f88fda91ff511dcda8d241a5aed52cea1e00d69e03"))
|
||||
)
|
||||
),
|
||||
List())
|
||||
|
||||
val hex =
|
||||
"bcfaed026cf34aac6e3de2bf4b429d114ed4572a7ce4b1c44f2091ae6825ee9774dbae2f4487def8ba376b38c1e4e5910d3c9efd27e740cb9be8d452598cbf2e243fad8a6c2858af42dfee60e037a5640100000001442abdc8e74ad35ebd9571f88fda91ff511dcda8d241a5aed52cea1e00d69e030100"
|
||||
|
@ -50,70 +50,70 @@ class RawMerkleBlockSerializerTest extends BitcoinSUnitTest {
|
|||
}
|
||||
|
||||
it must "not have any extra hashes left over when deserializing a previously valid partial merkle tree" in {
|
||||
val (merkleBlock, txIds) = (MerkleBlock(
|
||||
BlockHeader(
|
||||
Int32(1626792925),
|
||||
val (merkleBlock, _) = (MerkleBlock(
|
||||
BlockHeader(
|
||||
Int32(1626792925),
|
||||
DoubleSha256Digest(
|
||||
"de2fc5fac498126f27c8adaa17aa86a1ef15d2b0adf5f2d2c056495bec17153f"),
|
||||
DoubleSha256Digest(
|
||||
"f27404d701b9047cfcaa8d8454d2ecc12f4aa3e900ba8e5945bbb9289d67dd63"),
|
||||
UInt32(3098237133L),
|
||||
UInt32(359220269),
|
||||
UInt32(590323230)
|
||||
),
|
||||
UInt32(6),
|
||||
PartialMerkleTree(
|
||||
Node(
|
||||
DoubleSha256Digest(
|
||||
"ed4f3665c72229886e4bdae876233892f8a7b85e5cee93da56be71d9056f6654"),
|
||||
Node(
|
||||
DoubleSha256Digest(
|
||||
"de2fc5fac498126f27c8adaa17aa86a1ef15d2b0adf5f2d2c056495bec17153f"),
|
||||
DoubleSha256Digest(
|
||||
"f27404d701b9047cfcaa8d8454d2ecc12f4aa3e900ba8e5945bbb9289d67dd63"),
|
||||
UInt32(3098237133L),
|
||||
UInt32(359220269),
|
||||
UInt32(590323230)
|
||||
),
|
||||
UInt32(6),
|
||||
PartialMerkleTree(
|
||||
"2dc060204deff176f6e366319777d4db76546c17c07f23ebeece4bf0e66fd686"),
|
||||
Node(
|
||||
DoubleSha256Digest(
|
||||
"ed4f3665c72229886e4bdae876233892f8a7b85e5cee93da56be71d9056f6654"),
|
||||
Node(
|
||||
DoubleSha256Digest(
|
||||
"2dc060204deff176f6e366319777d4db76546c17c07f23ebeece4bf0e66fd686"),
|
||||
Node(
|
||||
DoubleSha256Digest(
|
||||
"8023ea73c6c1e643d1604585abbfd997308a5759baa4d2d4a2ee876d71a5780f"),
|
||||
Leaf(DoubleSha256Digest(
|
||||
"e4aeaf729035a7fb939e12c4f6a2072a9b2e7da784207ce7852d398593210a45")),
|
||||
Leaf(DoubleSha256Digest(
|
||||
"010506d2103d0feb477224926eedaf3d7478fe3d93b54bd24e5eb2c0adc309b3"))
|
||||
),
|
||||
Node(
|
||||
DoubleSha256Digest(
|
||||
"79a03d2d9f1c5c97772974c9ef9297e6e2bce0271ca95d40bb598c6156c3d6e0"),
|
||||
Leaf(DoubleSha256Digest(
|
||||
"77352045b2995c9e0dfff9089e5563cd13914eb4b0723cdd54675c5c3f1c4f6a")),
|
||||
Leaf(DoubleSha256Digest(
|
||||
"7ae10c30932c07e4ed25abab233565f9ab279eabbcd60e1bc028c6cdc400361b"))
|
||||
)
|
||||
),
|
||||
"8023ea73c6c1e643d1604585abbfd997308a5759baa4d2d4a2ee876d71a5780f"),
|
||||
Leaf(DoubleSha256Digest(
|
||||
"8ca2e6b66c55fbb63cb7c9b5ccd19be508034eedcd8511d216b9fe93aafc2ceb"))
|
||||
"e4aeaf729035a7fb939e12c4f6a2072a9b2e7da784207ce7852d398593210a45")),
|
||||
Leaf(DoubleSha256Digest(
|
||||
"010506d2103d0feb477224926eedaf3d7478fe3d93b54bd24e5eb2c0adc309b3"))
|
||||
),
|
||||
UInt32(6),
|
||||
BitVector.bits(
|
||||
List(true, true, true, false, true, true,
|
||||
false, true, false, false, false, false,
|
||||
false, false, false, false)),
|
||||
List(
|
||||
Node(
|
||||
DoubleSha256Digest(
|
||||
"e4aeaf729035a7fb939e12c4f6a2072a9b2e7da784207ce7852d398593210a45"),
|
||||
DoubleSha256Digest(
|
||||
"010506d2103d0feb477224926eedaf3d7478fe3d93b54bd24e5eb2c0adc309b3"),
|
||||
DoubleSha256Digest(
|
||||
"77352045b2995c9e0dfff9089e5563cd13914eb4b0723cdd54675c5c3f1c4f6a"),
|
||||
DoubleSha256Digest(
|
||||
"7ae10c30932c07e4ed25abab233565f9ab279eabbcd60e1bc028c6cdc400361b"),
|
||||
DoubleSha256Digest(
|
||||
"8ca2e6b66c55fbb63cb7c9b5ccd19be508034eedcd8511d216b9fe93aafc2ceb")
|
||||
"79a03d2d9f1c5c97772974c9ef9297e6e2bce0271ca95d40bb598c6156c3d6e0"),
|
||||
Leaf(DoubleSha256Digest(
|
||||
"77352045b2995c9e0dfff9089e5563cd13914eb4b0723cdd54675c5c3f1c4f6a")),
|
||||
Leaf(DoubleSha256Digest(
|
||||
"7ae10c30932c07e4ed25abab233565f9ab279eabbcd60e1bc028c6cdc400361b"))
|
||||
)
|
||||
)
|
||||
),
|
||||
Leaf(DoubleSha256Digest(
|
||||
"8ca2e6b66c55fbb63cb7c9b5ccd19be508034eedcd8511d216b9fe93aafc2ceb"))
|
||||
),
|
||||
UInt32(6),
|
||||
BitVector.bits(
|
||||
List(true, true, true, false, true, true,
|
||||
false, true, false, false, false, false,
|
||||
false, false, false, false)),
|
||||
List(
|
||||
DoubleSha256Digest(
|
||||
"e4aeaf729035a7fb939e12c4f6a2072a9b2e7da784207ce7852d398593210a45"),
|
||||
DoubleSha256Digest(
|
||||
"010506d2103d0feb477224926eedaf3d7478fe3d93b54bd24e5eb2c0adc309b3"),
|
||||
DoubleSha256Digest(
|
||||
"7ae10c30932c07e4ed25abab233565f9ab279eabbcd60e1bc028c6cdc400361b")
|
||||
))
|
||||
"77352045b2995c9e0dfff9089e5563cd13914eb4b0723cdd54675c5c3f1c4f6a"),
|
||||
DoubleSha256Digest(
|
||||
"7ae10c30932c07e4ed25abab233565f9ab279eabbcd60e1bc028c6cdc400361b"),
|
||||
DoubleSha256Digest(
|
||||
"8ca2e6b66c55fbb63cb7c9b5ccd19be508034eedcd8511d216b9fe93aafc2ceb")
|
||||
)
|
||||
)
|
||||
),
|
||||
List(
|
||||
DoubleSha256Digest(
|
||||
"010506d2103d0feb477224926eedaf3d7478fe3d93b54bd24e5eb2c0adc309b3"),
|
||||
DoubleSha256Digest(
|
||||
"7ae10c30932c07e4ed25abab233565f9ab279eabbcd60e1bc028c6cdc400361b")
|
||||
))
|
||||
|
||||
val hex = merkleBlock.hex
|
||||
val actualMerkleBlock = MerkleBlock(hex)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package org.bitcoins.core.serializers.p2p.messages
|
||||
|
||||
import org.bitcoins.core.gcs.{BlockFilter, FilterType, GolombFilter}
|
||||
import org.bitcoins.core.gcs.{BlockFilter, FilterType}
|
||||
import org.bitcoins.core.p2p.CompactFilterMessage
|
||||
import org.bitcoins.crypto.DoubleSha256Digest
|
||||
import org.bitcoins.testkit.util.BitcoinSUnitTest
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package org.bitcoins.core.serializers.p2p.messages
|
||||
|
||||
import org.bitcoins.core.number.UInt64
|
||||
import org.bitcoins.core.protocol.CompactSizeUInt
|
||||
import org.bitcoins.core.p2p._
|
||||
import org.bitcoins.core.protocol.CompactSizeUInt
|
||||
import org.bitcoins.core.util.BytesUtil
|
||||
import org.bitcoins.crypto.DoubleSha256Digest
|
||||
import org.bitcoins.testkit.util.BitcoinSUnitTest
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package org.bitcoins.core.serializers.p2p.messages
|
||||
|
||||
import org.bitcoins.core.gcs.FilterType
|
||||
import org.bitcoins.core.number.UInt32
|
||||
import org.bitcoins.core.p2p.GetCompactFilterHeadersMessage
|
||||
import org.bitcoins.crypto.DoubleSha256Digest
|
||||
import org.bitcoins.testkit.util.BitcoinSUnitTest
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package org.bitcoins.core.serializers.p2p.messages
|
||||
|
||||
import org.bitcoins.core.gcs.FilterType
|
||||
import org.bitcoins.core.number.UInt32
|
||||
import org.bitcoins.core.p2p.GetCompactFiltersMessage
|
||||
import org.bitcoins.crypto.DoubleSha256Digest
|
||||
import org.bitcoins.testkit.util.BitcoinSUnitTest
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package org.bitcoins.core.serializers.p2p.messages
|
||||
|
||||
import org.bitcoins.core.number.UInt64
|
||||
import org.bitcoins.core.protocol.CompactSizeUInt
|
||||
import org.bitcoins.core.p2p.Inventory
|
||||
import org.bitcoins.core.p2p.TypeIdentifier.MsgTx
|
||||
import org.bitcoins.core.protocol.CompactSizeUInt
|
||||
import org.bitcoins.crypto.DoubleSha256Digest
|
||||
import org.bitcoins.testkit.util.BitcoinSUnitTest
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.bitcoins.core.serializers.p2p.messages
|
||||
|
||||
import org.bitcoins.core.p2p._
|
||||
import org.bitcoins.core.number.UInt64
|
||||
import org.bitcoins.core.p2p._
|
||||
import org.bitcoins.core.protocol.CompactSizeUInt
|
||||
import org.bitcoins.crypto.DoubleSha256Digest
|
||||
import org.bitcoins.testkit.node.NodeTestUtil
|
||||
|
|
|
@ -3,8 +3,8 @@ package org.bitcoins.core.serializers.p2p.messages
|
|||
import java.net.InetSocketAddress
|
||||
|
||||
import org.bitcoins.core.number.{Int32, Int64, UInt64}
|
||||
import org.bitcoins.core.protocol.CompactSizeUInt
|
||||
import org.bitcoins.core.p2p._
|
||||
import org.bitcoins.core.protocol.CompactSizeUInt
|
||||
import org.bitcoins.core.util.BytesUtil
|
||||
import org.bitcoins.testkit.util.BitcoinSUnitTest
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import org.bitcoins.core.protocol.transaction.{
|
|||
TransactionConstants,
|
||||
TransactionInput
|
||||
}
|
||||
import org.bitcoins.core.util.{BitcoinSLogger, BytesUtil}
|
||||
import org.bitcoins.core.util.BytesUtil
|
||||
import org.bitcoins.testkit.util.{BitcoinSAsyncTest, TestUtil}
|
||||
import scodec.bits.ByteVector
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package org.bitcoins.core.serializers.transaction
|
||||
|
||||
import org.bitcoins.core.currency.Satoshis
|
||||
import org.bitcoins.core.number.Int64
|
||||
import org.bitcoins.core.protocol.transaction.{
|
||||
EmptyTransactionOutput,
|
||||
TransactionOutput
|
||||
|
|
|
@ -68,7 +68,7 @@ class Base58Test extends BitcoinSUnitTest {
|
|||
val source =
|
||||
Source.fromURL(this.getClass.getResource("/base58_keys_valid.json"))
|
||||
val lines =
|
||||
try source.getLines.filterNot(_.isEmpty).map(_.trim) mkString "\n"
|
||||
try source.getLines().filterNot(_.isEmpty).map(_.trim) mkString "\n"
|
||||
finally source.close()
|
||||
val json = lines.parseJson
|
||||
val testCases: Seq[Base58ValidTestCase] =
|
||||
|
@ -78,10 +78,12 @@ class Base58Test extends BitcoinSUnitTest {
|
|||
} yield {
|
||||
//if testCase is an Address, it must have a valid base58 representation
|
||||
if (testCase.addressOrWIFPrivKey.isLeft) {
|
||||
Base58.isValid(testCase.addressOrWIFPrivKey.left.get.value) must be(
|
||||
Base58.isValid(
|
||||
testCase.addressOrWIFPrivKey.swap.getOrElse(fail()).toString) must be(
|
||||
true)
|
||||
} else {
|
||||
Base58.isValid(testCase.addressOrWIFPrivKey.right.get) must be(true)
|
||||
Base58.isValid(testCase.addressOrWIFPrivKey.getOrElse(fail())) must be(
|
||||
true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -93,7 +95,7 @@ class Base58Test extends BitcoinSUnitTest {
|
|||
val source =
|
||||
Source.fromURL(this.getClass.getResource("/base58_keys_invalid.json"))
|
||||
val lines =
|
||||
try source.getLines.filterNot(_.isEmpty).map(_.trim) mkString "\n"
|
||||
try source.getLines().filterNot(_.isEmpty).map(_.trim) mkString "\n"
|
||||
finally source.close()
|
||||
val json = lines.parseJson
|
||||
val testCases: Seq[Base58InvalidTestCase] =
|
||||
|
|
|
@ -11,7 +11,6 @@ class FutureUtilTest extends BitcoinSAsyncTest with BitcoinSLogger {
|
|||
|
||||
val actorSystem = ActorSystem()
|
||||
implicit val ec = actorSystem.dispatcher
|
||||
val scheduler = actorSystem.scheduler
|
||||
|
||||
val assertionP = Promise[Assertion]()
|
||||
val assertionF = assertionP.future
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.bitcoins.core.util
|
||||
|
||||
import org.bitcoins.testkit.core.gen.NumberGenerator
|
||||
import org.bitcoins.core.number.UInt8
|
||||
import org.bitcoins.testkit.core.gen.NumberGenerator
|
||||
import org.scalacheck.{Prop, Properties}
|
||||
|
||||
/**
|
||||
|
|
|
@ -6,11 +6,7 @@ import org.bitcoins.core.protocol.script.{EmptyScriptSignature, ScriptPubKey}
|
|||
import org.bitcoins.core.protocol.transaction._
|
||||
import org.bitcoins.core.util.FutureUtil
|
||||
import org.bitcoins.crypto.DoubleSha256DigestBE
|
||||
import org.bitcoins.testkit.core.gen.{
|
||||
CreditingTxGen,
|
||||
CurrencyUnitGenerator,
|
||||
ScriptGenerators
|
||||
}
|
||||
import org.bitcoins.testkit.core.gen.CreditingTxGen
|
||||
import org.bitcoins.testkit.util.BitcoinSAsyncTest
|
||||
import org.scalatest.Assertion
|
||||
|
||||
|
|
|
@ -17,7 +17,6 @@ import org.bitcoins.crypto.{DoubleSha256DigestBE, ECPrivateKey, ECPublicKey}
|
|||
import org.bitcoins.testkit.Implicits._
|
||||
import org.bitcoins.testkit.core.gen.{
|
||||
CreditingTxGen,
|
||||
CurrencyUnitGenerator,
|
||||
FeeUnitGen,
|
||||
ScriptGenerators
|
||||
}
|
||||
|
|
|
@ -2,21 +2,8 @@ package org.bitcoins.core.wallet.builder
|
|||
|
||||
import org.bitcoins.core.currency.{Bitcoins, CurrencyUnits, Satoshis}
|
||||
import org.bitcoins.core.number.UInt32
|
||||
import org.bitcoins.core.protocol.script.{
|
||||
EmptyScriptPubKey,
|
||||
EmptyScriptSignature,
|
||||
P2PKHScriptPubKey,
|
||||
P2WPKHWitnessSPKV0,
|
||||
P2WPKHWitnessV0
|
||||
}
|
||||
import org.bitcoins.core.protocol.transaction.{
|
||||
BaseTransaction,
|
||||
EmptyTransaction,
|
||||
TransactionConstants,
|
||||
TransactionInput,
|
||||
TransactionOutPoint,
|
||||
TransactionOutput
|
||||
}
|
||||
import org.bitcoins.core.protocol.script._
|
||||
import org.bitcoins.core.protocol.transaction._
|
||||
import org.bitcoins.core.script.crypto.HashType
|
||||
import org.bitcoins.core.wallet.fee.SatoshisPerVirtualByte
|
||||
import org.bitcoins.core.wallet.utxo.{
|
||||
|
|
|
@ -30,6 +30,7 @@ import org.bitcoins.testkit.core.gen.{
|
|||
}
|
||||
import org.bitcoins.testkit.util.BitcoinSAsyncTest
|
||||
|
||||
import scala.annotation.nowarn
|
||||
import scala.concurrent.{ExecutionContext, Future}
|
||||
|
||||
class SignerTest extends BitcoinSAsyncTest {
|
||||
|
@ -172,12 +173,13 @@ class SignerTest extends BitcoinSAsyncTest {
|
|||
signInfo.signers.map { signer =>
|
||||
val txSignatureComponent =
|
||||
TxSigComponent(signInfo.inputInfo, spendingTx)
|
||||
|
||||
@nowarn val oldSigF = BitcoinSigner.doSign(txSignatureComponent,
|
||||
signer.signFunction,
|
||||
signInfo.hashType,
|
||||
isDummySignature =
|
||||
false)
|
||||
for {
|
||||
oldSig <- BitcoinSigner.doSign(txSignatureComponent,
|
||||
signer.signFunction,
|
||||
signInfo.hashType,
|
||||
isDummySignature = false)
|
||||
oldSig <- oldSigF
|
||||
newSig <- BitcoinSigner.doSign(spendingTx,
|
||||
signInfo,
|
||||
signer.signFunction,
|
||||
|
|
|
@ -1,29 +1,21 @@
|
|||
package org.bitcoins.core.bloom
|
||||
|
||||
import org.bitcoins.core.number.{UInt32, UInt64}
|
||||
import org.bitcoins.core.protocol.CompactSizeUInt
|
||||
import org.bitcoins.core.protocol.script.{
|
||||
MultiSignatureScriptPubKey,
|
||||
P2PKScriptPubKey,
|
||||
ScriptPubKey
|
||||
}
|
||||
import org.bitcoins.core.protocol.transaction.{Transaction, TransactionOutPoint}
|
||||
import org.bitcoins.core.protocol.CompactSizeUInt
|
||||
import org.bitcoins.core.script.constant.{ScriptConstant, ScriptToken}
|
||||
import org.bitcoins.core.serializers.bloom.RawBloomFilterSerializer
|
||||
import org.bitcoins.core.util.{BitcoinSLogger, BytesUtil}
|
||||
import org.bitcoins.crypto._
|
||||
import scodec.bits.{BitVector, ByteVector}
|
||||
|
||||
import scala.annotation.tailrec
|
||||
import scala.util.hashing.MurmurHash3
|
||||
import org.bitcoins.crypto.{
|
||||
CryptoUtil,
|
||||
DoubleSha256Digest,
|
||||
ECPublicKey,
|
||||
Factory,
|
||||
HashDigest,
|
||||
NetworkElement,
|
||||
Sha256Hash160Digest
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements a bloom filter that abides by the semantics of BIP37
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
package org.bitcoins.core.compat
|
||||
|
||||
import scala.util.Try
|
||||
import scala.util.Success
|
||||
import scala.util.Failure
|
||||
import scala.util.{Failure, Success, Try}
|
||||
|
||||
/** This is an implementation of (parts of)
|
||||
* `scala.util.Either`, compatible with Scala 2.11,
|
||||
|
|
|
@ -4,19 +4,7 @@ import org.bitcoin.NativeSecp256k1
|
|||
import org.bitcoins.core.hd.{BIP32Node, BIP32Path}
|
||||
import org.bitcoins.core.number.{UInt32, UInt8}
|
||||
import org.bitcoins.core.util._
|
||||
import org.bitcoins.crypto.{
|
||||
BaseECKey,
|
||||
CryptoContext,
|
||||
CryptoUtil,
|
||||
ECDigitalSignature,
|
||||
ECPrivateKey,
|
||||
ECPublicKey,
|
||||
Factory,
|
||||
FieldElement,
|
||||
MaskedToString,
|
||||
NetworkElement,
|
||||
StringFactory
|
||||
}
|
||||
import org.bitcoins.crypto._
|
||||
import scodec.bits.{ByteVector, HexStringSyntax}
|
||||
|
||||
import scala.annotation.tailrec
|
||||
|
|
|
@ -4,8 +4,8 @@ import org.bitcoins.core.hd.BIP32Path
|
|||
import org.bitcoins.crypto.{ECDigitalSignature, Sign}
|
||||
import scodec.bits.ByteVector
|
||||
|
||||
import scala.concurrent.{Await, Future}
|
||||
import scala.concurrent.duration.DurationInt
|
||||
import scala.concurrent.{Await, Future}
|
||||
|
||||
/** A signing interface for [[ExtKey]] */
|
||||
trait ExtSign extends Sign {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package org.bitcoins.core.crypto
|
||||
|
||||
import org.bitcoins.core.policy.Policy
|
||||
import org.bitcoins.core.protocol.script.ScriptPubKey
|
||||
import org.bitcoins.core.protocol.transaction.TransactionOutput
|
||||
import org.bitcoins.core.psbt.InputPSBTRecord.PartialSignature
|
||||
|
@ -7,7 +8,6 @@ import org.bitcoins.core.script.constant.ScriptToken
|
|||
import org.bitcoins.core.script.crypto._
|
||||
import org.bitcoins.core.script.flag.{ScriptFlag, ScriptFlagUtil}
|
||||
import org.bitcoins.core.script.result.ScriptErrorWitnessPubKeyType
|
||||
import org.bitcoins.core.policy.Policy
|
||||
import org.bitcoins.core.util.{BitcoinSLogger, BitcoinScriptUtil, BytesUtil}
|
||||
import org.bitcoins.crypto.{DERSignatureUtil, ECDigitalSignature, ECPublicKey}
|
||||
import scodec.bits.ByteVector
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
package org.bitcoins.core.gcs
|
||||
|
||||
import scodec.bits._
|
||||
import org.bitcoins.core.number.UInt64
|
||||
import org.bitcoins.core.number.UInt8
|
||||
import org.bitcoins.core.number.{UInt64, UInt8}
|
||||
import org.bitcoins.crypto.{Factory, NetworkElement}
|
||||
import scodec.bits._
|
||||
|
||||
/**
|
||||
* Filter types for BIP158 block content filters
|
||||
|
|
|
@ -6,9 +6,9 @@ import org.bitcoins.core.bloom.{BloomFilter, BloomFlag}
|
|||
import org.bitcoins.core.config.NetworkParameters
|
||||
import org.bitcoins.core.gcs.{FilterHeader, FilterType, GolombFilter}
|
||||
import org.bitcoins.core.number.{Int32, Int64, UInt32, UInt64}
|
||||
import org.bitcoins.core.protocol.CompactSizeUInt
|
||||
import org.bitcoins.core.protocol.blockchain.{Block, BlockHeader, MerkleBlock}
|
||||
import org.bitcoins.core.protocol.transaction.Transaction
|
||||
import org.bitcoins.core.protocol.CompactSizeUInt
|
||||
import org.bitcoins.core.serializers.p2p.messages._
|
||||
import org.bitcoins.core.util.BytesUtil
|
||||
import org.bitcoins.core.wallet.fee.{SatoshisPerByte, SatoshisPerKiloByte}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package org.bitcoins.core.protocol.blockchain
|
||||
|
||||
import org.bitcoins.core.number.UInt64
|
||||
import org.bitcoins.core.protocol.transaction.Transaction
|
||||
import org.bitcoins.core.protocol.CompactSizeUInt
|
||||
import org.bitcoins.core.protocol.transaction.Transaction
|
||||
import org.bitcoins.core.serializers.blockchain.RawBlockSerializer
|
||||
import org.bitcoins.crypto.{Factory, NetworkElement}
|
||||
import scodec.bits.ByteVector
|
||||
|
|
|
@ -3,13 +3,7 @@ package org.bitcoins.core.protocol.blockchain
|
|||
import org.bitcoins.core.number.{Int32, UInt32}
|
||||
import org.bitcoins.core.serializers.blockchain.RawBlockHeaderSerializer
|
||||
import org.bitcoins.core.util.NumberUtil
|
||||
import org.bitcoins.crypto.{
|
||||
CryptoUtil,
|
||||
DoubleSha256Digest,
|
||||
DoubleSha256DigestBE,
|
||||
Factory,
|
||||
NetworkElement
|
||||
}
|
||||
import org.bitcoins.crypto._
|
||||
import scodec.bits.ByteVector
|
||||
|
||||
/**
|
||||
|
|
|
@ -2,8 +2,8 @@ package org.bitcoins.core.protocol.blockchain
|
|||
|
||||
import org.bitcoins.core.bloom.BloomFilter
|
||||
import org.bitcoins.core.number.{UInt32, UInt64}
|
||||
import org.bitcoins.core.protocol.transaction.Transaction
|
||||
import org.bitcoins.core.protocol.CompactSizeUInt
|
||||
import org.bitcoins.core.protocol.transaction.Transaction
|
||||
import org.bitcoins.core.serializers.blockchain.RawMerkleBlockSerializer
|
||||
import org.bitcoins.crypto.{DoubleSha256Digest, Factory, NetworkElement}
|
||||
import scodec.bits.{BitVector, ByteVector}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue