diff --git a/README.md b/README.md index bb88df9c93..8187183fe9 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ ![Bitcoin-S logo](website/static/img/bitcoin-s-dark-logo.png) [![Build Status](https://github.com/bitcoin-s/bitcoin-s/workflows/Release/badge.svg)](https://github.com/bitcoin-s/bitcoin-s/actions) [![Coverage Status](https://coveralls.io/repos/github/bitcoin-s/bitcoin-s/badge.svg?branch=master)](https://coveralls.io/github/bitcoin-s/bitcoin-s?branch=master) [![Maven Central](https://img.shields.io/badge/Maven%20Central-0.5.0-brightgreen.svg)](https://mvnrepository.com/artifact/org.bitcoin-s) [![Gitter chat](https://badges.gitter.im/gitterHQ/gitter.png)](https://gitter.im/bitcoin-s-core) -Feature rich toolkit for making Bitcoin and Lightning applications +Feature-rich toolkit for making Bitcoin and Lightning applications on the JVM. For a complete guide on how to get started with Bitcoin-S, see our website at diff --git a/bitcoind-rpc-test/src/test/scala/org/bitcoins/rpc/common/MempoolRpcTest.scala b/bitcoind-rpc-test/src/test/scala/org/bitcoins/rpc/common/MempoolRpcTest.scala index 74d4974e06..0d93d7af35 100644 --- a/bitcoind-rpc-test/src/test/scala/org/bitcoins/rpc/common/MempoolRpcTest.scala +++ b/bitcoind-rpc-test/src/test/scala/org/bitcoins/rpc/common/MempoolRpcTest.scala @@ -107,7 +107,7 @@ class MempoolRpcTest extends BitcoindRpcTest { txid = DoubleSha256Digest.empty result <- client.getMemPoolEntryOpt(txid) } yield { - assert(result == None) + assert(result.isEmpty) } resultF } diff --git a/bitcoind-rpc-test/src/test/scala/org/bitcoins/rpc/v17/BitcoindV17RpcClientTest.scala b/bitcoind-rpc-test/src/test/scala/org/bitcoins/rpc/v17/BitcoindV17RpcClientTest.scala index ed2aab3881..66fa646566 100644 --- a/bitcoind-rpc-test/src/test/scala/org/bitcoins/rpc/v17/BitcoindV17RpcClientTest.scala +++ b/bitcoind-rpc-test/src/test/scala/org/bitcoins/rpc/v17/BitcoindV17RpcClientTest.scala @@ -250,7 +250,7 @@ class BitcoindV17RpcClientTest extends BitcoindRpcTest { _ <- client.createWallet("suredbits") wallets <- client.listWallets } yield { - assert(wallets.exists(_ == "suredbits")) + assert(wallets.contains("suredbits")) } } diff --git a/bitcoind-rpc/src/main/scala/org/bitcoins/rpc/client/common/BitcoindRpcClient.scala b/bitcoind-rpc/src/main/scala/org/bitcoins/rpc/client/common/BitcoindRpcClient.scala index 898027a255..4d361501ce 100644 --- a/bitcoind-rpc/src/main/scala/org/bitcoins/rpc/client/common/BitcoindRpcClient.scala +++ b/bitcoind-rpc/src/main/scala/org/bitcoins/rpc/client/common/BitcoindRpcClient.scala @@ -234,7 +234,7 @@ object BitcoindRpcClient { /** Creates an RPC client from the given instance, * together with the given actor system. This is for - * advanced users, wher you need fine grained control + * advanced users, where you need fine grained control * over the RPC client. */ def withActorSystem(instance: BitcoindInstance)(implicit diff --git a/bitcoind-rpc/src/main/scala/org/bitcoins/rpc/client/v16/BitcoindV16RpcClient.scala b/bitcoind-rpc/src/main/scala/org/bitcoins/rpc/client/v16/BitcoindV16RpcClient.scala index 9e804d0088..12e34000a7 100644 --- a/bitcoind-rpc/src/main/scala/org/bitcoins/rpc/client/v16/BitcoindV16RpcClient.scala +++ b/bitcoind-rpc/src/main/scala/org/bitcoins/rpc/client/v16/BitcoindV16RpcClient.scala @@ -115,7 +115,7 @@ object BitcoindV16RpcClient { /** Creates an RPC client from the given instance, * together with the given actor system. This is for - * advanced users, wher you need fine grained control + * advanced users, where you need fine grained control * over the RPC client. */ def withActorSystem(instance: BitcoindInstance)(implicit diff --git a/bitcoind-rpc/src/main/scala/org/bitcoins/rpc/client/v17/BitcoindV17RpcClient.scala b/bitcoind-rpc/src/main/scala/org/bitcoins/rpc/client/v17/BitcoindV17RpcClient.scala index 4ad08efee5..8b7cccd5f2 100644 --- a/bitcoind-rpc/src/main/scala/org/bitcoins/rpc/client/v17/BitcoindV17RpcClient.scala +++ b/bitcoind-rpc/src/main/scala/org/bitcoins/rpc/client/v17/BitcoindV17RpcClient.scala @@ -124,7 +124,7 @@ object BitcoindV17RpcClient { /** Creates an RPC client from the given instance, * together with the given actor system. This is for - * advanced users, wher you need fine grained control + * advanced users, where you need fine grained control * over the RPC client. */ def withActorSystem(instance: BitcoindInstance)(implicit diff --git a/bitcoind-rpc/src/main/scala/org/bitcoins/rpc/config/BitcoindConfig.scala b/bitcoind-rpc/src/main/scala/org/bitcoins/rpc/config/BitcoindConfig.scala index cf30852b08..f7aacdd1b0 100644 --- a/bitcoind-rpc/src/main/scala/org/bitcoins/rpc/config/BitcoindConfig.scala +++ b/bitcoind-rpc/src/main/scala/org/bitcoins/rpc/config/BitcoindConfig.scala @@ -190,7 +190,7 @@ case class BitcoindConfig( } yield result } - /** Searches the config for a key matchinng the provided + /** Searches the config for a key matching the provided * string that's _not_ in a section header or prefixed * by a network. */ diff --git a/chain-test/src/test/scala/org/bitcoins/chain/models/BlockHeaderDAOTest.scala b/chain-test/src/test/scala/org/bitcoins/chain/models/BlockHeaderDAOTest.scala index 71c6ecb38e..16c4f0652e 100644 --- a/chain-test/src/test/scala/org/bitcoins/chain/models/BlockHeaderDAOTest.scala +++ b/chain-test/src/test/scala/org/bitcoins/chain/models/BlockHeaderDAOTest.scala @@ -156,7 +156,7 @@ class BlockHeaderDAOTest extends ChainDbUnitTest { blockHeaderDAO: BlockHeaderDAO => val chainTipsF = blockHeaderDAO.getBestChainTips chainTipsF.map { tips => - assert(tips.headOption == Some(genesisHeaderDb)) + assert(tips.headOption.contains(genesisHeaderDb)) } } diff --git a/chain-test/src/test/scala/org/bitcoins/chain/models/CompactFilterHeaderDAOTest.scala b/chain-test/src/test/scala/org/bitcoins/chain/models/CompactFilterHeaderDAOTest.scala index 9211000df9..0c34b96b79 100644 --- a/chain-test/src/test/scala/org/bitcoins/chain/models/CompactFilterHeaderDAOTest.scala +++ b/chain-test/src/test/scala/org/bitcoins/chain/models/CompactFilterHeaderDAOTest.scala @@ -21,7 +21,7 @@ class CompactFilterHeaderDAOTest extends ChainDbUnitTest { it must "get the best filter header with a table with zero rows in it" in { filterHeaderDAO => filterHeaderDAO.getBestFilterHeader.map { opt => - assert(opt == None) + assert(opt.isEmpty) } } diff --git a/chain/src/main/scala/org/bitcoins/chain/models/CompactFilterDAO.scala b/chain/src/main/scala/org/bitcoins/chain/models/CompactFilterDAO.scala index a25ca8a033..03ef056f89 100644 --- a/chain/src/main/scala/org/bitcoins/chain/models/CompactFilterDAO.scala +++ b/chain/src/main/scala/org/bitcoins/chain/models/CompactFilterDAO.scala @@ -157,8 +157,6 @@ case class CompactFilterDAO()(implicit } def getBestFilterHeight: Future[Int] = { - safeDatabase.run(bestFilterHeightQuery).map { filterHeightOpt => - filterHeightOpt.headOption.getOrElse(0) - } + safeDatabase.run(bestFilterHeightQuery).map(_.getOrElse(0)) } } diff --git a/chain/src/main/scala/org/bitcoins/chain/models/CompactFilterHeaderDAO.scala b/chain/src/main/scala/org/bitcoins/chain/models/CompactFilterHeaderDAO.scala index 607ddea4ad..519d8bedb9 100644 --- a/chain/src/main/scala/org/bitcoins/chain/models/CompactFilterHeaderDAO.scala +++ b/chain/src/main/scala/org/bitcoins/chain/models/CompactFilterHeaderDAO.scala @@ -155,7 +155,7 @@ case class CompactFilterHeaderDAO()(implicit def getBestFilterHeaderHeight: Future[Int] = { safeDatabase.run(bestFilterHeaderHeightQuery).map { filterHeaderHeightOpt => - filterHeaderHeightOpt.headOption.getOrElse(0) + filterHeaderHeightOpt.getOrElse(0) } } diff --git a/core-test/src/test/scala/org/bitcoins/core/script/arithmetic/ArithmeticInterpreterTest.scala b/core-test/src/test/scala/org/bitcoins/core/script/arithmetic/ArithmeticInterpreterTest.scala index e0750c3c4d..9a1ce96bfc 100644 --- a/core-test/src/test/scala/org/bitcoins/core/script/arithmetic/ArithmeticInterpreterTest.scala +++ b/core-test/src/test/scala/org/bitcoins/core/script/arithmetic/ArithmeticInterpreterTest.scala @@ -53,7 +53,7 @@ class ArithmeticInterpreterTest extends BitcoinSUnitTest { } - it must "perform an OP_1SUB corectly" in { + it must "perform an OP_1SUB correctly" in { val stack = List(ScriptNumber.zero) val script = List(OP_1SUB) val program = @@ -77,7 +77,7 @@ class ArithmeticInterpreterTest extends BitcoinSUnitTest { newProgram.error must be(Some(ScriptErrorInvalidStackOperation)) } - it must "perform an OP_SUB corectly" in { + it must "perform an OP_SUB correctly" in { val stack = List(ScriptNumber.one, ScriptNumber.zero) val script = List(OP_SUB) val program = @@ -100,7 +100,7 @@ class ArithmeticInterpreterTest extends BitcoinSUnitTest { newProgram.error must be(Some(ScriptErrorInvalidStackOperation)) } - it must "perform an OP_ABS on a negative number corectly" in { + it must "perform an OP_ABS on a negative number correctly" in { val stack = List(ScriptNumber(-1)) val script = List(OP_ABS) val program = @@ -299,7 +299,7 @@ class ArithmeticInterpreterTest extends BitcoinSUnitTest { newProgram.script.isEmpty must be(true) } - it must "evaulate an OP_NUMEQUAL for two zeros" in { + it must "evaluate an OP_NUMEQUAL for two zeros" in { val stack = List(ScriptNumber.zero, ScriptNumber.zero) val script = List(OP_NUMEQUAL) val program = diff --git a/core-test/src/test/scala/org/bitcoins/core/script/arithmetic/ArithmeticOperationsTest.scala b/core-test/src/test/scala/org/bitcoins/core/script/arithmetic/ArithmeticOperationsTest.scala index 356e609df7..0f5e634e4d 100644 --- a/core-test/src/test/scala/org/bitcoins/core/script/arithmetic/ArithmeticOperationsTest.scala +++ b/core-test/src/test/scala/org/bitcoins/core/script/arithmetic/ArithmeticOperationsTest.scala @@ -6,7 +6,7 @@ import org.bitcoins.testkit.util.BitcoinSUnitTest */ class ArithmeticOperationsTest extends BitcoinSUnitTest { - "ArithmeticOperatoins" must "define OP_1ADD" in { + "ArithmeticOperations" must "define OP_1ADD" in { OP_1ADD.opCode must be(139) } diff --git a/core-test/src/test/scala/org/bitcoins/core/script/constant/BytesToPushOntoStackFactoryTest.scala b/core-test/src/test/scala/org/bitcoins/core/script/constant/BytesToPushOntoStackFactoryTest.scala index a9eac95e28..0f066f1a0e 100644 --- a/core-test/src/test/scala/org/bitcoins/core/script/constant/BytesToPushOntoStackFactoryTest.scala +++ b/core-test/src/test/scala/org/bitcoins/core/script/constant/BytesToPushOntoStackFactoryTest.scala @@ -7,10 +7,10 @@ import org.bitcoins.testkit.util.BitcoinSUnitTest class BytesToPushOntoStackFactoryTest extends BitcoinSUnitTest { "ScriptNumberFactory" must "represent the number 1" in { - BytesToPushOntoStack.operations.exists( - _ == BytesToPushOntoStack(1)) must be(true) - BytesToPushOntoStack.operations.exists( - _ == BytesToPushOntoStack(75)) must be(true) + BytesToPushOntoStack.operations.contains(BytesToPushOntoStack(1)) must be( + true) + BytesToPushOntoStack.operations.contains(BytesToPushOntoStack(75)) must be( + true) } it must "find the number two" in { @@ -29,8 +29,8 @@ class BytesToPushOntoStackFactoryTest extends BitcoinSUnitTest { it must "not allow creation of the script number -2" in { intercept[IllegalArgumentException] { - BytesToPushOntoStack.operations.exists( - _ == BytesToPushOntoStack(-2)) must be(false) + BytesToPushOntoStack.operations.contains( + BytesToPushOntoStack(-2)) must be(false) } } diff --git a/core-test/src/test/scala/org/bitcoins/core/script/locktime/LockTimeInterpreterTest.scala b/core-test/src/test/scala/org/bitcoins/core/script/locktime/LockTimeInterpreterTest.scala index c291a710c1..9dcc8e7a9a 100644 --- a/core-test/src/test/scala/org/bitcoins/core/script/locktime/LockTimeInterpreterTest.scala +++ b/core-test/src/test/scala/org/bitcoins/core/script/locktime/LockTimeInterpreterTest.scala @@ -42,7 +42,7 @@ class LockTimeInterpreterTest extends BitcoinSUnitTest { it must "mark the transaction as invalid if the stack top is negative" in { val stack = Seq(ScriptNumber(-1)) val script = Seq(OP_CHECKLOCKTIMEVERIFY) - val oldInput = TestUtil.transaction.inputs(0) + val oldInput = TestUtil.transaction.inputs.head val txInputAdjustedSequenceNumber = TransactionInput(oldInput.previousOutput, oldInput.scriptSignature, @@ -75,7 +75,7 @@ class LockTimeInterpreterTest extends BitcoinSUnitTest { it must "mark the transaction as invalid if the locktime on the tx is < 500000000 && stack top is >= 500000000" in { val stack = Seq(ScriptNumber(500000000)) val script = Seq(OP_CHECKLOCKTIMEVERIFY) - val oldInput = TestUtil.transaction.inputs(0) + val oldInput = TestUtil.transaction.inputs.head val txInputAdjustedSequenceNumber = TransactionInput(oldInput.previousOutput, oldInput.scriptSignature, @@ -101,7 +101,7 @@ class LockTimeInterpreterTest extends BitcoinSUnitTest { it must "mark the transaction as invalid if the locktime on the tx is >= 500000000 && stack top is < 500000000" in { val stack = Seq(ScriptNumber(499999999)) val script = Seq(OP_CHECKLOCKTIMEVERIFY) - val oldInput = TestUtil.transaction.inputs(0) + val oldInput = TestUtil.transaction.inputs.head val txInputAdjustedSequenceNumber = TransactionInput(oldInput.previousOutput, oldInput.scriptSignature, @@ -127,7 +127,7 @@ class LockTimeInterpreterTest extends BitcoinSUnitTest { it must "mark the transaction as invalid if the stack top item is greater than the tx locktime" in { val stack = Seq(ScriptNumber(499999999)) val script = Seq(OP_CHECKLOCKTIMEVERIFY) - val oldInput = TestUtil.transaction.inputs(0) + val oldInput = TestUtil.transaction.inputs.head val txInputAdjustedSequenceNumber = TransactionInput(oldInput.previousOutput, oldInput.scriptSignature, @@ -157,7 +157,7 @@ class LockTimeInterpreterTest extends BitcoinSUnitTest { it must "mark the transaction as valid if the locktime on the tx is < 500000000 && stack top is < 500000000" in { val stack = Seq(ScriptNumber(0)) val script = Seq(OP_CHECKLOCKTIMEVERIFY) - val oldInput = TestUtil.transaction.inputs(0) + val oldInput = TestUtil.transaction.inputs.head val txInputAdjustedSequenceNumber = TransactionInput(oldInput.previousOutput, oldInput.scriptSignature, @@ -185,7 +185,7 @@ class LockTimeInterpreterTest extends BitcoinSUnitTest { it must "mark the transaction as valid if the locktime on the tx is >= 500000000 && stack top is >= 500000000" in { val stack = Seq(ScriptNumber(500000000)) val script = Seq(OP_CHECKLOCKTIMEVERIFY) - val oldInput = TestUtil.transaction.inputs(0) + val oldInput = TestUtil.transaction.inputs.head val txInputAdjustedSequenceNumber = TransactionInput(oldInput.previousOutput, oldInput.scriptSignature, diff --git a/core-test/src/test/scala/org/bitcoins/core/util/BitcoinScriptUtilTest.scala b/core-test/src/test/scala/org/bitcoins/core/util/BitcoinScriptUtilTest.scala index 624c3d0e3a..f937bd2a0a 100644 --- a/core-test/src/test/scala/org/bitcoins/core/util/BitcoinScriptUtilTest.scala +++ b/core-test/src/test/scala/org/bitcoins/core/util/BitcoinScriptUtilTest.scala @@ -321,8 +321,8 @@ class BitcoinScriptUtilTest extends BitcoinSUnitTest { BitcoinScriptUtil.removeSignaturesFromScript(signatures, p2shScriptSig.asm) val sigExists = - signatures.map(sig => asmWithoutSigs.exists(_ == ScriptConstant(sig.hex))) - sigExists.exists(_ == true) must be(false) + signatures.map(sig => asmWithoutSigs.contains(ScriptConstant(sig.hex))) + sigExists.contains(true) must be(false) } it must "cast a script token to a boolean value" in { diff --git a/core/src/main/scala/org/bitcoins/core/bloom/BloomFilter.scala b/core/src/main/scala/org/bitcoins/core/bloom/BloomFilter.scala index 1bc3e0bdb9..b11a24daea 100644 --- a/core/src/main/scala/org/bitcoins/core/bloom/BloomFilter.scala +++ b/core/src/main/scala/org/bitcoins/core/bloom/BloomFilter.scala @@ -108,7 +108,7 @@ sealed abstract class BloomFilter extends NetworkElement with BitcoinSLogger { @tailrec def loop(remainingBitIndexes: Seq[Int], accum: BitVector): Boolean = { if (remainingBitIndexes.isEmpty) { - !accum.toIndexedSeq.exists(_ == false) + !accum.toIndexedSeq.contains(false) } else { val currentIndex = remainingBitIndexes.head val byteIndex = currentIndex >>> 3 diff --git a/core/src/main/scala/org/bitcoins/core/protocol/blockchain/PartialMerkleTree.scala b/core/src/main/scala/org/bitcoins/core/protocol/blockchain/PartialMerkleTree.scala index b7e83255d8..002a92a888 100644 --- a/core/src/main/scala/org/bitcoins/core/protocol/blockchain/PartialMerkleTree.scala +++ b/core/src/main/scala/org/bitcoins/core/protocol/blockchain/PartialMerkleTree.scala @@ -349,7 +349,7 @@ object PartialMerkleTree { //require(remainingBits.isEmpty, s"Remainging bits should be empty, got ${remainingBits}") //we must have used all the hashes provided to us to reconstruct the partial merkle tree as per BIP37 require( - remainingHashes.size == 0, + remainingHashes.isEmpty, "We should not have any left over hashes after building our partial merkle tree, got: " + remainingHashes) //we must not have any matches remaining, unless the remaining bits were use to pad our byte vector to 8 bits //for instance, we could have had 5 bits to indicate how to build the merkle tree, but we need to pad it with 3 bits diff --git a/core/src/main/scala/org/bitcoins/core/protocol/dlc/ContractInfo.scala b/core/src/main/scala/org/bitcoins/core/protocol/dlc/ContractInfo.scala index a0f235725a..5e1de13c2a 100644 --- a/core/src/main/scala/org/bitcoins/core/protocol/dlc/ContractInfo.scala +++ b/core/src/main/scala/org/bitcoins/core/protocol/dlc/ContractInfo.scala @@ -120,7 +120,7 @@ case class ContractInfo( .flatMap { oracles => vec.map { case MultiOracleOutcome(digitsVec, amt) => val outcomesVec = - digitsVec.toVector.map(UnsignedNumericOutcome.apply) + digitsVec.map(UnsignedNumericOutcome.apply) (NumericOracleOutcome(oracles.zip(outcomesVec)), amt) } } diff --git a/core/src/main/scala/org/bitcoins/core/protocol/ln/LnTaggedFields.scala b/core/src/main/scala/org/bitcoins/core/protocol/ln/LnTaggedFields.scala index d0d4619f74..340f944041 100644 --- a/core/src/main/scala/org/bitcoins/core/protocol/ln/LnTaggedFields.scala +++ b/core/src/main/scala/org/bitcoins/core/protocol/ln/LnTaggedFields.scala @@ -148,7 +148,7 @@ object LnTaggedFields { val dataLength = LnUtil.decodeDataLength(dataLengthU5s) //t is the actual possible payload - val payload: Vector[UInt5] = t.take(dataLength.toInt).toVector + val payload: Vector[UInt5] = t.take(dataLength.toInt) val tag = LnTag.fromLnTagPrefix(prefix, payload) diff --git a/core/src/main/scala/org/bitcoins/core/script/arithmetic/ArithmeticInterpreter.scala b/core/src/main/scala/org/bitcoins/core/script/arithmetic/ArithmeticInterpreter.scala index 325eec33ad..2b46274781 100644 --- a/core/src/main/scala/org/bitcoins/core/script/arithmetic/ArithmeticInterpreter.scala +++ b/core/src/main/scala/org/bitcoins/core/script/arithmetic/ArithmeticInterpreter.scala @@ -272,7 +272,7 @@ sealed abstract class ArithmeticInterpreter extends BitcoinSLogger { /** Performs the given arithmetic operation on the stack head * @param program the program whose stack top is used as an argument for the arithmetic operation - * @param op the arithmetic ooperation that needs to be executed on the number, for instance incrementing by 1 + * @param op the arithmetic operation that needs to be executed on the number, for instance incrementing by 1 * @return the program with the result from performing the arithmetic operation pushed onto the top of the stack */ @tailrec @@ -328,7 +328,7 @@ sealed abstract class ArithmeticInterpreter extends BitcoinSLogger { /** Performs the given arithmetic operation on the top two stack items * @param program the program whose stack top is used as an argument for the arithmetic operation - * @param op the arithmetic ooperation that needs to be executed on the number, for instance incrementing by 1 + * @param op the arithmetic operation that needs to be executed on the number, for instance incrementing by 1 * @return the program with the result from performing the arithmetic operation pushed onto the top of the stack */ @tailrec diff --git a/core/src/main/scala/org/bitcoins/core/script/locktime/LockTimeInterpreter.scala b/core/src/main/scala/org/bitcoins/core/script/locktime/LockTimeInterpreter.scala index b015351785..64850dc672 100644 --- a/core/src/main/scala/org/bitcoins/core/script/locktime/LockTimeInterpreter.scala +++ b/core/src/main/scala/org/bitcoins/core/script/locktime/LockTimeInterpreter.scala @@ -38,7 +38,7 @@ sealed abstract class LockTimeInterpreter extends BitcoinSLogger { val input = program.txSignatureComponent.transaction .inputs(program.txSignatureComponent.inputIndex.toInt) val transaction = program.txSignatureComponent.transaction - if (program.stack.size == 0) { + if (program.stack.isEmpty) { logger.error( "Transaction validation failing in OP_CHECKLOCKTIMEVERIFY because we have no stack items") program.failExecution(ScriptErrorInvalidStackOperation) diff --git a/core/src/main/scala/org/bitcoins/core/serializers/script/ScriptParser.scala b/core/src/main/scala/org/bitcoins/core/serializers/script/ScriptParser.scala index 16c1fcb871..ffb77111d3 100644 --- a/core/src/main/scala/org/bitcoins/core/serializers/script/ScriptParser.scala +++ b/core/src/main/scala/org/bitcoins/core/serializers/script/ScriptParser.scala @@ -54,9 +54,9 @@ sealed abstract class ScriptParser operations match { //for parsing strings like 'Az', need to remove single quotes //example: [[https://github.com/bitcoin/bitcoin/blob/master/src/test/data/script_valid.json#L24]] - case h +: t if h.size > 0 && h.head == '\'' && h.last == '\'' => + case h +: t if h.nonEmpty && h.head == '\'' && h.last == '\'' => val strippedQuotes = h.replace("\'", "") - if (strippedQuotes.size == 0) { + if (strippedQuotes.isEmpty) { loop(t, OP_0.bytes ++ accum) } else { val bytes: ByteVector = { diff --git a/crypto-test/src/test/scala/org/bitcoins/crypto/AesCryptTest.scala b/crypto-test/src/test/scala/org/bitcoins/crypto/AesCryptTest.scala index 4f489eb4bd..1ff69a9e17 100644 --- a/crypto-test/src/test/scala/org/bitcoins/crypto/AesCryptTest.scala +++ b/crypto-test/src/test/scala/org/bitcoins/crypto/AesCryptTest.scala @@ -26,7 +26,7 @@ class AesCryptTest extends BitcoinSUnitTest { * * Here's a link to the first test vector: * https://gchq.github.io/CyberChef/#recipe=AES_Encrypt(%7B'option':'Hex','string':'2eefdf6ee2dbca83e7b7648a8f9d1897'%7D,%7B'option':'Hex','string':'889dc64377f6d993ef713c995f9c1ee5'%7D,'CFB','Hex','Hex')&input=NzZmZTM1ODgwMDU1ZTFmYWM5NTBmNDg0YTgxNWNkMjI - * The other vectors can be repliacted by tweaking the values + * The other vectors can be replicated by tweaking the values * in the UI. */ it must "decrypt and encrypt some hard coded test vectors" in { diff --git a/docs/getting-setup.md b/docs/getting-setup.md index 8554f27edf..33d6c53756 100644 --- a/docs/getting-setup.md +++ b/docs/getting-setup.md @@ -133,7 +133,7 @@ If you're looking to set up a DLC Oracle instead go to the [oracle server docs]( We are finally ready to start running some programs! Follow the [instructions here](applications/server.md#building-the-server) to build the server. Then, follow [these instructions](applications/cli.md) to setup the CLI. -There are 2 ways to use the bitcoin-s server. It can either can be as a neutrino node or use bitcoind as a backend. +There are 2 ways to use the bitcoin-s server. It can either be as a neutrino node or use bitcoind as a backend. This can be configured by the configuration option `bitcoin-s.node.mode` choosing either `neutrino` or `bitcoind`. ### Option A: Neutrino Server @@ -150,7 +150,7 @@ Testnet: `bitcoin-s.node.peers = ["neutrino.testnet3.suredbits.com:18333"]` If you would like to use your own node you can either use the bitcoind backend option or connect to your own compatible node. -There is no released version of bitcoind that is neutrino compatible so you will either have to compile the latest `master` yourself, or use the experimental version provided by running `sbt downloadBitcoind`. +There is no released version of bitcoind that is neutrino compatible, so you will either have to compile the latest `master` yourself, or use the experimental version provided by running `sbt downloadBitcoind`. After building your bitcoin-s server, properly configuring it to be in `neutrino` mode you can start your server with: diff --git a/eclair-rpc-test/src/test/scala/org/bitcoins/eclair/rpc/EclairRpcClientTest.scala b/eclair-rpc-test/src/test/scala/org/bitcoins/eclair/rpc/EclairRpcClientTest.scala index 4029464b4c..a6c06f8395 100644 --- a/eclair-rpc-test/src/test/scala/org/bitcoins/eclair/rpc/EclairRpcClientTest.scala +++ b/eclair-rpc-test/src/test/scala/org/bitcoins/eclair/rpc/EclairRpcClientTest.scala @@ -305,7 +305,7 @@ class EclairRpcClientTest extends BitcoinSAsyncTest { .lnbcrt(Some(12345.msats.toLnCurrencyUnit)) .toString) assert(invoice.network == LnBitcoinRegTest) - assert(invoice.amount == Some(123450.pBTC)) + assert(invoice.amount.contains(123450.pBTC)) assert(invoice.isValidSignature) assert( invoice.timestamp > UInt64(1561063731) @@ -328,7 +328,7 @@ class EclairRpcClientTest extends BitcoinSAsyncTest { .lnbcrt(Some(12345.msats.toLnCurrencyUnit)) .toString) assert(invoice.network == LnBitcoinRegTest) - assert(invoice.amount == Some(123450.pBTC)) + assert(invoice.amount.contains(123450.pBTC)) assert(invoice.isValidSignature) assert( invoice.timestamp > UInt64(1561063731) @@ -355,7 +355,7 @@ class EclairRpcClientTest extends BitcoinSAsyncTest { .lnbcrt(Some(123450.pBTC)) .toString) assert(invoice.network == LnBitcoinRegTest) - assert(invoice.amount == Some(123450.pBTC)) + assert(invoice.amount.contains(123450.pBTC)) assert(invoice.isValidSignature) assert( invoice.timestamp > UInt64(1561063731) @@ -385,7 +385,7 @@ class EclairRpcClientTest extends BitcoinSAsyncTest { .lnbcrt(Some(12345.msats.toLnCurrencyUnit)) .toString) assert(invoice.network == LnBitcoinRegTest) - assert(invoice.amount == Some(123450.pBTC)) + assert(invoice.amount.contains(123450.pBTC)) assert(invoice.isValidSignature) assert( invoice.timestamp > UInt64(1561063731) diff --git a/node/src/main/scala/org/bitcoins/node/networking/peer/MerkleBuffers.scala b/node/src/main/scala/org/bitcoins/node/networking/peer/MerkleBuffers.scala index 1bb6c8882a..f9b30a45df 100644 --- a/node/src/main/scala/org/bitcoins/node/networking/peer/MerkleBuffers.scala +++ b/node/src/main/scala/org/bitcoins/node/networking/peer/MerkleBuffers.scala @@ -67,7 +67,7 @@ private[peer] object MerkleBuffers extends P2PLogger { logger.trace( s"Block=${block.blockHeader.hashBE} has matches=${matches.map(_.flip)}") - matches.exists(_ == tx.txId) + matches.contains(tx.txId) } match { case None => logger.debug( diff --git a/wallet-test/src/test/scala/org/bitcoins/wallet/TrezorAddressTest.scala b/wallet-test/src/test/scala/org/bitcoins/wallet/TrezorAddressTest.scala index 6f420a04a5..7412e12671 100644 --- a/wallet-test/src/test/scala/org/bitcoins/wallet/TrezorAddressTest.scala +++ b/wallet-test/src/test/scala/org/bitcoins/wallet/TrezorAddressTest.scala @@ -254,7 +254,7 @@ class TrezorAddressTest extends BitcoinSWalletTest with EmptyFixture { accountsWithVectors = { assert(accounts.length == testVectors.length) val accountsWithVectors = testVectors.map { vec => - assert(accounts.filter(_.hdAccount.index == vec.account).length == 1) + assert(accounts.count(_.hdAccount.index == vec.account) == 1) accounts.find(_.hdAccount.index == vec.account) match { case None => fail( diff --git a/wallet/src/main/scala/org/bitcoins/wallet/WalletLogger.scala b/wallet/src/main/scala/org/bitcoins/wallet/WalletLogger.scala index 6e80caa4e7..77aee6e08f 100644 --- a/wallet/src/main/scala/org/bitcoins/wallet/WalletLogger.scala +++ b/wallet/src/main/scala/org/bitcoins/wallet/WalletLogger.scala @@ -2,5 +2,5 @@ package org.bitcoins.wallet import grizzled.slf4j.Logging -/** Exposes acccess to the wallet logger */ +/** Exposes access to the wallet logger */ private[bitcoins] trait WalletLogger extends Logging diff --git a/wallet/src/main/scala/org/bitcoins/wallet/internal/TransactionProcessing.scala b/wallet/src/main/scala/org/bitcoins/wallet/internal/TransactionProcessing.scala index 05b21931eb..040453b0a4 100644 --- a/wallet/src/main/scala/org/bitcoins/wallet/internal/TransactionProcessing.scala +++ b/wallet/src/main/scala/org/bitcoins/wallet/internal/TransactionProcessing.scala @@ -215,7 +215,7 @@ private[wallet] trait TransactionProcessing extends WalletLogger { } processed <- FutureUtil.sequentially(outputsToUse)(markAsPendingSpent) - } yield processed.flatten.toVector + } yield processed.flatten } diff --git a/wallet/src/main/scala/org/bitcoins/wallet/models/AddressTagDAO.scala b/wallet/src/main/scala/org/bitcoins/wallet/models/AddressTagDAO.scala index 34415f12c6..aaac1438d9 100644 --- a/wallet/src/main/scala/org/bitcoins/wallet/models/AddressTagDAO.scala +++ b/wallet/src/main/scala/org/bitcoins/wallet/models/AddressTagDAO.scala @@ -160,7 +160,7 @@ case class AddressTagDAO()(implicit spks.map(spk => BitcoinAddress.fromScriptPubKey(spk, network)) val findByAddressFs = addresses.map(address => findByAddress(address)) - FutureUtil.collect(findByAddressFs).map(_.toVector.flatten) + FutureUtil.collect(findByAddressFs).map(_.flatten) } } } diff --git a/zmq/src/main/scala/org/bitcoins/zmq/ZMQSubscriber.scala b/zmq/src/main/scala/org/bitcoins/zmq/ZMQSubscriber.scala index 8763c54f9c..3b5ec5f240 100644 --- a/zmq/src/main/scala/org/bitcoins/zmq/ZMQSubscriber.scala +++ b/zmq/src/main/scala/org/bitcoins/zmq/ZMQSubscriber.scala @@ -43,22 +43,22 @@ class ZMQSubscriber( val isConnected = subscriber.connect(uri) if (isConnected) { - hashTxListener.map { _ => + hashTxListener.foreach { _ => subscriber.subscribe(HashTx.topic.getBytes(ZMQ.CHARSET)) logger.debug("subscribed to the transaction hashes from zmq") } - rawTxListener.map { _ => + rawTxListener.foreach { _ => subscriber.subscribe(RawTx.topic.getBytes(ZMQ.CHARSET)) logger.debug("subscribed to raw transactions from zmq") } - hashBlockListener.map { _ => + hashBlockListener.foreach { _ => subscriber.subscribe(HashBlock.topic.getBytes(ZMQ.CHARSET)) logger.debug("subscribed to the hashblock stream from zmq") } - rawBlockListener.map { _ => + rawBlockListener.foreach { _ => subscriber.subscribe(RawBlock.topic.getBytes(ZMQ.CHARSET)) logger.debug("subscribed to raw block stream from zmq") }