mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-07-06 12:52:31 +00:00
[NOD-36] Convert util.MaxSatoshi to integer (#199)
This commit is contained in:
parent
d62279192a
commit
aacb2ada43
@ -180,7 +180,7 @@ func CheckTransactionSanity(tx *util.Tx, subnetworkID *subnetworkid.SubnetworkID
|
|||||||
satoshi := txOut.Value
|
satoshi := txOut.Value
|
||||||
if satoshi > util.MaxSatoshi {
|
if satoshi > util.MaxSatoshi {
|
||||||
str := fmt.Sprintf("transaction output value of %d is "+
|
str := fmt.Sprintf("transaction output value of %d is "+
|
||||||
"higher than max allowed value of %f", satoshi,
|
"higher than max allowed value of %d", satoshi,
|
||||||
util.MaxSatoshi)
|
util.MaxSatoshi)
|
||||||
return ruleError(ErrBadTxOutValue, str)
|
return ruleError(ErrBadTxOutValue, str)
|
||||||
}
|
}
|
||||||
@ -191,7 +191,7 @@ func CheckTransactionSanity(tx *util.Tx, subnetworkID *subnetworkid.SubnetworkID
|
|||||||
newTotalSatoshi := totalSatoshi + satoshi
|
newTotalSatoshi := totalSatoshi + satoshi
|
||||||
if newTotalSatoshi < totalSatoshi {
|
if newTotalSatoshi < totalSatoshi {
|
||||||
str := fmt.Sprintf("total value of all transaction "+
|
str := fmt.Sprintf("total value of all transaction "+
|
||||||
"outputs exceeds max allowed value of %f",
|
"outputs exceeds max allowed value of %d",
|
||||||
util.MaxSatoshi)
|
util.MaxSatoshi)
|
||||||
return ruleError(ErrBadTxOutValue, str)
|
return ruleError(ErrBadTxOutValue, str)
|
||||||
}
|
}
|
||||||
@ -199,7 +199,7 @@ func CheckTransactionSanity(tx *util.Tx, subnetworkID *subnetworkid.SubnetworkID
|
|||||||
if totalSatoshi > util.MaxSatoshi {
|
if totalSatoshi > util.MaxSatoshi {
|
||||||
str := fmt.Sprintf("total value of all transaction "+
|
str := fmt.Sprintf("total value of all transaction "+
|
||||||
"outputs is %d which is higher than max "+
|
"outputs is %d which is higher than max "+
|
||||||
"allowed value of %f", totalSatoshi,
|
"allowed value of %d", totalSatoshi,
|
||||||
util.MaxSatoshi)
|
util.MaxSatoshi)
|
||||||
return ruleError(ErrBadTxOutValue, str)
|
return ruleError(ErrBadTxOutValue, str)
|
||||||
}
|
}
|
||||||
@ -925,7 +925,7 @@ func CheckTransactionInputs(tx *util.Tx, txHeight int32, utxoSet UTXOSet, dagPar
|
|||||||
originTxSatoshi := entry.Amount()
|
originTxSatoshi := entry.Amount()
|
||||||
if originTxSatoshi > util.MaxSatoshi {
|
if originTxSatoshi > util.MaxSatoshi {
|
||||||
str := fmt.Sprintf("transaction output value of %s is "+
|
str := fmt.Sprintf("transaction output value of %s is "+
|
||||||
"higher than max allowed value of %f",
|
"higher than max allowed value of %d",
|
||||||
util.Amount(originTxSatoshi),
|
util.Amount(originTxSatoshi),
|
||||||
util.MaxSatoshi)
|
util.MaxSatoshi)
|
||||||
return 0, ruleError(ErrBadTxOutValue, str)
|
return 0, ruleError(ErrBadTxOutValue, str)
|
||||||
@ -940,7 +940,7 @@ func CheckTransactionInputs(tx *util.Tx, txHeight int32, utxoSet UTXOSet, dagPar
|
|||||||
totalSatoshiIn > util.MaxSatoshi {
|
totalSatoshiIn > util.MaxSatoshi {
|
||||||
str := fmt.Sprintf("total value of all transaction "+
|
str := fmt.Sprintf("total value of all transaction "+
|
||||||
"inputs is %d which is higher than max "+
|
"inputs is %d which is higher than max "+
|
||||||
"allowed value of %f", totalSatoshiIn,
|
"allowed value of %d", totalSatoshiIn,
|
||||||
util.MaxSatoshi)
|
util.MaxSatoshi)
|
||||||
return 0, ruleError(ErrBadTxOutValue, str)
|
return 0, ruleError(ErrBadTxOutValue, str)
|
||||||
}
|
}
|
||||||
|
@ -6,11 +6,11 @@ package util
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
// SatoshiPerBitcent is the number of satoshi in one bitcoin cent.
|
// SatoshiPerBitcent is the number of satoshi in one bitcoin cent.
|
||||||
SatoshiPerBitcent = 1e6
|
SatoshiPerBitcent = 1000000
|
||||||
|
|
||||||
// SatoshiPerBitcoin is the number of satoshi in one bitcoin (1 BTC).
|
// SatoshiPerBitcoin is the number of satoshi in one bitcoin (1 BTC).
|
||||||
SatoshiPerBitcoin = 1e8
|
SatoshiPerBitcoin = 100000000
|
||||||
|
|
||||||
// MaxSatoshi is the maximum transaction amount allowed in satoshi.
|
// MaxSatoshi is the maximum transaction amount allowed in satoshi.
|
||||||
MaxSatoshi = 21e6 * SatoshiPerBitcoin
|
MaxSatoshi = 21000000 * SatoshiPerBitcoin
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user