Fixing merge conflict with master

This commit is contained in:
Chris Stewart 2017-02-23 15:15:42 -06:00
commit 16c131e595
10 changed files with 20 additions and 26 deletions

View File

@ -13,23 +13,25 @@ This repostitory includes the following functionality:
- Passes all tests found in Bitcoin Core's regression test suite called [script_test.json](https://github.com/bitcoin/bitcoin/blob/master/src/test/data/script_tests.json)
- Passes all tests inside of Bitcoin Core's transaction regression test suite [tx_valid.json](https://github.com/bitcoin/bitcoin/blob/master/src/test/data/tx_valid.json) / [tx_invalid.json](https://github.com/bitcoin/bitcoin/blob/master/src/test/data/tx_invalid.json) /
[sighash.json](https://github.com/bitcoin/bitcoin/blob/master/src/test/data/sighash.json)
- Currently up to date through OP_CHECKSEQUENCEVERIFY
- Currently up to date through segregated witness
- 90% test coverage throughout the codebase to ensure high quality code.
- Functions documented with Scaladocs for user friendliness
# Design Principles
- Immutable data structures everywhere
- Using Algebraic Data Types to allow the compiler to check for exhaustiveness on match statements
- Algebraic Data Types to allow the compiler to check for exhaustiveness on match statements
- Favoring readability over terseness
# TODO
- Segwit support
- [Libsecp256k1](https://github.com/bitcoin-core/secp256k1/tree/master/src/java/org/bitcoin) support
- Simplified payment channel support
- [BIP32](https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki) HD keys
- Java support
- Android support
# Examples
Here is an example scala console session with bitcoin-core-s
Here is an example scala console session with bitcoins-core
```scala
chris@chris:~/dev/bitcoins-core-chris$ sbt console

1
project/build.properties Normal file
View File

@ -0,0 +1 @@
sbt.version=0.13.13

View File

@ -9,8 +9,7 @@ import org.bitcoins.core.script.locktime.LocktimeOperation
import org.bitcoins.core.script.reserved.ReservedOperation
import org.bitcoins.core.script.splice.SpliceOperation
import org.bitcoins.core.script.stack.StackOperation
import org.bitcoins.core.util.{BitcoinSUtil, BitcoinSLogger}
import org.slf4j.LoggerFactory
import org.bitcoins.core.util.{BitcoinSLogger, BitcoinSUtil}
/**
* Created by chris on 1/8/16.

View File

@ -50,7 +50,7 @@ trait ArithmeticInterpreter extends ControlOperationsInterpreter {
/** Negates the stack top. */
def opNegate(program : ScriptProgram) : ScriptProgram = {
require(program.script.headOption.contains(OP_NEGATE), "Script top must be OP_NEGATE")
performUnaryArithmeticOperation(program, x => x -)
performUnaryArithmeticOperation(program, x => -x)
}
/** If the input is 0 or 1, it is flipped. Otherwise the output will be 0. */

View File

@ -44,7 +44,7 @@ sealed trait ScriptNumber extends ScriptConstant {
def underlying : Long
def + (that : ScriptNumber) : ScriptNumber = ScriptNumber(underlying + that.underlying)
def - = ScriptNumber(-underlying)
def unary_- = ScriptNumber(-underlying)
def - (that : ScriptNumber) : ScriptNumber = ScriptNumber(underlying - that.underlying)
def * (that : ScriptNumber) : ScriptNumber = ScriptNumber(underlying * that.underlying)

View File

@ -1,12 +1,11 @@
package org.bitcoins.core.script.control
import org.bitcoins.core.protocol.script.SigVersionWitnessV0
import org.bitcoins.core.script.result._
import org.bitcoins.core.script.ScriptProgram
import org.bitcoins.core.script.constant._
import org.bitcoins.core.script.flag.ScriptFlagUtil
import org.bitcoins.core.script.result._
import org.bitcoins.core.util._
import org.slf4j.LoggerFactory
import scala.annotation.tailrec

View File

@ -1,11 +1,9 @@
package org.bitcoins.core.serializers.script
import org.bitcoins.core.protocol.CompactSizeUInt
import org.bitcoins.core.serializers.RawBitcoinSerializer
import org.bitcoins.core.protocol.script.{EmptyScriptPubKey, ScriptPubKey}
import org.bitcoins.core.script.constant.ScriptToken
import org.bitcoins.core.util.{BitcoinSLogger, BitcoinSUtil}
import org.slf4j.LoggerFactory
import org.bitcoins.core.serializers.RawBitcoinSerializer
import scala.util.Try

View File

@ -1,12 +1,10 @@
package org.bitcoins.core.serializers.script
import org.bitcoins.core.protocol.CompactSizeUInt
import org.bitcoins.core.serializers.RawBitcoinSerializer
import org.bitcoins.core.protocol.script._
import org.bitcoins.core.script.constant.{ScriptConstant, ScriptToken}
import org.bitcoins.core.script.crypto.{OP_CHECKMULTISIG, OP_CHECKMULTISIGVERIFY}
import org.bitcoins.core.util.{BitcoinSLogger, BitcoinSUtil}
import org.slf4j.LoggerFactory
import org.bitcoins.core.script.constant.ScriptToken
import org.bitcoins.core.serializers.RawBitcoinSerializer
import org.bitcoins.core.util.BitcoinSLogger
import scala.util.Try

View File

@ -3,12 +3,10 @@ package org.bitcoins.core.serializers.script
import org.bitcoins.core.number.UInt32
import org.bitcoins.core.script._
import org.bitcoins.core.script.constant._
import org.bitcoins.core.script.crypto.{OP_CHECKMULTISIG, OP_CHECKMULTISIGVERIFY}
import org.bitcoins.core.util.{BitcoinSLogger, BitcoinSUtil, Factory, NumberUtil}
import org.slf4j.LoggerFactory
import org.bitcoins.core.util.{BitcoinSLogger, BitcoinSUtil, Factory}
import scala.annotation.tailrec
import scala.util.{Failure, Success, Try}
import scala.util.Try
/**
* Created by chris on 1/7/16.

View File

@ -2,12 +2,11 @@ package org.bitcoins.core.serializers.transaction
import org.bitcoins.core.currency.{CurrencyUnits, Satoshis}
import org.bitcoins.core.number.UInt64
import org.bitcoins.core.serializers.{RawBitcoinSerializer, RawSatoshisSerializer}
import org.bitcoins.core.serializers.script.{RawScriptPubKeyParser, ScriptParser}
import org.bitcoins.core.protocol.CompactSizeUInt
import org.bitcoins.core.protocol.transaction.{TransactionOutput, TransactionOutputImpl}
import org.bitcoins.core.protocol.transaction.TransactionOutput
import org.bitcoins.core.serializers.script.{RawScriptPubKeyParser, ScriptParser}
import org.bitcoins.core.serializers.{RawBitcoinSerializer, RawSatoshisSerializer}
import org.bitcoins.core.util.{BitcoinSLogger, BitcoinSUtil}
import org.slf4j.LoggerFactory
import scala.annotation.tailrec