mirror of
https://github.com/bitcoin-s/bitcoin-s.git
synced 2025-02-23 22:56:52 +01:00
Adding code to deduct network fee from creditingOutputs, adding sanityChecks
This commit is contained in:
parent
128bb8d890
commit
bed82d5e65
2 changed files with 59 additions and 0 deletions
|
@ -50,4 +50,41 @@ object TxBuilderError {
|
|||
*/
|
||||
case object NoSigner extends TxBuilderError
|
||||
|
||||
/** Means that you specified a fee that was too large for the change output you provided.
|
||||
* This may happen if you have a transaction with a lot of inputs, or the change output you provided
|
||||
* is a output that contains a very small amount of bitcoin.
|
||||
* */
|
||||
case object FeeToLarge extends TxBuilderError
|
||||
|
||||
/** Means that the [[TxBuilder.destinations]] outputs you specified when creating the [[TxBuilder]] are NOT
|
||||
* all included in the final signed tx
|
||||
*/
|
||||
case object MissingDestinationOutput extends TxBuilderError
|
||||
|
||||
/** Means that you provided a outpoint in the [[TxBuilder.utxoMap]] that does not
|
||||
* exist inside of [[TxBuilder.creditingTxs]]. You cannot spend an outpoint that was not
|
||||
* passed into the txbuilder originally
|
||||
*/
|
||||
case object MissingCreditingTx extends TxBuilderError
|
||||
|
||||
/** Means that the signed version of this transaction has MORE outputs than what was specified
|
||||
* when building the [[TxBuilder]]. [[TxBuilder.destinations]] && [[TxBuilder.changeOutput]] should
|
||||
* be the only outputs in the signedTx
|
||||
*/
|
||||
case object ExtraOutputsAdded extends TxBuilderError
|
||||
|
||||
/** Means that the transaction spends outpoints that were not given when creating
|
||||
* the [[TxBuilder]], aka, we should only spend outpoints in [[TxBuilder.outPoints]]
|
||||
*/
|
||||
case object ExtraOutPoints extends TxBuilderError
|
||||
|
||||
/** Means that this transaction attempts to print satoshis out of thin air */
|
||||
case object MintsMoney extends TxBuilderError
|
||||
|
||||
/** Means that the fee was not within the given range of error for [[TxBuilder.feeRate]]
|
||||
* This might mean that the transactions pays a much larger fee than what was given as the [[TxBuilder.feeRate]] parameter, or a
|
||||
* much smaller fee
|
||||
*/
|
||||
case object BadFee extends TxBuilderError
|
||||
|
||||
}
|
22
src/main/scala/org/bitcoins/core/wallet/fee/FeeUnit.scala
Normal file
22
src/main/scala/org/bitcoins/core/wallet/fee/FeeUnit.scala
Normal file
|
@ -0,0 +1,22 @@
|
|||
package org.bitcoins.core.wallet.fee
|
||||
|
||||
import org.bitcoins.core.currency.Satoshis
|
||||
|
||||
/** This is meant to be an abstract type that represents different fee unit measurements for
|
||||
* blockchains
|
||||
*/
|
||||
sealed abstract class FeeUnit
|
||||
|
||||
/** Meant to represent the different fee unit types for the bitcoin protocol
|
||||
* [[https://en.bitcoin.it/wiki/Weight_units]]
|
||||
*/
|
||||
sealed abstract class BitcoinFeeUnit
|
||||
|
||||
case class SatoshisPerByte(satoshis: Satoshis) extends FeeUnit
|
||||
|
||||
/** A 'virtual byte' (also known as virtual size) is a new weight measurement that
|
||||
* was created with segregated witness (BIP141). Now 1 'virtual byte'
|
||||
* has the weight of 4 bytes in the [[org.bitcoins.core.protocol.transaction.TransactionWitness]]
|
||||
* of a [[org.bitcoins.core.protocol.transaction.WitnessTransaction]]
|
||||
*/
|
||||
case class SatoshisPerVirtualByte(satoshis: Satoshis) extends FeeUnit
|
Loading…
Add table
Reference in a new issue