mirror of
https://github.com/bitcoin-s/bitcoin-s.git
synced 2025-02-24 15:02:17 +01:00
Adding invariants about payment channels, also adding helper functions to transfer a channel from AwaitingTx -> InProgress -> Closed
This commit is contained in:
parent
9762f95379
commit
8fe60681d7
2 changed files with 14 additions and 6 deletions
|
@ -97,12 +97,13 @@ object Bitcoins extends BaseNumbers[Bitcoins] {
|
|||
|
||||
|
||||
object CurrencyUnits {
|
||||
def zero: CurrencyUnit = Satoshis.zero
|
||||
def negativeSatoshi = Satoshis(Int64(-1))
|
||||
|
||||
/** The number you need to multiply BTC by to get it's satoshis */
|
||||
def btcToSatoshiScalar: Long = 100000000
|
||||
def satoshisToBTCScalar: BigDecimal = BigDecimal(1.0) / btcToSatoshiScalar
|
||||
def oneBTC: CurrencyUnit = Satoshis(Int64(btcToSatoshiScalar))
|
||||
val btcToSatoshiScalar: Long = 100000000
|
||||
val satoshisToBTCScalar: BigDecimal = BigDecimal(1.0) / btcToSatoshiScalar
|
||||
val oneBTC: CurrencyUnit = Satoshis(Int64(btcToSatoshiScalar))
|
||||
val zero: CurrencyUnit = Satoshis.zero
|
||||
val negativeSatoshi = Satoshis(Int64(-1))
|
||||
|
||||
def toSatoshis(unit : CurrencyUnit): Satoshis = unit match {
|
||||
case b: Bitcoins => b.satoshis
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package org.bitcoins.core.policy
|
||||
|
||||
import org.bitcoins.core.currency.{CurrencyUnit, Satoshis}
|
||||
import org.bitcoins.core.number.Int64
|
||||
import org.bitcoins.core.script.flag._
|
||||
|
||||
/**
|
||||
|
@ -18,7 +20,7 @@ trait Policy {
|
|||
* Failing one of these tests may trigger a DoS ban - see CheckInputs() for
|
||||
* details.
|
||||
*/
|
||||
def mandatoryScriptVerifyFlags : Seq[ScriptFlag] = Seq(ScriptVerifyP2SH)
|
||||
def mandatoryScriptVerifyFlags: Seq[ScriptFlag] = Seq(ScriptVerifyP2SH)
|
||||
|
||||
/** The default script verify flags used to validate the blockchain
|
||||
* and bitcoin transactions */
|
||||
|
@ -28,6 +30,11 @@ trait Policy {
|
|||
ScriptVerifyLowS, ScriptVerifyWitness, ScriptVerifyMinimalIf, ScriptVerifyNullFail,
|
||||
ScriptVerifyNullDummy, ScriptVerifyWitnessPubKeyType, ScriptVerifyDiscourageUpgradableWitnessProgram)
|
||||
|
||||
/** The number of confirmations for a payment to be considered as accepted */
|
||||
def confirmations: Long = 6
|
||||
|
||||
def minPaymentChannelAmount: CurrencyUnit = Satoshis(Int64(10000))
|
||||
|
||||
}
|
||||
|
||||
object Policy extends Policy
|
||||
|
|
Loading…
Add table
Reference in a new issue