Cleaning up Publish Logs (#634)

* This PR is attempting to remove the publishing errors when publish
locally many of which are incorrectly linked things in scaladocs which
there are some differences in formatting. Hopefully this removes alot
if not all of the "link not found for ..." warning messages that show
up.
This commit is contained in:
cwaldron97 2019-07-31 05:28:22 -05:00 committed by Torkel Rogstad
parent cee2665d49
commit e6dcd1cfb4
35 changed files with 168 additions and 178 deletions

View file

@ -2,16 +2,14 @@ package org.bitcoins.rpc.config
import java.io.File import java.io.File
import java.net.URI import java.net.URI
import java.nio.file.Paths import java.nio.file.{Files, Paths}
import org.bitcoins.core.config.NetworkParameters
import org.bitcoins.core.util.BitcoinSLogger
import org.bitcoins.rpc.client.common.BitcoindVersion import org.bitcoins.rpc.client.common.BitcoindVersion
import scala.sys.process._ import scala.sys.process._
import org.bitcoins.core.util.BitcoinSLogger import scala.util.Properties
import org.bitcoins.core.config.NetworkParameters
import scala.util.{Properties, Try}
import java.nio.file.Files
/** /**
* Created by chris on 4/29/17. * Created by chris on 4/29/17.

View file

@ -1,12 +1,11 @@
package org.bitcoins.chain.blockchain package org.bitcoins.chain.blockchain
import org.bitcoins.chain.models.{BlockHeaderDAO, BlockHeaderDb} import org.bitcoins.chain.models.{BlockHeaderDAO, BlockHeaderDb}
import org.bitcoins.chain.validation.TipUpdateResult.BadPreviousBlockHash
import org.bitcoins.chain.validation.{TipUpdateResult, TipValidation} import org.bitcoins.chain.validation.{TipUpdateResult, TipValidation}
import org.bitcoins.core.protocol.blockchain.BlockHeader import org.bitcoins.core.protocol.blockchain.BlockHeader
import org.bitcoins.core.util.BitcoinSLogger import org.bitcoins.core.util.BitcoinSLogger
import scala.collection.{IndexedSeqLike, IterableLike, SeqLike, mutable} import scala.collection.{IndexedSeqLike, mutable}
import scala.concurrent.{ExecutionContext, Future} import scala.concurrent.{ExecutionContext, Future}
/** /**
@ -51,15 +50,15 @@ object Blockchain extends BitcoinSLogger {
/** /**
* Attempts to connect the given block header with the given blockchain * Attempts to connect the given block header with the given blockchain
* This is done via the companion object for blockchain because * This is done via the companion object for blockchain because
* we query [[BlockHeaderDAO block header dao]] for the chain tips * we query [[org.bitcoins.chain.models.BlockHeaderDAO BlockHeaderDAO]] for the chain tips
* We then attempt to connect this block header to all of our current * We then attempt to connect this block header to all of our current
* chain tips. * chain tips.
* @param header the block header to connect to our chain * @param header the block header to connect to our chain
* @param blockHeaderDAO where we can find our blockchain * @param blockHeaderDAO where we can find our blockchain
* @param ec * @param ec
* @return a [[Future future]] that contains a [[BlockchainUpdate update]] indicating * @return a [[scala.concurrent.Future Future]] that contains a [[org.bitcoins.chain.blockchain.BlockchainUpdate BlockchainUpdate]] indicating
* we [[BlockchainUpdate.Successful successfully]] connected the tip, * we [[org.bitcoins.chain.blockchain.BlockchainUpdate.Successful successful]] connected the tip,
* or [[BlockchainUpdate.Failed failed]] to connect to a tip * or [[org.bitcoins.chain.blockchain.BlockchainUpdate.Failed Failed]] to connect to a tip
*/ */
def connectTip(header: BlockHeader, blockHeaderDAO: BlockHeaderDAO)( def connectTip(header: BlockHeader, blockHeaderDAO: BlockHeaderDAO)(
implicit ec: ExecutionContext): Future[BlockchainUpdate] = { implicit ec: ExecutionContext): Future[BlockchainUpdate] = {

View file

@ -5,11 +5,11 @@ import org.bitcoins.chain.validation.TipUpdateResult
import org.bitcoins.core.protocol.blockchain.BlockHeader import org.bitcoins.core.protocol.blockchain.BlockHeader
/** Represents the state of an update to our [[org.bitcoins.chain.blockchain.Blockchain Blockchain]] /** Represents the state of an update to our [[org.bitcoins.chain.blockchain.Blockchain Blockchain]]
* An example of a successful update is receiving a [[BlockHeader BlockHeader]] and successfully * An example of a successful update is receiving a [[org.bitcoins.core.protocol.blockchain.BlockHeader BlockHeader]] and successfully
* adding it to our database. * adding it to our database.
* *
* An example of a [[org.bitcoins.chain.blockchain.BlockchainUpdate.Failed Failed]] update * An example of a [[org.bitcoins.chain.blockchain.BlockchainUpdate.Failed Failed]] update
* is when we receive a [[BlockHeader]] that is invalid and because of a * is when we receive a [[org.bitcoins.core.protocol.blockchain.BlockHeader BlockHeader]] that is invalid and because of a
* [[org.bitcoins.chain.validation.TipUpdateResult.Failure TipUpdateFailure]] * [[org.bitcoins.chain.validation.TipUpdateResult.Failure TipUpdateFailure]]
* because of [[org.bitcoins.chain.validation.TipUpdateResult.BadPOW BadPOW]] or a * because of [[org.bitcoins.chain.validation.TipUpdateResult.BadPOW BadPOW]] or a
* [[org.bitcoins.chain.validation.TipUpdateResult.BadNonce BadNonce]] etc * [[org.bitcoins.chain.validation.TipUpdateResult.BadNonce BadNonce]] etc
@ -20,7 +20,7 @@ object BlockchainUpdate {
/** The key thing we receive here is [[org.bitcoins.chain.models.BlockHeaderDb BlockHeaderDb]] /** The key thing we receive here is [[org.bitcoins.chain.models.BlockHeaderDb BlockHeaderDb]]
* with a height assigned to it this happens after * with a height assigned to it this happens after
* calling [[ChainHandler.processHeader() ChainHandler.processHeader]] * calling [[org.bitcoins.chain.blockchain.ChainHandler.processHeader ChainHandler.processHeader]]
*/ */
case class Successful(blockchain: Blockchain, updatedHeader: BlockHeaderDb) case class Successful(blockchain: Blockchain, updatedHeader: BlockHeaderDb)
extends BlockchainUpdate { extends BlockchainUpdate {

View file

@ -11,7 +11,7 @@ import scala.concurrent.{ExecutionContext, Future}
/** /**
* Chain Handler is meant to be the reference implementation * Chain Handler is meant to be the reference implementation
* of [[ChainApi]], this is the entry point in to the * of [[org.bitcoins.chain.api.ChainApi ChainApi]], this is the entry point in to the
* chain project. * chain project.
*/ */
case class ChainHandler( case class ChainHandler(

View file

@ -175,9 +175,9 @@ case class BlockHeaderDAO()(
/** Returns competing blockchains that are contained in our BlockHeaderDAO /** Returns competing blockchains that are contained in our BlockHeaderDAO
* Each chain returns the last [[org.bitcoins.core.protocol.blockchain.ChainParams.difficultyChangeInterval difficutly interval]] * Each chain returns the last [[org.bitcoins.core.protocol.blockchain.ChainParams.difficultyChangeInterval difficutly interval]]
* block headers as defined by the network we are on. For instance, on bitcoin mainnet this will be 2016 block headers. * block headers as defined by the network we are on. For instance, on bitcoin mainnet this will be 2016 block headers.
* If no competing tips are found, we only return one [[Blockchain blockchain]], else we * If no competing tips are found, we only return one [[[org.bitcoins.chain.blockchain.Blockchain Blockchain]], else we
* return n chains for the number of competing [[chainTips tips]] we have * return n chains for the number of competing [[chainTips tips]] we have
* @see [[Blockchain]] * @see [[org.bitcoins.chain.blockchain.Blockchain Blockchain]]
* @param ec * @param ec
* @return * @return
*/ */

View file

@ -17,12 +17,12 @@ object TipUpdateResult {
def header: BlockHeader def header: BlockHeader
} }
/** Means that [[header.previousBlockHashBE]] was incorrect */ /** Means that [[org.bitcoins.core.protocol.blockchain.BlockHeader.previousBlockHashBE previousBlockHashBE]] was incorrect */
case class BadPreviousBlockHash(header: BlockHeader) extends Failure case class BadPreviousBlockHash(header: BlockHeader) extends Failure
/** Means that [[header.nBits]] was invalid */ /** Means that [[org.bitcoins.core.protocol.blockchain.BlockHeader.nBits nBits]] was invalid */
case class BadPOW(header: BlockHeader) extends Failure case class BadPOW(header: BlockHeader) extends Failure
/** Means that [[header.nonce]] was invalid */ /** Means that [[org.bitcoins.core.protocol.blockchain.BlockHeader.nonce nonce]] was invalid */
case class BadNonce(header: BlockHeader) extends Failure case class BadNonce(header: BlockHeader) extends Failure
} }

View file

@ -21,9 +21,9 @@ import scala.concurrent.{ExecutionContext, Future}
sealed abstract class TipValidation extends BitcoinSLogger { sealed abstract class TipValidation extends BitcoinSLogger {
/** Checks if the given header can be connected to the current tip /** Checks if the given header can be connected to the current tip
* This is the method where a [[BlockHeader]] is transformed into a * This is the method where a [[org.bitcoins.core.protocol.blockchain.BlockHeader BlockHeader]] is transformed into a
* [[BlockHeaderDb]]. What this really means is that a height is * [[org.bitcoins.chain.models.BlockHeaderDb BlockHeaderDb]]. What this really means is that a height is
* assigned to a [[BlockHeader header]] after all these * assigned to a [[org.bitcoins.core.protocol.blockchain.BlockHeader BlockHeader]] after all these
* validation checks occur * validation checks occur
* */ * */
def checkNewTip( def checkNewTip(

View file

@ -40,9 +40,9 @@ object NetworkHeader extends Factory[NetworkHeader] {
RawNetworkHeaderSerializer.read(bytes) RawNetworkHeaderSerializer.read(bytes)
/** /**
* Creates a [[NetworkHeader]] from it's [[NetworkParameters]] and [[NetworkPayload]] * Creates a network header from it's [[org.bitcoins.core.config.NetworkParameters NetworkParameters]] and [[NetworkPayload]]
* @param network the [[NetworkParameters]] object that indicates what network the payload needs to be sent on * @param network the [[org.bitcoins.core.config.NetworkParameters NetworkParameters]] object that indicates what network the payload needs to be sent on
* @param payload the [[NetworkPayload]] object that needs to be sent on the network * @param payload the payload object that needs to be sent on the network
*/ */
def apply( def apply(
network: NetworkParameters, network: NetworkParameters,

View file

@ -38,7 +38,7 @@ object NetworkMessage extends Factory[NetworkMessage] {
/** /**
* Creates a [[NetworkMessage]] out of it's [[NetworkPayload]] * Creates a [[NetworkMessage]] out of it's [[NetworkPayload]]
* @param network the [[NetworkParameters]] indicating the network which the message is going to be sent on * @param network the [[org.bitcoins.core.config.NetworkParameters NetworkParameters]] indicating the network which the message is going to be sent on
* @param payload the payload that needs to be sent across the network * @param payload the payload that needs to be sent across the network
* @return * @return
*/ */

View file

@ -384,7 +384,7 @@ case object MemPoolMessage extends DataPayload {
* *
* @see [[https://bitcoin.org/en/developer-reference#merkleblock]] * @see [[https://bitcoin.org/en/developer-reference#merkleblock]]
* *
* @param merkleBlock The actual [[MerkleBlock]] that this message represents * @param merkleBlock The actual [[org.bitcoins.core.protocol.blockchain.MerkleBlock MerkleBlock]] that this message represents
*/ */
case class MerkleBlockMessage(merkleBlock: MerkleBlock) extends DataPayload { case class MerkleBlockMessage(merkleBlock: MerkleBlock) extends DataPayload {

View file

@ -168,10 +168,11 @@ object PartialMerkleTree {
/** /**
* This loops through our merkle tree building `bits` so we can instruct another node how to create the partial merkle tree * This loops through our merkle tree building `bits` so we can instruct another node how to create the partial merkle tree
* [[https://github.com/bitcoin/bitcoin/blob/b7b48c8bbdf7a90861610b035d8b0a247ef78c45/src/merkleblock.cpp#L78]] * @see [[https://github.com/bitcoin/bitcoin/blob/b7b48c8bbdf7a90861610b035d8b0a247ef78c45/src/merkleblock.cpp#L78]]
* @param bits the accumulator for bits indicating how to reconsctruct the partial merkle tree * @param bits the accumulator for bits indicating how to reconsctruct the partial merkle tree
* @param hashes the relevant hashes used with bits to reconstruct the merkle tree * @param hashes the relevant hashes used with bits to reconstruct the merkle tree
* @param height the transaction index we are currently looking at -- if it was matched in our bloom filter we need the entire merkle branch * @param height the transaction index we are currently looking at -- if it was matched in our bloom filter we need the entire merkle branch
* @param pos the position in the loop represented as an int
* @return the binary tree that represents the partial merkle tree, the bits needed to reconstruct this partial merkle tree, and the hashes needed to be inserted * @return the binary tree that represents the partial merkle tree, the bits needed to reconstruct this partial merkle tree, and the hashes needed to be inserted
* according to the flags inside of bits * according to the flags inside of bits
*/ */

View file

@ -54,7 +54,7 @@ sealed abstract class RawSerializerHelper {
cmpct.bytes ++ serialized cmpct.bytes ++ serialized
} }
/** Serializes a [[Seq]] of [[org.bitcoins.core.protocol.NetworkElement]] to a [[scodec.bits.ByteVector]] */ /** Serializes a [[scala.Seq Seq]] of [[org.bitcoins.core.protocol.NetworkElement]] to a [[scodec.bits.ByteVector]] */
def writeNetworkElements[T <: NetworkElement](ts: Seq[T]): ByteVector = { def writeNetworkElements[T <: NetworkElement](ts: Seq[T]): ByteVector = {
val f = { t: T => val f = { t: T =>
t.bytes t.bytes

View file

@ -3,9 +3,9 @@ package org.bitcoins.core.serializers.p2p
import java.net.InetAddress import java.net.InetAddress
import org.bitcoins.core.number.UInt32 import org.bitcoins.core.number.UInt32
import org.bitcoins.core.serializers.RawBitcoinSerializer
import org.bitcoins.core.util.{BitcoinSLogger, NumberUtil}
import org.bitcoins.core.p2p._ import org.bitcoins.core.p2p._
import org.bitcoins.core.serializers.RawBitcoinSerializer
import org.bitcoins.core.util.BitcoinSLogger
import scodec.bits.ByteVector import scodec.bits.ByteVector
/** /**

View file

@ -6,7 +6,7 @@ import org.bitcoins.core.p2p._
import scodec.bits.ByteVector import scodec.bits.ByteVector
/** /**
* Responsible for serializing and deserializing a [[FilterAddMessage]] * Responsible for serializing and deserializing a [[org.bitcoins.core.p2p.FilterAddMessage FilterAddMessage]]
* @see [[https://bitcoin.org/en/developer-reference#filteradd]] * @see [[https://bitcoin.org/en/developer-reference#filteradd]]
*/ */
trait RawFilterAddMessageSerializer trait RawFilterAddMessageSerializer

View file

@ -6,8 +6,8 @@ import org.bitcoins.core.p2p.FilterLoadMessage
import scodec.bits.ByteVector import scodec.bits.ByteVector
/** /**
* Serializes and deserializes a [[FilterLoadMessage]] * Serializes and deserializes a [[org.bitcoins.core.p2p.FilterLoadMessage FilterLoadMessage]]
* @see https://bitcoin.org/en/developer-reference#filterload * @see [[https://bitcoin.org/en/developer-reference#filterload]]
*/ */
trait RawFilterLoadMessageSerializer trait RawFilterLoadMessageSerializer
extends RawBitcoinSerializer[FilterLoadMessage] { extends RawBitcoinSerializer[FilterLoadMessage] {

View file

@ -72,7 +72,7 @@ abstract class DbCommonsColumnMappers {
MappedColumnType MappedColumnType
.base[Sha256Hash160Digest, String](_.hex, Sha256Hash160Digest.fromHex) .base[Sha256Hash160Digest, String](_.hex, Sha256Hash160Digest.fromHex)
/** Responsible for mapping a [[UInt32]] to a long in Slick, and vice versa */ /** Responsible for mapping a [[org.bitcoins.core.number.UInt32 UInt32]] to a long in Slick, and vice versa */
implicit val uInt32Mapper: BaseColumnType[UInt32] = implicit val uInt32Mapper: BaseColumnType[UInt32] =
MappedColumnType.base[UInt32, Long]( MappedColumnType.base[UInt32, Long](
tmap = _.toLong, tmap = _.toLong,
@ -83,7 +83,7 @@ abstract class DbCommonsColumnMappers {
MappedColumnType.base[Int32, Long](tmap = _.toLong, tcomap = Int32(_)) MappedColumnType.base[Int32, Long](tmap = _.toLong, tcomap = Int32(_))
} }
/** Responsible for mapping a [[TransactionOutput]] to hex in Slick, and vice versa */ /** Responsible for mapping a [[org.bitcoins.core.protocol.transaction.TransactionOutput TransactionOutput]] to hex in Slick, and vice versa */
implicit val transactionOutputMapper: BaseColumnType[TransactionOutput] = { implicit val transactionOutputMapper: BaseColumnType[TransactionOutput] = {
MappedColumnType.base[TransactionOutput, String]( MappedColumnType.base[TransactionOutput, String](
_.hex, _.hex,

View file

@ -190,7 +190,7 @@ trait EclairApi {
/** /**
* Pings eclair to see if a invoice has been paid and returns [[org.bitcoins.eclair.rpc.json.PaymentResult PaymentResult]] * Pings eclair to see if a invoice has been paid and returns [[org.bitcoins.eclair.rpc.json.PaymentResult PaymentResult]]
* *
* @param paymentId the payment id returnned by [[org.bitcoins.eclair.rpc.api.EclairApi.payInvoice()]] * @param paymentId the payment id returnned by [[org.bitcoins.eclair.rpc.api.EclairApi.payInvoice payInvoice]]
* @param interval the ping interval * @param interval the ping interval
* @param maxAttempts the maximum number of pings * @param maxAttempts the maximum number of pings
* *

View file

@ -22,7 +22,7 @@ import akka.util.CompactByteString
* with the p2p network. It's responsibly is to deal with low * with the p2p network. It's responsibly is to deal with low
* level .TCP messages. * level .TCP messages.
* *
* If the client receives a [[NetworkMessage]], from a * If the client receives a [[org.bitcoins.core.p2p.NetworkMessage NetworkMessage]], from a
* [[org.bitcoins.node.networking.peer.PeerMessageSender PeerMessageSender]] * [[org.bitcoins.node.networking.peer.PeerMessageSender PeerMessageSender]]
* it serializes the message to it to a [[akka.util.ByteString]] and then * it serializes the message to it to a [[akka.util.ByteString]] and then
* sends it to the internal `manager` which streams the data to our peer * sends it to the internal `manager` which streams the data to our peer

View file

@ -22,9 +22,9 @@ import org.bitcoins.node.config.NodeAppConfig
import org.bitcoins.core.p2p.TypeIdentifier import org.bitcoins.core.p2p.TypeIdentifier
import org.bitcoins.core.p2p.MsgUnassigned import org.bitcoins.core.p2p.MsgUnassigned
/** This actor is meant to handle a [[org.bitcoins.node.messages.DataPayload]] /** This actor is meant to handle a [[org.bitcoins.core.p2p.DataPayload DataPayload]]
* that a peer to sent to us on the p2p network, for instance, if we a receive a * that a peer to sent to us on the p2p network, for instance, if we a receive a
* [[HeadersMessage]] we should store those headers in our database * [[org.bitcoins.core.p2p.HeadersMessage HeadersMessage]] we should store those headers in our database
*/ */
class DataMessageHandler(callbacks: SpvNodeCallbacks)( class DataMessageHandler(callbacks: SpvNodeCallbacks)(
implicit ec: ExecutionContext, implicit ec: ExecutionContext,

View file

@ -20,10 +20,10 @@ import org.bitcoins.node.SpvNodeCallbacks
/** /**
* Responsible for receiving messages from a peer on the * Responsible for receiving messages from a peer on the
* p2p network. This is called by [[Client]] when doing the p2p * p2p network. This is called by [[org.bitcoins.rpc.client.common.Client Client]] when doing the p2p
* handshake and during the [[PeerMessageReceiverState.Normal Normal]] * handshake and during the [[PeerMessageReceiverState.Normal Normal]]
* operations. This is the entry point for handling all received * operations. This is the entry point for handling all received
* [[NetworkMessage]] * [[org.bitcoins.core.p2p.NetworkMessage NetworkMessage]]
*/ */
class PeerMessageReceiver( class PeerMessageReceiver(
state: PeerMessageReceiverState, state: PeerMessageReceiverState,

View file

@ -9,18 +9,18 @@ import scala.concurrent.{Future, Promise}
sealed abstract class PeerMessageReceiverState extends BitcoinSLogger { sealed abstract class PeerMessageReceiverState extends BitcoinSLogger {
/** This promise gets completed when we receive a /** This promise gets completed when we receive a
* [[akka.io.Tcp.Connected]] message from [[Client]] * [[akka.io.Tcp.Connected]] message from [[org.bitcoins.node.networking.P2PClient P2PClient]]
*/ */
def clientConnectP: Promise[P2PClient] def clientConnectP: Promise[P2PClient]
/** The [[org.bitcoins.node.networking.Client]] we are /** The [[org.bitcoins.node.networking.P2PClient P2PClient]] we are
* connected to. This isn't initiated until the client * connected to. This isn't initiated until the client
* has called [[PeerMessageReceiver.connect()]] * has called [[org.bitcoins.node.networking.peer.PeerMessageReceiver.connect() connect()]]
*/ */
private val clientConnectF: Future[P2PClient] = clientConnectP.future private val clientConnectF: Future[P2PClient] = clientConnectP.future
/** This promise is completed in the [[PeerMessageReceiver.disconnect()]] /** This promise is completed in the [[org.bitcoins.node.networking.peer.PeerMessageReceiver.disconnect() disconnect()]]
* when a [[Client]] initiates a disconnections from * when a [[org.bitcoins.node.networking.P2PClient P2PClient]] initiates a disconnections from
* our peer on the p2p network * our peer on the p2p network
*/ */
def clientDisconnectP: Promise[Unit] def clientDisconnectP: Promise[Unit]
@ -31,7 +31,7 @@ sealed abstract class PeerMessageReceiverState extends BitcoinSLogger {
* connected to our client. Note, there is * connected to our client. Note, there is
* no timeout on this future and no guarantee * no timeout on this future and no guarantee
* that some one has actually initiated * that some one has actually initiated
* a connection with a [[Client]] * a connection with a [[org.bitcoins.node.networking.P2PClient P2PClient]]
* @return * @return
*/ */
def isConnected: Boolean = { def isConnected: Boolean = {
@ -45,7 +45,7 @@ sealed abstract class PeerMessageReceiverState extends BitcoinSLogger {
def versionMsgP: Promise[VersionMessage] def versionMsgP: Promise[VersionMessage]
/** This future is completed when our peer has sent /** This future is completed when our peer has sent
* us their [[VersionMessage]] indicating what protocol * us their [[org.bitcoins.core.p2p.VersionMessage VersionMessage]] indicating what protocol
* features they support * features they support
*/ */
def hasReceivedVersionMsg: Future[VersionMessage] = { def hasReceivedVersionMsg: Future[VersionMessage] = {
@ -55,8 +55,8 @@ sealed abstract class PeerMessageReceiverState extends BitcoinSLogger {
def verackMsgP: Promise[VerAckMessage.type] def verackMsgP: Promise[VerAckMessage.type]
/** This future completes when we have received a /** This future completes when we have received a
* [[VerAckMessage]] from our peer. This means our * [[org.bitcoins.core.p2p.VerAckMessage VerAckMessage]] from our peer. This means our
* peer has accepted our [[VersionMessage]] and is * peer has accepted our [[org.bitcoins.core.p2p.VersionMessage VersionMessage]] and is
* willing to connect with us * willing to connect with us
* @return * @return
*/ */
@ -67,7 +67,7 @@ sealed abstract class PeerMessageReceiverState extends BitcoinSLogger {
/** Indicates we have connected and completed the initial /** Indicates we have connected and completed the initial
* handshake that is required to connect to the bitcoin p2p network * handshake that is required to connect to the bitcoin p2p network
* If this is true, we can start sending and receiving normal * If this is true, we can start sending and receiving normal
* [[NetworkMessage]] with our peer on the network * [[org.bitcoins.core.p2p.NetworkMessage NetworkMessage]] with our peer on the network
* @return * @return
*/ */
def isInitialized: Boolean = { def isInitialized: Boolean = {
@ -77,7 +77,7 @@ sealed abstract class PeerMessageReceiverState extends BitcoinSLogger {
object PeerMessageReceiverState { object PeerMessageReceiverState {
/** Represents a [[org.bitcoins.node.networking.peer.PeerMessageReceiverState]] /** Represents a [[org.bitcoins.node.networking.peer.PeerMessageReceiverState PeerMessageReceiverState]]
* where the peer is not connected to the p2p network * where the peer is not connected to the p2p network
*/ */
final case object Preconnection extends PeerMessageReceiverState { final case object Preconnection extends PeerMessageReceiverState {
@ -88,7 +88,7 @@ object PeerMessageReceiverState {
def versionMsgP: Promise[VersionMessage] = Promise[VersionMessage]() def versionMsgP: Promise[VersionMessage] = Promise[VersionMessage]()
def verackMsgP: Promise[VerAckMessage.type] = Promise[VerAckMessage.type]() def verackMsgP: Promise[VerAckMessage.type] = Promise[VerAckMessage.type]()
/** Converts [[org.bitcoins.node.networking.peer.PeerMessageReceiverState.Preconnection]] to [[Initializing]] */ /** Converts [[org.bitcoins.node.networking.peer.PeerMessageReceiverState.Preconnection Preconnection]] to [[Initializing]] */
def toInitializing(client: P2PClient): Initializing = { def toInitializing(client: P2PClient): Initializing = {
val p = clientConnectP val p = clientConnectP
p.success(client) p.success(client)
@ -103,7 +103,7 @@ object PeerMessageReceiverState {
/** Means that our [[org.bitcoins.node.networking.peer.PeerMessageReceiver]] /** Means that our [[org.bitcoins.node.networking.peer.PeerMessageReceiver]]
* is still going through the initilization process. This means * is still going through the initilization process. This means
* we still need to receive a [[VersionMessage]] or [[VerAckMessage]] * we still need to receive a [[org.bitcoins.core.p2p.VersionMessage VersionMessage]] or [[org.bitcoins.core.p2p.VerAckMessage VerAckMessage]]
* from our peer on the p2p network * from our peer on the p2p network
*/ */
case class Initializing( case class Initializing(
@ -117,7 +117,7 @@ object PeerMessageReceiverState {
"We cannot have a PeerMessageReceiverState.Initializng if we are not connected") "We cannot have a PeerMessageReceiverState.Initializng if we are not connected")
/** Helper method to modifing the state of [[org.bitcoins.node.networking.peer.PeerMessageReceiverState.Initializing]] /** Helper method to modifing the state of [[org.bitcoins.node.networking.peer.PeerMessageReceiverState.Initializing]]
* when we receive a [[VersionMessage]]. This completes versoinMsgP * when we receive a [[org.bitcoins.core.p2p.VersionMessage VersionMessage]]. This completes versoinMsgP
* @return * @return
*/ */
def withVersionMsg(versionMsg: VersionMessage): Initializing = { def withVersionMsg(versionMsg: VersionMessage): Initializing = {
@ -130,7 +130,7 @@ object PeerMessageReceiverState {
} }
/** Completes the verack message promise and transitions /** Completes the verack message promise and transitions
* our [[PeerMessageReceiverState]] to [[PeerMessageReceiverState.Normal]] * our [[org.bitcoins.node.networking.peer.PeerMessageReceiverState PeerMessageReceiverState]] to [[org.bitcoins.node.networking.peer.PeerMessageReceiverState.Normal PeerMessageReceiverState.Normal]]
*/ */
def toNormal(verAckMessage: VerAckMessage.type): Normal = { def toNormal(verAckMessage: VerAckMessage.type): Normal = {
Normal( Normal(

View file

@ -26,7 +26,7 @@ case class PeerMessageSender(client: P2PClient)(implicit conf: NodeAppConfig)
(client.actor ! Tcp.Close) (client.actor ! Tcp.Close)
} }
/** Sends a [[org.bitcoins.node.messages.VersionMessage VersionMessage]] to our peer */ /** Sends a [[org.bitcoins.core.p2p.VersionMessage VersionMessage]] to our peer */
def sendVersionMessage(): Unit = { def sendVersionMessage(): Unit = {
val versionMsg = VersionMessage(client.peer.socket, conf.network) val versionMsg = VersionMessage(client.peer.socket, conf.network)
logger.trace(s"Sending versionMsg=$versionMsg to peer=${client.peer}") logger.trace(s"Sending versionMsg=$versionMsg to peer=${client.peer}")

View file

@ -99,10 +99,10 @@ abstract class BlockHeaderHelper {
nonce = bh.nonce) nonce = bh.nonce)
} }
/** Buidls a block header on top the given prev header /** Builds a block header on top the given prev header
* The only consensus requirement that this method adheres to * The only consensus requirement that this method adheres to
* with the returned [[BlockHeaderDb]] is that * with the returned [[org.bitcoins.chain.models.BlockHeaderDb]] is that
* 1. We reference the [[prevHeader.blockHeader.hash]] correct * 1. We reference the [[org.bitcoins.chain.models.BlockHeaderDb.blockHeader.hash]] correct
* 2. We increment the height of [[prevHeader]] by one * 2. We increment the height of [[prevHeader]] by one
* @param prevHeader * @param prevHeader
* @return * @return

View file

@ -259,7 +259,7 @@ trait ChainUnitTest
} }
/** /**
* Creates a [[BitcoindRpcClient bitcoind]] that is linked to our [[ChainHandler bitcoin-s chain handler]] * Creates a [[org.bitcoins.rpc.client.common.BitcoindRpcClient BitcoindRpcClient]] that is linked to our [[org.bitcoins.chain.blockchain.ChainHandler ChainHandler]]
* via a [[org.bitcoins.zmq.ZMQSubscriber zmq]]. This means messages are passed between bitcoin and our chain handler * via a [[org.bitcoins.zmq.ZMQSubscriber zmq]]. This means messages are passed between bitcoin and our chain handler
* with a zmq pub/sub message passing * with a zmq pub/sub message passing
* @param test the test to be executed with bitcoind and chain handler via zmq * @param test the test to be executed with bitcoind and chain handler via zmq

View file

@ -17,9 +17,6 @@ import scala.concurrent.Await
import scala.concurrent.ExecutionContext.Implicits.global import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.duration.DurationInt import scala.concurrent.duration.DurationInt
/**
* Created by chris on 6/22/16.
*/
//TODO: Need to provide generators for [[NonStandardScriptSignature]] and [[NonStandardScriptPubKey]] //TODO: Need to provide generators for [[NonStandardScriptSignature]] and [[NonStandardScriptPubKey]]
sealed abstract class ScriptGenerators extends BitcoinSLogger { sealed abstract class ScriptGenerators extends BitcoinSLogger {
val timeout = 5.seconds val timeout = 5.seconds
@ -51,9 +48,10 @@ sealed abstract class ScriptGenerators extends BitcoinSLogger {
def emptyScriptSignature = p2pkhScriptSignature.map(_ => EmptyScriptSignature) def emptyScriptSignature = p2pkhScriptSignature.map(_ => EmptyScriptSignature)
/** /**
* Generates a [[org.bitcoins.core.protocol.script.P2SHScriptSignature P2SHScriptSignature]] * Generates a P2SH script signature
* WARNING: the redeem script and the script signature DO NOT evaluate to true *
* if executed by [[org.bitcoins.core.script.interpreter.ScriptInterpreter ScriptInterpreter]] * @note the redeem script and the script signature DO NOT evaluate to true
* if executed by [[org.bitcoins.core.script.interpreter.ScriptInterpreter]]
*/ */
def p2shScriptSignature: Gen[P2SHScriptSignature] = def p2shScriptSignature: Gen[P2SHScriptSignature] =
for { for {
@ -159,8 +157,8 @@ sealed abstract class ScriptGenerators extends BitcoinSLogger {
Gen.oneOf(p2wpkhSPKV0, p2wshSPKV0) Gen.oneOf(p2wpkhSPKV0, p2wshSPKV0)
/** /**
* Creates an [[org.bitcoins.core.protocol.script.UnassignedWitnessScriptPubKey UnassignedWitnessScriptPubKey]], * Creates an unassigned witness scriptPubKey.
* currently this is any witness script pubkey besides * Currently this is any witness script pubkey besides
* [[org.bitcoins.core.protocol.script.WitnessScriptPubKeyV0 WitnessScriptPubKeyV0]] * [[org.bitcoins.core.protocol.script.WitnessScriptPubKeyV0 WitnessScriptPubKeyV0]]
*/ */
def unassignedWitnessScriptPubKey: Gen[ def unassignedWitnessScriptPubKey: Gen[
@ -171,7 +169,7 @@ sealed abstract class ScriptGenerators extends BitcoinSLogger {
unassignedAsm = version +: witV0.asm.tail unassignedAsm = version +: witV0.asm.tail
} yield (UnassignedWitnessScriptPubKey(unassignedAsm), privKeys) } yield (UnassignedWitnessScriptPubKey(unassignedAsm), privKeys)
/** Generates an arbitrary [[org.bitcoins.core.protocol.script.WitnessScriptPubKey WitnessScriptPubKey]] */ /** Generates an arbitrary `WitnessScriptPubKey` */
def witnessScriptPubKey: Gen[(WitnessScriptPubKey, Seq[ECPrivateKey])] = def witnessScriptPubKey: Gen[(WitnessScriptPubKey, Seq[ECPrivateKey])] =
Gen.oneOf(assignedWitnessScriptPubKey, unassignedWitnessScriptPubKey) Gen.oneOf(assignedWitnessScriptPubKey, unassignedWitnessScriptPubKey)
@ -224,7 +222,7 @@ sealed abstract class ScriptGenerators extends BitcoinSLogger {
def lockTimeScriptSig: Gen[LockTimeScriptSignature] = def lockTimeScriptSig: Gen[LockTimeScriptSignature] =
Gen.oneOf(csvScriptSignature, cltvScriptSignature) Gen.oneOf(csvScriptSignature, cltvScriptSignature)
/** Generates an arbitrary [[org.bitcoins.core.protocol.script.ScriptPubKey ScriptPubKey]] */ /** Generates an arbitrary `ScriptPubKey` */
def scriptPubKey: Gen[(ScriptPubKey, Seq[ECPrivateKey])] = { def scriptPubKey: Gen[(ScriptPubKey, Seq[ECPrivateKey])] = {
Gen.oneOf( Gen.oneOf(
p2pkScriptPubKey.map(privKeyToSeq(_)), p2pkScriptPubKey.map(privKeyToSeq(_)),
@ -241,7 +239,7 @@ sealed abstract class ScriptGenerators extends BitcoinSLogger {
) )
} }
/** Generates an arbitrary [[org.bitcoins.core.protocol.script.ScriptSignature ScriptSignature]] */ /** Generates an arbitrary `ScriptSignature` */
def scriptSignature: Gen[ScriptSignature] = { def scriptSignature: Gen[ScriptSignature] = {
Gen.oneOf( Gen.oneOf(
p2pkScriptSignature, p2pkScriptSignature,
@ -256,8 +254,8 @@ sealed abstract class ScriptGenerators extends BitcoinSLogger {
} }
/** /**
* Generates a [[org.bitcoins.core.protocol.script.ScriptSignature ScriptSignature]] corresponding to the type of * Generates a `ScriptSignature` corresponding to the type of
* [[org.bitcoins.core.protocol.script.ScriptPubKey ScriptPubKey]] given. * `ScriptPubKey` given.
* Note: Does NOT generate a correct/valid signature * Note: Does NOT generate a correct/valid signature
*/ */
private def pickCorrespondingScriptSignature( private def pickCorrespondingScriptSignature(
@ -278,12 +276,12 @@ sealed abstract class ScriptGenerators extends BitcoinSLogger {
} }
/** /**
* Generates a signed [[org.bitcoins.core.protocol.script.P2PKScriptSignature P2PKScriptSignature]] that spends the * Generates a signed `P2PKScriptSignature` that spends the
* [[org.bitcoins.core.protocol.script.P2PKScriptPubKey P2PKScriptPubKey]] correctly * `P2PKScriptPubKey` correctly
* *
* @return the signed [[org.bitcoins.core.protocol.script.P2PKScriptSignature P2PKScriptSignature]], * @return the signed `P2PKScriptSignature`,
* the [[org.bitcoins.core.protocol.script.P2PKScriptPubKey P2PKScriptPubKey]] it spends, and the * the `P2PKScriptPubKey` it spends, and the
* [[org.bitcoins.core.crypto.ECPrivateKey ECPrivateKey]] used to sign the scriptSig * `ECPrivateKey` used to sign the scriptSig
*/ */
def signedP2PKScriptSignature: Gen[ def signedP2PKScriptSignature: Gen[
(P2PKScriptSignature, P2PKScriptPubKey, ECPrivateKey)] = (P2PKScriptSignature, P2PKScriptPubKey, ECPrivateKey)] =
@ -313,12 +311,12 @@ sealed abstract class ScriptGenerators extends BitcoinSLogger {
} yield (signedScriptSig, scriptPubKey, privateKey) } yield (signedScriptSig, scriptPubKey, privateKey)
/** /**
* Generates a signed [[org.bitcoins.core.protocol.script.P2PKHScriptSignature P2PKHScriptSignature]] that * Generates a signed `P2PKHScriptSignature` that
* spends the [[org.bitcoins.core.protocol.script.P2PKHScriptPubKey P2PKHScriptPubKey]] correctly * spends the `P2PKHScriptPubKey` correctly
* *
* @return the signed [[org.bitcoins.core.protocol.script.P2PKHScriptSignature P2PKHScriptSignature]], the * @return the signed `P2PKHScriptSignature`, the
* [[org.bitcoins.core.protocol.script.P2PKHScriptPubKey P2PKHScriptPubKey]] it spends, and the * `P2PKHScriptPubKey` it spends, and the
* [[org.bitcoins.core.crypto.ECPrivateKey ECPrivateKey]] used to sign the scriptSig * `ECPrivateKey` used to sign the scriptSig
*/ */
def signedP2PKHScriptSignature: Gen[ def signedP2PKHScriptSignature: Gen[
(P2PKHScriptSignature, P2PKHScriptPubKey, ECPrivateKey)] = (P2PKHScriptSignature, P2PKHScriptPubKey, ECPrivateKey)] =
@ -347,12 +345,12 @@ sealed abstract class ScriptGenerators extends BitcoinSLogger {
/** /**
* Generates a signed * Generates a signed
* [[org.bitcoins.core.protocol.script.MultiSignatureScriptSignature MultiSignatureScriptSignature]] that spends the * `MultiSignatureScriptSignature` that spends the
* [[org.bitcoins.core.protocol.script.MultiSignatureScriptPubKey MultiSignatureScriptPubKey]] correctly * `MultiSignatureScriptPubKey` correctly
* ti * ti
* @return the signed [[org.bitcoins.core.protocol.script.MultiSignatureScriptSignature MultiSignatureScriptSignature]], * @return the signed `MultiSignatureScriptSignature`,
* the [[org.bitcoins.core.protocol.script.MultiSignatureScriptPubKey MultiSignatureScriptPubKey]] it spends and the * the `MultiSignatureScriptPubKey` it spends and the
* sequence of [[org.bitcoins.core.crypto.ECPrivateKey ECPrivateKey]] used to sign the scriptSig * sequence of `ECPrivateKey` used to sign the scriptSig
*/ */
def signedMultiSignatureScriptSignature: Gen[( def signedMultiSignatureScriptSignature: Gen[(
MultiSignatureScriptSignature, MultiSignatureScriptSignature,
@ -385,12 +383,12 @@ sealed abstract class ScriptGenerators extends BitcoinSLogger {
} yield (signedScriptSig, multiSigScriptPubKey, privateKeys) } yield (signedScriptSig, multiSigScriptPubKey, privateKeys)
/** /**
* Generates a signed [[org.bitcoins.core.protocol.script.P2SHScriptSignature P2SHScriptSignature]] * Generates a signed `P2SHScriptSignature`
* that spends from a [[org.bitcoins.core.protocol.script.P2SHScriptPubKey P2SHScriptPubKey]] correctly * that spends from a `P2SHScriptPubKey` correctly
* *
* @return the signed [[org.bitcoins.core.protocol.script.P2SHScriptSignature P2SHScriptSignature]], * @return the signed `P2SHScriptSignature`,
* the [[org.bitcoins.core.protocol.script.P2SHScriptPubKey P2SHScriptPubKey]] it spends, and the * the `P2SHScriptPubKey` it spends, and the
* sequence of [[org.bitcoins.core.crypto.ECPrivateKey ECPrivateKey]] * sequence of `ECPrivateKey`
* used to sign the scriptSig * used to sign the scriptSig
*/ */
def signedP2SHScriptSignature: Gen[ def signedP2SHScriptSignature: Gen[
@ -402,12 +400,9 @@ sealed abstract class ScriptGenerators extends BitcoinSLogger {
} yield (p2SHScriptSignature, p2SHScriptPubKey, privateKeys) } yield (p2SHScriptSignature, p2SHScriptPubKey, privateKeys)
/** /**
* Generates a signed [[org.bitcoins.core.protocol.script.P2SHScriptSignature CLTVScriptSignature]] that spends * @return the signed `CLTVScriptSignature`, the
* from a [[org.bitcoins.core.protocol.script.P2SHScriptSignature CLTVScriptPubKey]] correctly * `CLTVScriptPubKey` it spends, and the
* * sequences of `ECPrivateKey`
* @return the signed [[org.bitcoins.core.protocol.script.CLTVScriptSignature CLTVScriptSignature]], the
* [[org.bitcoins.core.protocol.script.CLTVScriptPubKey CLTVScriptPubKey]] it spends, and the
* sequences of [[org.bitcoins.core.crypto.ECPrivateKey ECPrivateKey]]
* used to sign the scriptSig * used to sign the scriptSig
*/ */
def signedCLTVScriptSignature( def signedCLTVScriptSignature(
@ -450,12 +445,12 @@ sealed abstract class ScriptGenerators extends BitcoinSLogger {
} }
/** /**
* Generates a signed [[org.bitcoins.core.protocol.script.CLTVScriptSignature CSVScriptSignature]] that spends * Generates a signed `CLTVScriptSignature` that spends
* from a [[org.bitcoins.core.protocol.script.CLTVScriptSignature CSVScriptPubKey]] correctly * from a `CLTVScriptSignature` correctly
* *
* @return the signed [[org.bitcoins.core.protocol.script.CSVScriptSignature CSVScriptSignature]], the * @return the signed `CSVScriptSignature`, the
* [[org.bitcoins.core.protocol.script.CSVScriptPubKey CSVScriptPubKey]] it spends, and the * `CSVScriptPubKey` it spends, and the
* sequences of [[org.bitcoins.core.crypto.ECPrivateKey ECPrivateKey]] * sequences of `ECPrivateKey`
* used to sign the scriptSig * used to sign the scriptSig
*/ */
def signedCSVScriptSignature( def signedCSVScriptSignature(
@ -511,15 +506,15 @@ sealed abstract class ScriptGenerators extends BitcoinSLogger {
sequence) sequence)
} yield scriptSig } yield scriptSig
/** Generates a [[org.bitcoins.core.protocol.script.LockTimeScriptSignature LockTimeScriptSignature]] and /** Generates a `LockTimeScriptSignature` and
* [[org.bitcoins.core.protocol.script.LockTimeScriptPubKey LockTimeScriptPubKey]] pair that are valid when * `LockTimeScriptPubKey` pair that are valid when
* run through the interpreter */ * run through the interpreter */
def signedLockTimeScriptSignature: Gen[ def signedLockTimeScriptSignature: Gen[
(LockTimeScriptSignature, LockTimeScriptPubKey, Seq[ECPrivateKey])] = { (LockTimeScriptSignature, LockTimeScriptPubKey, Seq[ECPrivateKey])] = {
Gen.oneOf(signedCSVScriptSignature, signedCLTVScriptSignature) Gen.oneOf(signedCSVScriptSignature, signedCLTVScriptSignature)
} }
/** Helper function to generate [[org.bitcoins.core.protocol.script.LockTimeScriptSignature LockTimeScriptSignature]]s */ /** Helper function to generate LockTimeScriptSignatures */
private def lockTimeHelper( private def lockTimeHelper(
lockTime: Option[UInt32], lockTime: Option[UInt32],
sequence: UInt32, sequence: UInt32,
@ -603,14 +598,14 @@ sealed abstract class ScriptGenerators extends BitcoinSLogger {
wtxSigComponent.amount) wtxSigComponent.amount)
/** /**
* This function chooses a random signed [[org.bitcoins.core.protocol.script.ScriptSignature ScriptSignature]] * This function chooses a random signed `ScriptSignature`
* that is NOT a [[org.bitcoins.core.protocol.script.P2SHScriptSignature P2SHScriptSignature]], * that is NOT a `P2SHScriptSignature`,
* [[org.bitcoins.core.protocol.script.CSVScriptSignature CSVScriptSignature]], * `CSVScriptSignature`,
* [[org.bitcoins.core.protocol.script.CLTVScriptSignature CLTVScriptSignature]], or any witness type * `CLTVScriptSignature`, or any witness type
* *
* @return the signed [[org.bitcoins.core.protocol.script.ScriptSignature ScriptSignature]], * @return the signed `ScriptSignature`,
* the [[org.bitcoins.core.protocol.script.ScriptPubKey ScriptPubKey]] it is spending, * the `ScriptPubKey` it is spending,
* and the sequence of [[org.bitcoins.core.crypto.ECPublicKey ECPrivateKey]] used to sign it * and the sequence of `ECPrivateKey` used to sign it
*/ */
def chooseSignedScriptSig: Gen[ def chooseSignedScriptSig: Gen[
(ScriptSignature, ScriptPubKey, Seq[ECPrivateKey])] = { (ScriptSignature, ScriptPubKey, Seq[ECPrivateKey])] = {
@ -621,9 +616,9 @@ sealed abstract class ScriptGenerators extends BitcoinSLogger {
) )
} }
/** Generates a random [[org.bitcoins.core.protocol.script.ScriptSignature ScriptSignature]], the /** Generates a random `ScriptSignature`, the
* [[org.bitcoins.core.protocol.script.ScriptPubKey ScriptPubKey]] it is spending, and the * `ScriptPubKey` it is spending, and the
* [[org.bitcoins.core.crypto.ECPrivateKey ECPrivateKey]] needed to spend it. */ * `ECPrivateKey` needed to spend it. */
def randomScriptSig: Gen[(ScriptSignature, ScriptPubKey, Seq[ECPrivateKey])] = { def randomScriptSig: Gen[(ScriptSignature, ScriptPubKey, Seq[ECPrivateKey])] = {
val witP2SHP2WPKH = val witP2SHP2WPKH =
signedP2SHP2WPKHScriptSignature.map(x => (x._1, x._2, x._3)) signedP2SHP2WPKHScriptSignature.map(x => (x._1, x._2, x._3))

View file

@ -15,7 +15,7 @@ import org.scalacheck.Gen
*/ */
sealed abstract class WitnessGenerators extends BitcoinSLogger { sealed abstract class WitnessGenerators extends BitcoinSLogger {
/** Generates a random [[org.bitcoins.core.protocol.script.ScriptWitness ScriptWitness]] */ /** Generates a random [[org.bitcoins.core.protocol.script.ScriptWitness]] */
def scriptWitness: Gen[ScriptWitness] = { def scriptWitness: Gen[ScriptWitness] = {
//TODO: I need to come back and uncomment out this code after fixing //TODO: I need to come back and uncomment out this code after fixing
@ -38,7 +38,7 @@ sealed abstract class WitnessGenerators extends BitcoinSLogger {
Gen.oneOf(p2wpkhWitnessV0, p2wshWitnessV0) Gen.oneOf(p2wpkhWitnessV0, p2wshWitnessV0)
} }
/** Generates a [[org.bitcoins.core.protocol.transaction.TransactionWitness TransactionWitness]] with /** Generates a [[org.bitcoins.core.protocol.transaction.TransactionWitness]] with
* the specified number of witnesses */ * the specified number of witnesses */
def transactionWitness(numWitnesses: Int): Gen[TransactionWitness] = def transactionWitness(numWitnesses: Int): Gen[TransactionWitness] =
for { for {
@ -51,7 +51,7 @@ sealed abstract class WitnessGenerators extends BitcoinSLogger {
wit <- transactionWitness(num) wit <- transactionWitness(num)
} yield wit } yield wit
/** Generates a validly signed [[org.bitcoins.core.protocol.transaction.TransactionWitness TransactionWitness]] */ /** Generates a validly signed [[org.bitcoins.core.protocol.transaction.TransactionWitness]] */
def signedP2WPKHTransactionWitness: Gen[ def signedP2WPKHTransactionWitness: Gen[
(TransactionWitness, WitnessTxSigComponent, Seq[ECPrivateKey])] = (TransactionWitness, WitnessTxSigComponent, Seq[ECPrivateKey])] =
for { for {
@ -173,7 +173,7 @@ sealed abstract class WitnessGenerators extends BitcoinSLogger {
/** /**
* Generates a random signed [[org.bitcoins.core.protocol.transaction.TransactionWitness TransactionWitness]] * Generates a random signed [[org.bitcoins.core.protocol.transaction.TransactionWitness TransactionWitness]]
* with the corresponding [[org.bitcoins.core.crypto.WitnessTxSigComponent WitnessTxSigComponent]] * with the corresponding [[org.bitcoins.core.crypto.WitnessTxSigComponent WitnessTxSigComponent]]
* and [[org.bitcoins.core.crypto.ECPrivateKey ECPrivateKey]]s * and [[org.bitcoins.core.crypto.ECPrivateKey ECPrivateKey]]
*/ */
def signedP2WSHTransactionWitness: Gen[ def signedP2WSHTransactionWitness: Gen[
(TransactionWitness, WitnessTxSigComponentRaw, Seq[ECPrivateKey])] = { (TransactionWitness, WitnessTxSigComponentRaw, Seq[ECPrivateKey])] = {
@ -202,14 +202,14 @@ sealed abstract class WitnessGenerators extends BitcoinSLogger {
signedScriptSig signedScriptSig
} }
/** Generates a random [[org.bitcoins.core.protocol.script.P2WPKHWitnessV0 P2WPKHWitnessV0]] */ /** Generates a random [[org.bitcoins.core.protocol.script.P2WPKHWitnessV0 P2PWPKHWitnessV0]] */
def p2wpkhWitnessV0: Gen[P2WPKHWitnessV0] = def p2wpkhWitnessV0: Gen[P2WPKHWitnessV0] =
for { for {
publicKey <- CryptoGenerators.publicKey publicKey <- CryptoGenerators.publicKey
sig <- CryptoGenerators.digitalSignature sig <- CryptoGenerators.digitalSignature
} yield P2WPKHWitnessV0(publicKey, sig) } yield P2WPKHWitnessV0(publicKey, sig)
/** Generates a random [[org.bitcoins.core.protocol.script.P2WSHWitnessV0 P2WSHWitnessV0]] */ /** Generates a random [[org.bitcoins.core.protocol.script.P2WPKHWitnessV0 P2PWPKHWitnessV0]] */
def p2wshWitnessV0: Gen[P2WSHWitnessV0] = def p2wshWitnessV0: Gen[P2WSHWitnessV0] =
for { for {
(redeem, _) <- ScriptGenerators.scriptPubKey (redeem, _) <- ScriptGenerators.scriptPubKey
@ -247,7 +247,7 @@ sealed abstract class WitnessGenerators extends BitcoinSLogger {
(signedTxWitness, signedWtxSigComponent) (signedTxWitness, signedWtxSigComponent)
} }
/** Creates a unsigned [[org.bitcoins.core.crypto.WitnessTxSigComponent WitnessTxSigComponent]] from /** Creates a unsigned [[org.bitcoins.core.crypto.WitnessTxSigComponent]] from
* the given parameters */ * the given parameters */
def createUnsignedRawWTxSigComponent( def createUnsignedRawWTxSigComponent(
witScriptPubKey: WitnessScriptPubKey, witScriptPubKey: WitnessScriptPubKey,

View file

@ -48,7 +48,7 @@ object ControlMessageGenerator {
} }
/** /**
* Generates a random [[VersionMessage]] * Generates a random [[org.bitcoins.core.p2p.VersionMessage VersionMessage]]
* *
* @see [[https://bitcoin.org/en/developer-reference#version]] * @see [[https://bitcoin.org/en/developer-reference#version]]
*/ */
@ -85,7 +85,7 @@ object ControlMessageGenerator {
) )
/** /**
* Generates a [[PingMessage]] * Generates a [[org.bitcoins.core.p2p.PingMessage]]
* *
* @see [[https://bitcoin.org/en/developer-reference#ping]] * @see [[https://bitcoin.org/en/developer-reference#ping]]
*/ */
@ -95,7 +95,7 @@ object ControlMessageGenerator {
} yield PingMessage(uInt64) } yield PingMessage(uInt64)
/** /**
* Generates a [[PongMessage]] * Generates a [[org.bitcoins.core.p2p.PongMessage]]
* *
* @see [[https://bitcoin.org/en/developer-reference#pong]] * @see [[https://bitcoin.org/en/developer-reference#pong]]
*/ */
@ -111,7 +111,7 @@ object ControlMessageGenerator {
} }
/** /**
* Generates a random [[ProtocolVersion]] * Generates a random [[org.bitcoins.core.p2p.ProtocolVersion]]
* *
* @see [[https://bitcoin.org/en/developer-reference#protocol-versions]] * @see [[https://bitcoin.org/en/developer-reference#protocol-versions]]
*/ */
@ -121,7 +121,7 @@ object ControlMessageGenerator {
} yield ProtocolVersion.versions(randomNum) } yield ProtocolVersion.versions(randomNum)
/** /**
* Generates a [[ServiceIdentifier]] * Generates a [[org.bitcoins.core.p2p.ServiceIdentifier]]
* *
* @see [[https://bitcoin.org/en/developer-reference#version]] * @see [[https://bitcoin.org/en/developer-reference#version]]
*/ */
@ -144,7 +144,7 @@ object ControlMessageGenerator {
def portNumber: Gen[Int] = Gen.choose(0, 65535) def portNumber: Gen[Int] = Gen.choose(0, 65535)
/** /**
* Creates a [[FilterLoadMessage]] * Creates a [[org.bitcoins.core.p2p.FilterLoadMessage]]
* *
* @see [[https://bitcoin.org/en/developer-reference#filterload]] * @see [[https://bitcoin.org/en/developer-reference#filterload]]
*/ */
@ -158,7 +158,7 @@ object ControlMessageGenerator {
FilterLoadMessage(ByteVector(filter), UInt32(hashFuncs), tweak, flags) FilterLoadMessage(ByteVector(filter), UInt32(hashFuncs), tweak, flags)
/** /**
* Creates a [[FilterAddMessage]] * Creates a [[org.bitcoins.core.p2p.FilterAddMessage]]
* *
* @see [[https://bitcoin.org/en/developer-reference#filteradd]] * @see [[https://bitcoin.org/en/developer-reference#filteradd]]
*/ */
@ -169,7 +169,7 @@ object ControlMessageGenerator {
} yield FilterAddMessage(elementSize, element.bytes) } yield FilterAddMessage(elementSize, element.bytes)
/** /**
* Creates a [[RejectMessage]] * Creates a [[org.bitcoins.core.p2p.RejectMessage]]
* *
* @see [[https://bitcoin.org/en/developer-reference#reject]] * @see [[https://bitcoin.org/en/developer-reference#reject]]
*/ */

View file

@ -47,7 +47,7 @@ trait DataMessageGenerator {
} }
/** /**
* Generates a random [[GetHeadersMessage]] * Generates a random [[org.bitcoins.core.p2p.GetHeadersMessage]]
* *
* @see [[https://bitcoin.org/en/developer-reference#getheaders]] * @see [[https://bitcoin.org/en/developer-reference#getheaders]]
*/ */
@ -78,7 +78,7 @@ trait DataMessageGenerator {
} yield HeadersMessage(blockHeaders.toVector) } yield HeadersMessage(blockHeaders.toVector)
/** /**
* Generates a random [[TypeIdentifier]] * Generates a random [[org.bitcoins.core.p2p.TypeIdentifier]]
* *
* @see [[https://bitcoin.org/en/developer-reference#data-messages]] * @see [[https://bitcoin.org/en/developer-reference#data-messages]]
*/ */
@ -88,7 +88,7 @@ trait DataMessageGenerator {
} yield TypeIdentifier(UInt32(num)) } yield TypeIdentifier(UInt32(num))
/** /**
* Generates a random [[Inventory]] * Generates a random [[org.bitcoins.core.p2p.Inventory]]
* @see [[https://bitcoin.org/en/developer-reference#term-inventory]] * @see [[https://bitcoin.org/en/developer-reference#term-inventory]]
*/ */
def inventory: Gen[Inventory] = def inventory: Gen[Inventory] =
@ -98,7 +98,7 @@ trait DataMessageGenerator {
} yield Inventory(identifier, hash) } yield Inventory(identifier, hash)
/** /**
* Generates a random [[InventoryMessage]] * Generates a random [[org.bitcoins.core.p2p.InventoryMessage]]
* @see [[https://bitcoin.org/en/developer-reference#inv]] * @see [[https://bitcoin.org/en/developer-reference#inv]]
*/ */
def inventoryMessages: Gen[InventoryMessage] = def inventoryMessages: Gen[InventoryMessage] =
@ -114,7 +114,7 @@ trait DataMessageGenerator {
} }
/** /**
* Generate a random [[GetDataMessage]] * Generate a random [[org.bitcoins.core.p2p.GetDataMessage]]
* @see [[https://bitcoin.org/en/developer-reference#getdata]] * @see [[https://bitcoin.org/en/developer-reference#getdata]]
*/ */
def getDataMessages: Gen[GetDataMessage] = def getDataMessages: Gen[GetDataMessage] =
@ -123,7 +123,7 @@ trait DataMessageGenerator {
} yield GetDataMessage(invMsgs.inventoryCount, invMsgs.inventories) } yield GetDataMessage(invMsgs.inventoryCount, invMsgs.inventories)
/** /**
* Generates a random [[MerkleBlockMessage]] * Generates a random [[org.bitcoins.core.p2p.MerkleBlockMessage]]
* @see [[https://bitcoin.org/en/developer-reference#merkleblock]] * @see [[https://bitcoin.org/en/developer-reference#merkleblock]]
*/ */
def merkleBlockMessage: Gen[MerkleBlockMessage] = def merkleBlockMessage: Gen[MerkleBlockMessage] =
@ -131,7 +131,7 @@ trait DataMessageGenerator {
(merkleBlock, _, _) <- MerkleGenerator.merkleBlockWithInsertedTxIds (merkleBlock, _, _) <- MerkleGenerator.merkleBlockWithInsertedTxIds
} yield MerkleBlockMessage(merkleBlock) } yield MerkleBlockMessage(merkleBlock)
/** Generates a [[TransactionMessage]] /** Generates a [[org.bitcoins.core.p2p.TransactionMessage]]
* @see [[https://bitcoin.org/en/developer-reference#tx]] * @see [[https://bitcoin.org/en/developer-reference#tx]]
* */ * */
def transactionMessage: Gen[TransactionMessage] = def transactionMessage: Gen[TransactionMessage] =

View file

@ -96,7 +96,7 @@ abstract class NodeTestUtil extends BitcoinSLogger {
new InetSocketAddress(instance.uri.getHost, instance.p2pPort) new InetSocketAddress(instance.uri.getHost, instance.p2pPort)
} }
/** Gets the [[Peer]] that /** Gets the [[org.bitcoins.node.models.Peer]] that
* corresponds to [[org.bitcoins.rpc.client.common.BitcoindRpcClient]] */ * corresponds to [[org.bitcoins.rpc.client.common.BitcoindRpcClient]] */
def getBitcoindPeer(bitcoindRpcClient: BitcoindRpcClient): Peer = { def getBitcoindPeer(bitcoindRpcClient: BitcoindRpcClient): Peer = {
val socket = getBitcoindSocketAddress(bitcoindRpcClient) val socket = getBitcoindSocketAddress(bitcoindRpcClient)

View file

@ -609,7 +609,7 @@ trait BitcoindRpcTestUtil extends BitcoinSLogger {
} }
/** /**
* Returns a triple of [[org.bitcoins.rpc.client.common.BitcoindRpcClient BitcoindRpcClient]] * Returns a triple of org.bitcoins.rpc.client.common.BitcoindRpcClient BitcoindRpcClient
* that are connected with some blocks in the chain * that are connected with some blocks in the chain
*/ */
def createNodeTriple( def createNodeTriple(
@ -620,7 +620,7 @@ trait BitcoindRpcTestUtil extends BitcoinSLogger {
} }
/** /**
* Returns a triple of [[org.bitcoins.rpc.client.v17.BitcoindV17RpcClient BitcoindV17RpcClient]] * @return a triple of [[org.bitcoins.rpc.client.v17.BitcoindV17RpcClient BitcoindV17RpcClient]]
* that are connected with some blocks in the chain * that are connected with some blocks in the chain
*/ */
def createNodeTripleV17( def createNodeTripleV17(
@ -662,7 +662,7 @@ trait BitcoindRpcTestUtil extends BitcoinSLogger {
* or a [[org.bitcoins.rpc.client.v16.BitcoindV16RpcClient BitcoindV16RpcClient]] * or a [[org.bitcoins.rpc.client.v16.BitcoindV16RpcClient BitcoindV16RpcClient]]
* from the provided `signer`, and then calls the appropriate method on the result. * from the provided `signer`, and then calls the appropriate method on the result.
* *
* Throws a [[RuntimeException]] if no versioned * @throws RuntimeException if no versioned
* [[org.bitcoins.rpc.client.common.BitcoindRpcClient BitcoindRpcClient]] * [[org.bitcoins.rpc.client.common.BitcoindRpcClient BitcoindRpcClient]]
* can be constructed. * can be constructed.
*/ */

View file

@ -1,20 +1,13 @@
package org.bitcoins.wallet package org.bitcoins.wallet
import java.nio.charset.StandardCharsets import org.bitcoins.core.crypto._
import org.bitcoins.core.util.BitcoinSLogger
import org.bitcoins.core.crypto.{AesCrypt, AesEncryptedData, MnemonicCode}
import scodec.bits.ByteVector import scodec.bits.ByteVector
import scala.util.Try import scala.util.{Failure, Success, Try}
import org.bitcoins.core.crypto.AesSalt
import org.bitcoins.core.crypto.AesPassword
import org.bitcoins.core.util.BitcoinSLogger
import scala.util.Success
import scala.util.Failure
case class EncryptedMnemonic(value: AesEncryptedData, salt: AesSalt) case class EncryptedMnemonic(value: AesEncryptedData, salt: AesSalt)
extends BitcoinSLogger { extends BitcoinSLogger {
import org.bitcoins.core.util.EitherUtil.EitherOps._
def toMnemonic(password: AesPassword): Try[MnemonicCode] = { def toMnemonic(password: AesPassword): Try[MnemonicCode] = {
val key = password.toKey(salt) val key = password.toKey(salt)

View file

@ -3,6 +3,7 @@ package org.bitcoins.wallet
import org.bitcoins.core.config.BitcoinNetwork import org.bitcoins.core.config.BitcoinNetwork
import org.bitcoins.core.crypto._ import org.bitcoins.core.crypto._
import org.bitcoins.core.currency._ import org.bitcoins.core.currency._
import org.bitcoins.core.hd._
import org.bitcoins.core.protocol.BitcoinAddress import org.bitcoins.core.protocol.BitcoinAddress
import org.bitcoins.core.protocol.transaction._ import org.bitcoins.core.protocol.transaction._
import org.bitcoins.core.util.{BitcoinSLogger, EitherUtil} import org.bitcoins.core.util.{BitcoinSLogger, EitherUtil}
@ -10,13 +11,12 @@ import org.bitcoins.core.wallet.builder.BitcoinTxBuilder
import org.bitcoins.core.wallet.fee.FeeUnit import org.bitcoins.core.wallet.fee.FeeUnit
import org.bitcoins.core.wallet.utxo.BitcoinUTXOSpendingInfo import org.bitcoins.core.wallet.utxo.BitcoinUTXOSpendingInfo
import org.bitcoins.wallet.api._ import org.bitcoins.wallet.api._
import org.bitcoins.wallet.config.WalletAppConfig
import org.bitcoins.wallet.models._ import org.bitcoins.wallet.models._
import scodec.bits.BitVector import scodec.bits.BitVector
import scala.concurrent.{ExecutionContext, Future} import scala.concurrent.{ExecutionContext, Future}
import scala.util.{Failure, Success, Try} import scala.util.{Failure, Success, Try}
import org.bitcoins.core.hd._
import org.bitcoins.wallet.config.WalletAppConfig
sealed abstract class Wallet sealed abstract class Wallet
extends LockedWallet extends LockedWallet
@ -165,7 +165,6 @@ object Wallet extends CreateWalletApi with BitcoinSLogger {
override def initializeWithEntropy(entropy: BitVector)( override def initializeWithEntropy(entropy: BitVector)(
implicit config: WalletAppConfig, implicit config: WalletAppConfig,
ec: ExecutionContext): Future[InitializeWalletResult] = { ec: ExecutionContext): Future[InitializeWalletResult] = {
import org.bitcoins.core.util.EitherUtil.EitherOps._
logger.info(s"Initializing wallet on chain ${config.network}") logger.info(s"Initializing wallet on chain ${config.network}")

View file

@ -47,8 +47,8 @@ trait LockedWalletApi extends WalletApi {
/** /**
* Processes the given transaction, updating our DB state if it's relevant to us. * Processes the given transaction, updating our DB state if it's relevant to us.
* @param transaction The transacton we're processing * @param transaction The transaction we're processing
* @param confirmation How many confirmations the TX has * @param confirmations How many confirmations the TX has
*/ */
def processTransaction( def processTransaction(
transaction: Transaction, transaction: Transaction,
@ -78,7 +78,9 @@ trait LockedWalletApi extends WalletApi {
*/ */
// def updateUtxo: Future[WalletApi] // def updateUtxo: Future[WalletApi]
/** Lists unspent transaction outputs in the wallet */ /** Lists unspent transaction outputs in the wallet
* @return Vector[SpendingInfoDb]
* */
def listUtxos(): Future[Vector[SpendingInfoDb]] def listUtxos(): Future[Vector[SpendingInfoDb]]
def listAddresses(): Future[Vector[AddressDb]] def listAddresses(): Future[Vector[AddressDb]]
@ -88,10 +90,10 @@ trait LockedWalletApi extends WalletApi {
* type. Calling this method multiple * type. Calling this method multiple
* times will return the same address, until it has * times will return the same address, until it has
* received funds. * received funds.
* * TODO: Last sentence is not true, implement that
* https://github.com/bitcoin-s/bitcoin-s/issues/628
* @param addressType
*/ */
// TODO: Last sentence is not true, implement that
// https://github.com/bitcoin-s/bitcoin-s/issues/628
def getNewAddress(addressType: AddressType): Future[BitcoinAddress] def getNewAddress(addressType: AddressType): Future[BitcoinAddress]
/** /**
@ -109,6 +111,7 @@ trait LockedWalletApi extends WalletApi {
/** /**
* Mimics the `getaddressinfo` RPC call in Bitcoin Core * Mimics the `getaddressinfo` RPC call in Bitcoin Core
* *
* @param address
* @return If the address is found in our database `Some(address)` * @return If the address is found in our database `Some(address)`
* is returned, otherwise `None` * is returned, otherwise `None`
*/ */
@ -129,10 +132,13 @@ trait LockedWalletApi extends WalletApi {
/** /**
* Fetches the default account from the DB * Fetches the default account from the DB
* @return Future[AccountDb]
*/ */
protected[wallet] def getDefaultAccount(): Future[AccountDb] protected[wallet] def getDefaultAccount(): Future[AccountDb]
/** Fetches the default account for the given address/acount kind */ /** Fetches the default account for the given address/account kind
* @param addressType
* */
protected[wallet] def getDefaultAccountForType( protected[wallet] def getDefaultAccountForType(
addressType: AddressType): Future[AccountDb] addressType: AddressType): Future[AccountDb]
@ -144,7 +150,10 @@ trait LockedWalletApi extends WalletApi {
def listAccounts(): Future[Vector[AccountDb]] def listAccounts(): Future[Vector[AccountDb]]
/** Lists all wallet accounts with the given type */ /** Lists all wallet accounts with the given type
* @param purpose
* @return [[Future[Vector[AccountDb]]
* */
def listAccounts(purpose: HDPurpose): Future[Vector[AccountDb]] = def listAccounts(purpose: HDPurpose): Future[Vector[AccountDb]] =
listAccounts().map(_.filter(_.hdAccount.purpose == purpose)) listAccounts().map(_.filter(_.hdAccount.purpose == purpose))

View file

@ -31,7 +31,7 @@ import org.bitcoins.core.crypto.DoubleSha256DigestBE
*/ */
private[wallet] trait UtxoHandling { self: LockedWallet => private[wallet] trait UtxoHandling { self: LockedWallet =>
/** $inheritdoc */ /** @inheritdoc */
override def listUtxos(): Future[Vector[SpendingInfoDb]] = override def listUtxos(): Future[Vector[SpendingInfoDb]] =
spendingInfoDAO.findAllUnspent() spendingInfoDAO.findAllUnspent()

View file

@ -160,14 +160,10 @@ sealed trait SpendingInfoDb
/** /**
* This table stores the necessary information to spend * This table stores the necessary information to spend
* a TXO at a later point in time. * a transaction output (TXO) at a later point in time. It
* * also stores how many confirmations it has, whether
* It does not contain informations about whether or not * or not it is spent (i.e. if it is a UTXO or not) and the
* it is spent, how many (if any) confirmations it has * TXID of the transaction that created this output.
* or which block/transaction it was included in.
*
* That is rather handled by
* [[org.bitcoins.wallet.models.WalletTXOTable WalletTXOTable]].
*/ */
case class SpendingInfoTable(tag: Tag) case class SpendingInfoTable(tag: Tag)
extends TableAutoInc[SpendingInfoDb](tag, "txo_spending_info") { extends TableAutoInc[SpendingInfoDb](tag, "txo_spending_info") {